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

Static analysis of types broken in >=0.2.0 #210

Closed
Tracked by #223
bjhardcastle opened this issue Mar 20, 2024 · 1 comment · Fixed by #212
Closed
Tracked by #223

Static analysis of types broken in >=0.2.0 #210

bjhardcastle opened this issue Mar 20, 2024 · 1 comment · Fixed by #212
Assignees
Labels
bug 🐛 Something isn't working

Comments

@bjhardcastle
Copy link

bjhardcastle commented Mar 20, 2024

Analyzing types with mypy was working before v0.2.0, now many attributes return Any.

If I run mypy on this .py file:

import typing
import upath

url = "https://github.com/fsspec/universal_pathlib/tree/main/upath"
root = upath.UPath(url, cache_type="first")
typing.reveal_type(root.glob('*'))
typing.reveal_type(root.iterdir())
typing.reveal_type(root.parent)
typing.reveal_type(root / 'README.md')
  • with 0.1.4:
scripts\test_types.py:6: note: Revealed type is "typing.Generator[upath.core.UPath, None, None]"
scripts\test_types.py:7: note: Revealed type is "typing.Generator[upath.core.UPath, None, None]"
scripts\test_types.py:8: note: Revealed type is "upath.core.UPath"
scripts\test_types.py:9: note: Revealed type is "upath.core.UPath"
  • with 0.2.2:
scripts\test_types.py:6: note: Revealed type is "Any"
scripts\test_types.py:7: note: Revealed type is "Any"
scripts\test_types.py:8: note: Revealed type is "Any"
scripts\test_types.py:9: note: Revealed type is "Any"

python: 3.11.5
mypy: 1.9.0
@ap--
Copy link
Collaborator

ap-- commented Mar 20, 2024

Hi @bjhardcastle

Thank you for reporting the typing issue!
I think it would be great if we'd run certain type checks together with the universal-pathlib test suite.

https://github.com/typeddjango/pytest-mypy-plugins seems to an interesting option for this.

I'll play around with it when I find some extra time.

-Andreas

@ap-- ap-- added the bug 🐛 Something isn't working label Mar 20, 2024
@ap-- ap-- mentioned this issue Apr 1, 2024
5 tasks
@ap-- ap-- mentioned this issue Jun 14, 2024
16 tasks
@ap-- ap-- self-assigned this Jun 14, 2024
@ap-- ap-- closed this as completed in #212 Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants