-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support Mypy Type Checking #37
Comments
Is this a problem because Parsita is not marked as |
Good point, I didn't check that parista is missing |
I took a look at bringing Parsita up to mypy's standards. It is doable, but it's a non-trivial amount of work, and I don't have any experience doing this. To anyone reading this: I would accept a PR to make Parsita mypy compatible. |
I would add a vote for mypy support. It's easy enough to work around by explicitly suppressing Also, @drhagen, thanks so much for all your work on this library; it's really slick and fun to use! |
I guess I haven't taken a look at this since the release of Parsita 2.0. A lot of things got simplified in the major release, so maybe it will be doable this time around. |
After spending a ton of time playing around with Python types in Parsita, I have concluded that it is basically impossible to do well. I have made a best-effort at typing and add Python lacks lower type bounds and higher-kinded types. As such, it is unable to express many of the operations that a parser combinator library must perform. |
When adding
parsita
to a project that is type checked withmypy
, we had to add the following configuration to ourmypy
configuration:Note that
disallow_subclassing_any
is not enabled by default, but we usestrict = true
above to provide better type checking in our Python projects.Otherwise we get a lot of errors of the form:
I'm not sure if this is something that can be fixed upstream in
parsita
, but at a minimum having a type checking page in the documentation with known issues like this could help future users.Environment
parsita
1.7.1The text was updated successfully, but these errors were encountered: