Simplify overriding selective evaluation policy settings for modules - #14943
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the configuration of selective evaluation policy settings for modules by allowing module-level allow lists and supporting dotted path notation. The main goal is to make it easier to enable eager attribute evaluation for entire packages without having to specify individual components as tuples.
Key changes:
- Allow dotted string paths (e.g., "my.trusted.library") in addition to tuple paths for specifying allowed modules
- Add support for module-level allow lists that apply to all submodules and objects within a package
- Fix prefix trimming issues in expression evaluation that could cause incorrect behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_completer.py | Adds comprehensive test coverage for module-level allow list functionality and prefix trimming fixes |
| IPython/core/guarded_eval.py | Implements dotted path coercion, enhanced module resolution for namespace packages, and improved type checking logic |
| IPython/core/completer.py | Refines exception handling in expression evaluation to fix prefix trimming issues |
Comments suppressed due to low confidence (1)
IPython/core/guarded_eval.py:157
- This line is missing the string literal before
.join(). It should be".".join([module_name, *access_path]).
full_module_path = ".".join([module_name, *access_path])
Collaborator
|
This looks good to me! 👍 |
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.
References
Code changes
("my")where("my", )would have been expected beforeUser-facing changes
It is now possible to enable eager attribute evaluation in completer on an entire package with: