Skip to content

Add an option to exclude everything in .gitignore #18696

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

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

ilevkivskyi
Copy link
Member

Fixes #12505

This is (somewhat surprisingly) one of the most upvoted issues, and looks like a simple thing to add. I essentially do what other tools do, but optimize for how we work with sources discovery (to avoid performance issues). I am making this opt-in for now, we can change this later if needed.

This comment has been minimized.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some edge cases this will not handle correctly, like nested gitignore where inner gitignore has a negated pattern. But this is pretty niche. I have a library that makes it easier to handle this stuff than pathspec (and is also faster), maybe I will open source

@ilevkivskyi
Copy link
Member Author

I think there are some edge cases this will not handle correctly, like nested gitignore where inner gitignore has a negated pattern.

This is very niche.

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

django-stubs (https://github.com/typeddjango/django-stubs): 1.90x faster (46.9s -> 24.6s in a single noisy sample)

Tanjun (https://github.com/FasterSpeeding/Tanjun): 1.60x slower (77.8s -> 124.7s in a single noisy sample)

@ilevkivskyi ilevkivskyi merged commit a26d8d0 into python:master Feb 19, 2025
19 checks passed
@ilevkivskyi ilevkivskyi deleted the exclude-gitignore branch February 19, 2025 00:02
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
Fixes python#12505

This is (somewhat surprisingly) one of the most upvoted issues, and
looks like a simple thing to add. I essentially do what other tools do,
but optimize for how we work with sources discovery (to avoid
performance issues). I am making this opt-in for now, we can change this
later if needed.
@scorphus
Copy link

Assuming I'm not missing anything, when are we expected to get this released? Thanks!

@brianschubert
Copy link
Collaborator

@scorphus I don’t think there’s a set timeline. For now you can watch the tracking issue for the next release for updates: #18739

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

Successfully merging this pull request may close these issues.

(🎁) A git/.gitignore exclude option
4 participants