Add type hints to parsers#993
Draft
GlassOfWhiskey wants to merge 2 commits into
Draft
Conversation
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
from
December 18, 2025 21:36
0e71603 to
63fea3e
Compare
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
9 times, most recently
from
December 19, 2025 10:12
ddb56f1 to
b7800c2
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #993 +/- ##
==========================================
- Coverage 71.73% 71.23% -0.51%
==========================================
Files 53 53
Lines 9957 10159 +202
Branches 2061 2093 +32
==========================================
+ Hits 7143 7237 +94
- Misses 2261 2358 +97
- Partials 553 564 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
2 times, most recently
from
December 20, 2025 21:08
33bb828 to
a8947d0
Compare
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
6 times, most recently
from
April 5, 2026 20:53
4f2c146 to
cc5d220
Compare
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
5 times, most recently
from
June 29, 2026 17:34
3883246 to
09cfc31
Compare
mr-c
reviewed
Jun 30, 2026
|
|
||
| ext = ", ".join(parents) if parents else "Saveable" | ||
| self.out.write( | ||
| fmt(f"@mypyc_attr(native_class=True)\nclass {classname}({ext}):\n pass", 0)[:-9] |
Member
There was a problem hiding this comment.
Why @mypyc_attr(native_class=True)?
Contributor
Author
There was a problem hiding this comment.
To ensure it is actually compiled succesfully by mypyc, and to intercept potential regressions in the future
Member
There was a problem hiding this comment.
I recommend @mypyc_attr(native_class=True, allow_interpreted_subclasses=True) to allow for subclassing
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
from
July 10, 2026 13:45
09cfc31 to
b4e5f29
Compare
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
2 times, most recently
from
July 15, 2026 16:56
5dcde48 to
2ef29fc
Compare
GlassOfWhiskey
force-pushed
the
typed-python-parsers
branch
from
July 15, 2026 19:20
2ef29fc to
453636b
Compare
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.
This commit enables type hints within Python generated parsers. by refactoring how the codegen logic handles instance types. Results are fully-typed Python objects ready to be compiled with
mypyc.