Skip to content

Mypy errors after flake8-pyi Y037 changes: Type application has too many types (1 expected) #9690

Closed as not planned

Description

@intgr

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)

Activity

  1. AlexWaygood commented on Feb 7, 2023

    @AlexWaygood
    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.

  2. AlexWaygood commented on Feb 7, 2023

    @AlexWaygood
    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.

  3. intgr commented on Feb 7, 2023

    @intgr
    ContributorAuthor

    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?

  4. AlexWaygood commented on Feb 7, 2023

    @AlexWaygood
    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.

  5. AlexWaygood commented on Feb 7, 2023

    @AlexWaygood
    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.

  6. intgr commented on Feb 7, 2023

    @intgr
    ContributorAuthor

    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.

  7. AlexWaygood commented on Feb 21, 2023

    @AlexWaygood
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions