Repository navigation
refactor: move public api to init - #60
Closed
jkowalleck wants to merge 10 commits into
Closed
jkowalleck wants to merge 10 commits into
jkowalleck wants to merge 10 commits into
Conversation
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
There was a problem hiding this comment.
Pull request overview
Refactors the package so the public RFC3987 syntax API lives in rfc3987_syntax2.__init__, while keeping syntax_helpers as a deprecated compatibility re-export module.
Changes:
- Moved the previously exported parser constants/functions/validators into
src/rfc3987_syntax2/__init__.py. - Replaced
syntax_helpers.pyimplementation with a deprecated re-export shim that forwards attribute access to the package. - Added a brief module docstring to
utils.pyindicating the remaining helper(s) are deprecated.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/rfc3987_syntax2/utils.py | Adds module docstring describing the module as deprecated. |
| src/rfc3987_syntax2/syntax_helpers.py | Converts module into a deprecated re-export shim via __getattr__ forwarding. |
| src/rfc3987_syntax2/init.py | Becomes the primary public API surface, including lazy-loaded grammar and syntax_parser. |
Comments suppressed due to low confidence (1)
src/rfc3987_syntax2/init.py:325
__getattr__prints to stdout whengrammaris accessed. This creates unexpected side effects for library consumers (and can break tooling/tests that rely on clean stdout) when merely reading a module attribute.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
71
to
+75
| def __getattr__(name: str) -> Any: | ||
| if name == "grammar": | ||
| global grammar | ||
| grammar = _get_grammar() | ||
| return grammar | ||
| if name == "syntax_parser": | ||
| global syntax_parser | ||
| syntax_parser = _get_syntax_parser() | ||
| return syntax_parser | ||
| if name in __all__: | ||
| value = getattr(_pkg, name) | ||
| globals()[name] = value | ||
| return value |
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
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.
No description provided.