Skip to content

refactor: move public api to init - #60

Closed
jkowalleck wants to merge 10 commits into
mainfrom
refactor/rotate-declarations
Closed

jkowalleck wants to merge 10 commits into
mainfrom
refactor/rotate-declarations

Conversation

@jkowalleck

Copy link
Copy Markdown
Collaborator

No description provided.

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py implementation with a deprecated re-export shim that forwards attribute access to the package.
  • Added a brief module docstring to utils.py indicating 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 when grammar is 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>
@jkowalleck
jkowalleck marked this pull request as draft July 21, 2026 16:14
@jkowalleck jkowalleck closed this Jul 24, 2026
@jkowalleck
jkowalleck deleted the refactor/rotate-declarations branch July 24, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants