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

Add __pycache__ to gitignore #114056

Merged
merged 1 commit into from
May 18, 2024
Merged

Conversation

autinerd
Copy link
Contributor

Proposed change

This adds the __pycache__ folders to the .gitignore. Currently, the *.pyc files are in the gitignore, but the __pycache__ can contain other files, so this adds the whole __pycache__ folders.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed code-quality small-pr PRs with less than 30 lines. labels Mar 23, 2024
@davet2001
Copy link
Contributor

Thanks @autinerd!

I'm curious as to how this came up and why no-one else has needed it yet.

Either way I don't see it causing a problem.

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

edit: lost my copy-paste buffer :( Will write my review comment again below (need to rewrite it).

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft March 23, 2024 09:57
@frenck
Copy link
Member

frenck commented Mar 23, 2024

So, __pycache__ is solely meant for storing compiled bytecode (the famous *.pyc files).

However, those files are already ignored/excluded. Thus you'll end up with an empty folder. As git only tracks files and not folders, it means there is nothing to track.

Excluding __pycache__ seems thus an odd move, especially considering there hasn't been a known occurrence in all those years, nor do we ignore it like this in our projects I've quickly checked on all systems I can access, but haven't found any other occurrence.

You wrote:

can contain other files

Which ones? And when did this change?
Could you add some context to this?

../Frenck

@frenck frenck force-pushed the pycache_gitignore branch from 7e4aad1 to 1342826 Compare May 17, 2024 17:01
@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label May 17, 2024
@MatthewFlamm
Copy link
Contributor

MatthewFlamm commented May 17, 2024

Here is an example of a file not caught by current .gitignore settings: 44f713d

Edit: this was in PR #115857, but caught be the reviewer thankfully.

@frenck
Copy link
Member

frenck commented May 18, 2024

Checked with @autinerd on Discord:

I experimented with pylyzer and erg, and they put their cache files into pycache

That is what I was looking for, thanks! 👍

../Frenck

@frenck frenck marked this pull request as ready for review May 18, 2024 09:53
@frenck frenck requested a review from a team as a code owner May 18, 2024 09:53
@home-assistant home-assistant bot requested a review from frenck May 18, 2024 09:53
@frenck frenck force-pushed the pycache_gitignore branch from 1342826 to 4825ebd Compare May 18, 2024 09:54
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @autinerd 👍

../Frenck

@frenck frenck merged commit 54ba393 into home-assistant:dev May 18, 2024
38 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed code-quality small-pr PRs with less than 30 lines. smash Indicator this PR is close to finish for merging or closing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants