Skip to content

Find a way to split types by Django version #1244

@adamchainz

Description

@adamchainz

Mypy supports splitting types by Python versions by interpreting if sys.version_info ... checks. But we have no mechanism to conditionally split types by Django version. This has lead to lots of small issues where Django’s API has changed and we cannot have correct types for all versions we attempt to support.

To counter this problem, @sobolevn suggested doing releases per Django version, where we only officially support the latest version: #1095 (comment) . This is going to be the easiest for the time being, but if we can find a mechanism to split types by Django version, we could backtrack on this decision.

Related Mypy issue: python/typing#693

@ngnpope investigated a possibility with literal numerical types: #1160 (comment) . If we could supply the literal numerical type for the Django version from the MYpy plugin, then perhaps Mypy could use the type of that for conditions in stub files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions