### Checking Python Version Files Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Example of how to verify the installed Python version by checking the version file within the package directory. ```bash # Check which version to use by examining the version file # packages/python-3.12/version contains: 3.12.13 # packages/python-3.11/version contains: 3.11.15 # packages/python-3.10/version contains: 3.10.20 ``` -------------------------------- ### Install Packages from Local Dependencies Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Use `bosh_pip_local` in your packaging script to install Python packages from vendored tarballs stored locally in the `deps/` directory. This avoids network access during compilation. ```bash # In your packaging script with offline/local dependencies source /var/vcap/packages/python-3.12/bosh/compile.env # Install packages from local deps directory (no network access) # Packages should be placed in deps/ directory as .tar.gz files bosh_pip_local requests flask # Generate runtime environment bosh_generate_runtime_env ``` -------------------------------- ### Using Compile Environment Helper Functions Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Helper functions for installing Python packages and generating runtime environment files during BOSH compilation. ```bash #!/bin/bash -eu source /var/vcap/packages/python-3.12/bosh/compile.env # bosh_pip - Install from PyPI # Installs packages with --prefix set to BOSH_INSTALL_TARGET bosh_pip numpy pandas scikit-learn # bosh_pip_local - Install from local files # Looks for packages in ./deps directory, no network access # Place wheel/tarball files in deps/ folder of your package bosh_pip_local my-internal-package # bosh_generate_runtime_env - Create runtime.env # Generates runtime.env in BOSH_INSTALL_TARGET/bosh/ # Sets PATH and PYTHONPATH for your installed packages bosh_generate_runtime_env ``` -------------------------------- ### Configure compilation environment Source: https://github.com/cloudfoundry/bosh-package-python-release/blob/main/README.md Source the compile.env file in your packaging script to enable the Python environment for pip installations. ```bash #!/bin/bash -eu source /var/vcap/packages/python-2.7/bosh/compile.env pip install ... ``` -------------------------------- ### Environment Variables Reference Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Environment files export PATH and PYTHONPATH to ensure Python and installed packages are accessible. The compile environment includes additional helper functions. ```bash # Runtime environment (/var/vcap/packages/python-3.12/bosh/runtime.env) export PATH=/var/vcap/packages/python-3.12/bin:$PATH export PYTHONPATH=/var/vcap/packages/python-3.12/lib/python3.12/site-packages:$PYTHONPATH # Compile environment includes additional helpers: # -bosh_pip: Install packages from PyPI # -bosh_pip_local: Install packages from local deps directory # -bosh_generate_runtime_env: Generate runtime.env for your package ``` -------------------------------- ### Source Compile Environment in Packaging Script Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Source the Python compile environment in your packaging script to set up PATH, PYTHONPATH, and access helper functions for installing Python packages during BOSH package compilation. ```bash # In your packaging script (packages/my-package/packaging) # Source the Python compile environment source /var/vcap/packages/python-3.12/bosh/compile.env # Install packages from PyPI using bosh_pip helper bosh_pip requests flask gunicorn # Install specific versions bosh_pip "requests==2.31.0" "flask>=2.0,<3.0" # Generate runtime.env for your package bosh_generate_runtime_env ``` -------------------------------- ### Deploy Test Manifest Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt The deployment manifest defines instance groups that run Python test jobs. It demonstrates referencing the Python release and packages within the `instance_groups` configuration. ```yaml --- name: my-deployment releases: - name: python version: latest - name: my-release version: latest stemcells: - alias: default os: ubuntu-noble version: latest update: canaries: 1 max_in_flight: 1 canary_watch_time: 5000-60000 update_watch_time: 5000-60000 instance_groups: - name: python-app azs: [z1] instances: 1 jobs: - name: my-python-job release: my-release properties: my_python_job: port: 8080 vm_type: default stemcell: default networks: - name: default ``` -------------------------------- ### Vendor Python package Source: https://github.com/cloudfoundry/bosh-package-python-release/blob/main/README.md Use this command to vendor a specific Python package version into your BOSH release. ```bash $ bosh vendor-package python-2.7 ~/workspace/bosh-packages/python-release ``` -------------------------------- ### Create Job Spec Using Python Package Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Define your job configuration in `jobs/my-python-job/spec`, including required packages like `python-3.12` and `my-python-app`, and specify template files. ```yaml --- # jobs/my-python-job/spec name: my-python-job templates: run.erb: bin/run config.yml.erb: config/config.yml packages: - python-3.12 - my-python-app properties: my_python_job.port: description: "Port to listen on" default: 8080 ``` -------------------------------- ### Vendor Python Package into Release Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Use `bosh vendor-package` to copy the desired Python version into your BOSH release. This makes it available for compilation and runtime. ```bash bosh vendor-package python-3.12 ~/workspace/bosh-packages/python-release ``` ```bash bosh vendor-package python-3.11 ~/workspace/bosh-packages/python-release ``` ```bash bosh vendor-package python-3.10 ~/workspace/bosh-packages/python-release ``` -------------------------------- ### Source Runtime Environment in Job Templates Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Source the Python runtime environment in your job template to configure PATH and PYTHONPATH for running Python applications. Ensure your application's runtime environment is also sourced. ```bash # In your job template (jobs/my-job/templates/run.erb) # Source the Python runtime environment source /var/vcap/packages/python-3.12/bosh/runtime.env # Source your application's runtime environment source /var/vcap/packages/my-python-app/bosh/runtime.env # Run your Python application exec python3 /var/vcap/packages/my-python-app/app.py ``` -------------------------------- ### Define Package Spec with Python Dependency Source: https://context7.com/cloudfoundry/bosh-package-python-release/llms.txt Declare a dependency on a Python package in your `packages/my-python-app/spec` file. This ensures the Python package is compiled and available before your package. ```yaml --- # packages/my-python-app/spec name: my-python-app dependencies: - python-3.12 files: - my-python-app/**/* ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.