Skip to content

Version 0.600 disallows per module configuration globs like mypy-project.apps.*.migrations.* #5014

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

Closed
pwilczynskiclearcode opened this issue May 8, 2018 · 9 comments

Comments

@pwilczynskiclearcode
Copy link

pwilczynskiclearcode commented May 8, 2018

I have a Django project with many apps and I want to disable mypy in all of migrations modules of each app. Up to 0.590 it was possible and since 0.600 this feature seems to be dropped.

This is my mypy.ini config:

[mypy-project.apps.*.migrations.*]
ignore_errors=True
@emmatyping
Copy link
Member

emmatyping commented May 8, 2018

The semantics of the config file changed in #4894 (which made it into the 0.600 release). It may be possible to relax the rules to allow wildcards within a pattern, but @msullivan would know more. Edit: I don't think this is a bug per se, so I'm labeling it a question for now.

@emmatyping emmatyping changed the title Bug: Version 0.600 disallows per module configuration globs like mypy-project.apps.*.migrations.* Version 0.600 disallows per module configuration globs like mypy-project.apps.*.migrations.* May 8, 2018
@gvanrossum
Copy link
Member

gvanrossum commented May 8, 2018 via email

@emmatyping
Copy link
Member

Hm, I'm wondering if we should roll back this limitation somehow. It's an edge case but it seems there are some real-world patterns that benefit.

It can be relaxed, as glob can handle a wildcard in the middle of a pattern. Currently there is a check:
'*' in glob and (not glob.endswith('.*') or '*' in glob[:-2]), which prohibits the pattern given. I don't see why this limitation is needed.

@gvanrossum
Copy link
Member

IIUC @msullivan discovered that a mypy.ini with many entries caused a big slowdown (due to something O(N**2) I'm sure) and fixed it using better caching in #4894, but the cache only supports * in the final component, or something.

@ncvc
Copy link

ncvc commented May 24, 2018

I think this will be a problem for many projects, Django especially. In our Django project, we currently ignore all errors in admin files since admin action attributes cause errors (project.*.admin), as well as all migration files since they're typically auto-generated (project.*.migrations.*). We also allow untyped function defs in test files since all our test functions don't return anything, so the annotations aren't useful (project.*.tests.*).

Would love to see support for these types of use-cases!

@gvanrossum
Copy link
Member

@msullivan It looks like we really need to fix this.

@msullivan
Copy link
Collaborator

Approximately how many packages do you have that those match, @nevc?

@ncvc
Copy link

ncvc commented May 24, 2018

@msullivan We currently have 22 Django apps and are adding more pretty quickly, call it ~1 per month currently - both for feature work and splitting some of our existing bloated apps. We could add each app to our setup.cfg, but it makes adding apps more tedious and would reduce readability of the config.

@msullivan
Copy link
Collaborator

I'll have a fix up soon to get it into 0.610

msullivan added a commit that referenced this issue May 29, 2018
This is to support Django-style usecases with patterns like
`site.*.migrations.*`.

The implementation works by mixing in the old-style glob matching with
the new structured matching.

Fixes #5014.
msullivan added a commit that referenced this issue May 29, 2018
This is to support Django-style usecases with patterns like
`site.*.migrations.*`.

The implementation works by mixing in the old-style glob matching with
the new structured matching.

Fixes #5014.
msullivan added a commit that referenced this issue May 30, 2018
This is to support Django-style usecases with patterns like
`site.*.migrations.*`.

The implementation works by mixing in the old-style glob matching with
the new structured matching.

Fixes #5014.
msullivan added a commit that referenced this issue May 30, 2018
This is to support Django-style usecases with patterns like
`site.*.migrations.*`.

The implementation works by mixing in the old-style glob matching with
the new structured matching.

Fixes #5014.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants