Skip to content
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

mypy complains about types of Registry and Resource #204

Open
nbro10 opened this issue Jan 3, 2025 · 1 comment
Open

mypy complains about types of Registry and Resource #204

nbro10 opened this issue Jan 3, 2025 · 1 comment

Comments

@nbro10
Copy link

nbro10 commented Jan 3, 2025

referencing version 0.35.1

Let's say I have this snippet

# example.py

from referencing import Registry, Resource
from referencing.jsonschema import DRAFT7

registry = Registry()
resource = Resource(contents="hello.json", specification=DRAFT7)

If I run mypy 1.14.1 on it with poetry run mypy example.py, I get this

example.py:6: error: Need type annotation for "registry"  [var-annotated]
example.py:7: error: Unexpected keyword argument "contents" for "Resource"  [call-arg]
example.py:7: error: Unexpected keyword argument "specification" for "Resource"  [call-arg]
example.py:7: error: Need type annotation for "resource"  [var-annotated]
Found 4 errors in 1 file (checked 1 source file)

I see you have a py.typed here https://github.com/python-jsonschema/referencing/tree/main/referencing, but it's not working then correctly

@Julian
Copy link
Member

Julian commented Jan 3, 2025

Things work mostly with pyright, which is what the tests here use so I'd suggest you try that, but at some point we may investigate if mypy can be made to work.

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

No branches or pull requests

2 participants