Skip to content
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

MAINT: add __pycache__/ to .gitignore #26578

Merged
merged 1 commit into from Aug 23, 2023
Merged

Conversation

story645
Copy link
Member

Folder isn't in .gitignore and our docs recommend git commit -a and I think this may be the cause of some really messy commit trees :/

@ksunden
Copy link
Member

ksunden commented Aug 23, 2023

Unclear to me why this would be needed, git tracks files, not folders, and all of the files that get put in __pycache__ folders should be excluded by the *.py[ocd] rule on line 27

If we do include __pycache__ as an explicit exclude, I don't think it should be scoped to lib/matplotlib/tests

Do you have an example of a file that gets placed in __pycache__ that is not already excluded? If there is something new in there, I think we should exclude that rather than __pycache__

@story645 story645 changed the title MAINT: added lib/matplotlib/tests/__pycache__/ to .gitignore MAINT: add __pycache__/ to .gitignore Aug 23, 2023
@story645
Copy link
Member Author

Mostly wanted it cause this threw me for a loop:
image

None of the files in there get committed, but it's a bit confusing. Changed to the general form.

@ksunden
Copy link
Member

ksunden commented Aug 23, 2023

What are the contents of that folder?

usually its all .pyc files, and I'm pretty sure git usually will not show that if that is the case (if it did, it would show that all the time)... it does abbreviate to folder in git status when there are multiple untracked files in there, though

@story645
Copy link
Member Author

What are the contents of that folder?

.pyc files and WindowsPath('lib/matplotlib/tests/__pycache__/test_axes.cpython-311-pytest-7.4.0.pyc.10632')

@QuLogic
Copy link
Member

QuLogic commented Aug 23, 2023

.pyc files and WindowsPath('lib/matplotlib/tests/__pycache__/test_axes.cpython-311-pytest-7.4.0.pyc.10632')

I can confirm some of these files existing on Windows, though only for pytest 7.4.0. There is also a pytest 7.3.2 file but without the pid at the end. It looks like they write that and replace the pid-less filename. I'm not sure why that never seems to be a problem on Linux.

Perhaps something to do with pytest-dev/pytest@4cd0322 or that Windows can't delete open files (i.e., if you're running with xdist.)

@timhoffm
Copy link
Member

timhoffm commented Aug 23, 2023

I don’t see any reason to not ignore this folder, explicitly. By construction we don’t want this in the repository. And if, for some reason, there will be other file types in the future it’s better to explicitly ignore the folder, rather than relying on ignoring its content.

@timhoffm timhoffm added this to the v3.8.0 milestone Aug 23, 2023
@timhoffm timhoffm merged commit 43bc6b5 into matplotlib:main Aug 23, 2023
37 of 39 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 23, 2023
@story645 story645 deleted the git-ignore branch August 23, 2023 20:57
QuLogic added a commit that referenced this pull request Aug 23, 2023
…578-on-v3.8.x

Backport PR #26578 on branch v3.8.x (MAINT: add __pycache__/ to .gitignore)
@ksunden ksunden mentioned this pull request Sep 15, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants