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 errors after flake8-pyi Y037 changes: Type application has too many types (1 expected) #9690

Closed
intgr opened this issue Feb 7, 2023 · 7 comments

Comments

@intgr
Copy link
Contributor

intgr commented Feb 7, 2023

types-requests version 2.28.11.11 and types-urllib3 version 1.26.25.5 somehow cause issues with lots of djangotestframework-stubs CI tests. (https://github.com/typeddjango/djangorestframework-stubs/actions/runs/4114959794/jobs/7103023727)

According to changelog #9686 was the only change in that version.

Errors like this appear in every test:

requests-stubs/sessions.pyi:80: error: Type application has too many types (1 expected) (diff)
requests-stubs/sessions.pyi:81: error: Type application has too many types (1 expected) (diff)
requests-stubs/sessions.pyi:99: error: Type application has too many types (1 expected) (diff)
requests-stubs/sessions.pyi:106: error: Type application has too many types (1 expected) (diff)
urllib3-stubs/fields.pyi:6: error: Type application has too many types (1 expected) (diff)

@AlexWaygood
Copy link
Member

Same question as #9686 (comment): do your tests run with mypy 1.0? If not, then you may need to upgrade to mypy 1.0 (or temporarily pin to a lower version of types-requests).

That error message comes from python/mypy#11098, but that bug should have been fixed in mypy 1.0.

@AlexWaygood
Copy link
Member

We should probably document better that our stubs can generally only be guaranteed to be compatible with the latest version of $TYPECHECKER. We've previously discussed that in #6843.

@intgr
Copy link
Contributor Author

intgr commented Feb 7, 2023

do your tests run with mypy 1.0?

What does it look like I'm doing 😆

No, there's a PR typeddjango/djangorestframework-stubs#339 that had issues due to changes in another upstream project. Whilst fixing those in typeddjango/djangorestframework-stubs#345 I ran into this issue.

But seriously, mypy 1.0 hasn't even been out for 24 HOURS yet! Is it really considered reasonable in this project to break users so quickly following a release?

@AlexWaygood
Copy link
Member

But seriously, mypy 1.0 hasn't even been out for 24 HOURS yet! Is it really considered reasonable in this project to break users so quickly following a release?

That's useful feedback, thanks -- and I'm sorry for the disruption caused. I'll try to be more cautious when making changes to third-party stubs in the future.

For context: for me, this was about closing an issue that had been open for over two years, which I was excited to finally resolve. Moreover, being able to see whether we could finally close the issue felt like a useful way of testing the latest mypy release.

@AlexWaygood
Copy link
Member

Unfortunately I doubt that there's much we can do here now that types-requests 2.28.11.11 has been released, so your best bet is probably to pin types-requests and types-urllib3 -- as you've already proposed in typeddjango/djangorestframework-stubs#345.

I'll try to do better in the future; apologies again.

@intgr
Copy link
Contributor Author

intgr commented Feb 7, 2023

Fair enough, hopefully this issue will be findable via Google soon and other users who stumble upon this get a quicker answer. Maybe keep it open for a while.

@AlexWaygood
Copy link
Member

Mypy 1.0 has been out for two weeks now, so I'm going to close this now. Thanks again for reporting the issue, though.

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2023
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