Skip to content

Accept dotted (module-qualified) type names in parameter annotations#872

Open
huyhoang171106 wants to merge 2 commits intonteract:mainfrom
huyhoang171106:fix/accept-dotted-module-qualified-type-name
Open

Accept dotted (module-qualified) type names in parameter annotations#872
huyhoang171106 wants to merge 2 commits intonteract:mainfrom
huyhoang171106:fix/accept-dotted-module-qualified-type-name

Conversation

@huyhoang171106
Copy link
Copy Markdown

Summary

The Python parameter inference logic currently misses annotated parameters when the annotation is package-scoped (for example datetime.date, datetime.datetime, datetime.time). This causes --help-notebook to skip otherwise valid parameters declared with PEP-526 style annotations. The root cause is an overly restrictive annotation-matching regex that accepts only a single identifier token for the type.

Files changed

  • papermill/translators.py (modified)
  • papermill/tests/test_translators.py (modified)

Testing

  • Not run in this environment.

What does this PR do?

Fixes #<issue_number>

Closes #807

…notations

Signed-off-by: Nguyen Huy Hoang <181364121+huyhoang171106@users.noreply.github.com>
…notations

Signed-off-by: Nguyen Huy Hoang <181364121+huyhoang171106@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 26, 2026 14:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Python parameter inference so that PEP-526 style annotations using module-qualified (dotted) type names (e.g., datetime.date) are recognized during PythonTranslator.inspect, which in turn improves parameter discovery for --help-notebook.

Changes:

  • Broadened the Python parameter-regex annotation matcher to allow . in annotation tokens.
  • Added a regression test ensuring PythonTranslator.inspect parses a dotted annotation correctly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
papermill/translators.py Expands PARAMETER_PATTERN to accept dotted type names in annotations.
papermill/tests/test_translators.py Adds a unit test case covering datetime.date annotations during inspection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

parameter types missed for package-scoped annotations

2 participants