GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Avoid placeholders in virtual dep aliases by delfick · Pull Request #74 · delfick/extended-mypy-django-plugin

Conversation

@delfick

@delfick delfick commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Owner

With the update to mypy 2.2 we found a new problem where the way mypy resolves placeholder types in TypeVars was conflicting with the way the virtual dependency aliases worked.

I thought I was stuck, but I found a solution!

When this plugin was made I wasn't able to use the type keyword, but now I can and it appears because the type keyword makes something that only exists at static time I can use it to create my aliases and then import the modules they depend on after they are defined.

It appears this is enough to remove the recursive nature of how these aliases currently work (because the aliases need to be defined before they are referenced sometimes)

Note that this change is incompatible with mypy before 2.2 and django-stubs before 6.0.5 and so this package has those versions as a new floor


AI Disclosure: NONE: I actively avoid LLMs: No LLM or any other machine learning technique or product was used during the ideation, creation or description of this change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@delfick
delfick force-pushed the lazier-virtual-dep-aliases branch 2 times, most recently from 1c7e1c6 to efceb18 Compare July 10, 2026 23:55
@delfick
Avoid placeholders in virtual dep aliases
d1b85f3
With the update to mypy 2.2 we found a new problem where the way mypy
resolves placeholder types in TypeVars was conflicting with the way the
virtual dependency aliases worked.

I thought I was stuck, but I found a solution!

When this plugin was made I wasn't able to use the `type` keyword, but
now I can and it appears because the type keyword makes something that
only exists at static time I can use it to create my aliases and then
import the modules they depend on after they are defined.

It appears this is enough to remove the recursive nature of how these
aliases currently work (because the aliases need to be defined before
they are referenced sometimes)

Note that this change is incompatible with mypy before 2.2 and
django-stubs before 6.0.5 and so this package has those versions as a
new floor
@delfick
delfick force-pushed the lazier-virtual-dep-aliases branch from efceb18 to d1b85f3 Compare July 11, 2026 00:22
allanlewis
allanlewis approved these changes Jul 14, 2026
View reviewed changes
@delfick
delfick merged commit fbdd6b2 into main Jul 14, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@delfick delfick mentioned this pull request Jul 14, 2026
2.2 Regression with placeholder types in a TypeVar python/mypy#21640
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@allanlewis allanlewis allanlewis approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@delfick @allanlewis
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.