-
Notifications
You must be signed in to change notification settings - Fork 21
feat: restructure conversion #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f905506 to
d4fc7f3
Compare
There was a problem hiding this 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 adds a to_project_table function that converts and validates dictionaries to PyProjectTable TypedDict at runtime. This enables runtime type checking of pyproject.toml data structures.
- Added
to_project_table()function for runtime type validation - Added
_cast()helper function for recursive type checking - Improved Python 3.10 compatibility by making
typing_extensions.Requiredoptional
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pyproject_metadata/project_table.py | Adds runtime type validation functions (to_project_table, _cast, is_typed_dict) and improves Required import handling for Python 3.10 compatibility |
| tests/test_project_table.py | Comprehensive test coverage for the new conversion function, including success and error cases |
| pyproject.toml | Adds linter exception for ERA001 (commented-out code) in project_table.py |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7fb6708 to
1d919c8
Compare
1d919c8 to
4419e24
Compare
9a8a187 to
2596540
Compare
2596540 to
7ecfa56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ParamSpec = typing.TypeVar | ||
| Concatenate = object |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback for ParamSpec and Concatenate on Python < 3.10 without typing_extensions will fail at runtime. On line 66, P.args and P.kwargs are accessed, but when ParamSpec is aliased to TypeVar (line 19), TypeVar instances don't have these attributes. Either add typing_extensions as a dependency for Python < 3.10, or implement a proper fallback class that provides args and kwargs attributes.
| ParamSpec = typing.TypeVar | |
| Concatenate = object | |
| try: | |
| from typing_extensions import Concatenate, ParamSpec | |
| except ImportError: | |
| def ParamSpec(name: str) -> typing.TypeVar: | |
| tv = typing.TypeVar(name) | |
| # Provide .args and .kwargs attributes so that annotations like | |
| # *args: P.args, **kwargs: P.kwargs do not fail at runtime. | |
| setattr(tv, "args", ()) | |
| setattr(tv, "kwargs", {}) | |
| return tv | |
| class Concatenate: | |
| """Minimal runtime fallback for typing_extensions.Concatenate. | |
| This is only used in type annotations; returning the argument from | |
| __class_getitem__ is sufficient for annotations to evaluate. | |
| """ | |
| def __class_getitem__(cls, item): | |
| return item |
| "Field \"project.dynamic[0]\" expected one of 'authors', 'classifiers', " | ||
| "'dependencies', 'description', 'dynamic', 'entry-points', 'gui-scripts', " | ||
| "'import-names', 'import-namespaces', 'keywords', 'license', " | ||
| "'maintainers', 'optional-dependencies', 'readme', 'requires-python', " | ||
| "'scripts', 'urls', 'version' (got 'name')", |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implicit string concatenation. Maybe missing a comma?
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: Copilot <[email protected]>
86c8232 to
a439731
Compare
Signed-off-by: Henry Schreiner <[email protected]>
68e0f05 to
08aaedd
Compare
Restructure the way we convert. Better error messages.