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

Set PYTHONPYCACHEPREFIX to /tmp during build phase. #442

Merged
merged 2 commits into from
Oct 25, 2022

Commits on Oct 25, 2022

  1. Set PYTHONPYCACHEPREFIX to /tmp during build phase.

    - This enables reproducible builds by discarding the `__pycache__` directories
      (instead of the current behavior of persisting them in the cpython layer).
    - The `__pycache__` directories are not reproducible and are effectively opaque
      to us. We cannot make them reproducible, so discarding them is the only
      option for reproducible builds.
    - The PYTHONPYCACHEPREFIX environment variable was chosen to allow users to
      override it if needed, whereas setting PYTHONDONTWRITEBYTECODE=true would
      have been harder, if not impossible, to allow users to override.
    - Setting this environment variable as a build environment on the layer
      (v.s. e.g. in process via os.SetEnv()) means all subsequent buildpacks (e.g.
      pip, poetry, etc) will have this environment variable set automatically by
      the lifecycle.
    - We only set this environment variable for the build phase (and not the launch
      phase) to allow users to continue to leverage `__pycache__` directories at
      launch time if they wish. The current launch-time behavior of defaulting to
      $HOME/.pycache is unchanged.
    - Also update the README to include this new feature and various other minor
      README improvements.
    robdimsdale committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    326d8a1 View commit details
    Browse the repository at this point in the history
  2. Reorder README.

    robdimsdale committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    2acc133 View commit details
    Browse the repository at this point in the history