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

Use an external directory for container python cache #817

Merged
merged 1 commit into from
Feb 12, 2025
Merged

Conversation

tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Feb 11, 2025

With this set, the pyc files are created in a mirror directory instead
of the source tree. When running in a shared directory (as is the case
for the scratch area used by bluapi), this prevents files being created
with permissions that prevent other users removing them.

See python docs at
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX

Fixes #812

Instructions to reviewer on how to test:

  1. Deploy and run on p46 with new scratch area
  2. Check that there are no __pycache__ directories created in the scratch area

Checks for reviewer

  • Would the PR title make sense to a user on a set of release notes

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.46%. Comparing base (dc2015e) to head (b6f60a8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #817   +/-   ##
=======================================
  Coverage   93.46%   93.46%           
=======================================
  Files          38       38           
  Lines        2111     2111           
=======================================
  Hits         1973     1973           
  Misses        138      138           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ZohebShaikh ZohebShaikh left a comment

Choose a reason for hiding this comment

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

LGTM!

@callumforrester
Copy link
Contributor

@tpoliaw did you find anything that worked for _version.py?

@tpoliaw
Copy link
Contributor Author

tpoliaw commented Feb 12, 2025

@tpoliaw did you find anything that worked for _version.py?

Yes, installing blueapi manually in the virtualenv with pip sorted it. It's just that uv didn't seem to run whatever was needed when it created the venv.

Either way, I think it is unrelated to this PR.

Copy link
Contributor

@DiamondJoseph DiamondJoseph left a comment

Choose a reason for hiding this comment

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

👍

With this set, the pyc files are created in a mirror directory instead
of the source tree. When running in a shared directory (as is the case
for the scratch area used by bluapi), this prevents files being created
with permissions that prevent other users removing them.

See python docs at
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX
@tpoliaw tpoliaw merged commit a96e16e into main Feb 12, 2025
31 checks passed
@tpoliaw tpoliaw deleted the external_cache branch February 12, 2025 14:35
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.

Files Not Created with Correct Permissions and Cannot Be Deleted in scratch area
4 participants