Repository navigation
[PYD-617] Remove default for modules parameter of install_auto_tracing - #261
Merged
Merged
Conversation
Deploying logfire-docs with
|
| Latest commit: |
4b85bd3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a9f85f4a.logfire-docs.pages.dev |
| Branch Preview URL: | https://alex-no-default-auto-trace-m.logfire-docs.pages.dev |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
alexmojaki
marked this pull request as ready for review
June 12, 2024 11:20
davidhewitt
approved these changes
Jun 12, 2024
davidhewitt
left a comment
Contributor
There was a problem hiding this comment.
LGTM with a suggestion to add more tests for related cases :)
Comment on lines
26
to
29
| if isinstance(modules, Sequence): # pragma: no branch | ||
| modules = modules_func_from_sequence(modules) | ||
|
|
||
| if not callable(modules): # pragma: no cover |
Contributor
There was a problem hiding this comment.
Maybe if / elif here? This seems like a prime opportunity to add tests for callable and also wrong-type inputs.
Suggested change
| if isinstance(modules, Sequence): # pragma: no branch | |
| modules = modules_func_from_sequence(modules) | |
| if not callable(modules): # pragma: no cover | |
| if isinstance(modules, Sequence): | |
| modules = modules_func_from_sequence(modules) | |
| elif not callable(modules): |
Contributor
Author
There was a problem hiding this comment.
Added a test for the wrong type. Testing a callable feels a bit redundant. Not using elif to make it clear that the sequence gets converted to a callable, so modules is always eventually a callable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently by default:
This means that providing no arguments will always raise an error about wanting to trace the current module which has obviously already been imported. Either
modulesorcheck_imported_modulesmust be specified. This is a bit weird.This PR makes things less weird by requiring the user to specify
modules. This seems like a case where explicit really is better than implicit.