## Objective The objective of the `python_install` job is to provide a Python environment with all requirements installed for CI jobs. This reusable job can help speed up other jobs creation and ensure consistent configuration across CI jobs that rely on a python environment. ## How to use it 1. Include the pytest template in your CI/CD configuration (see quick use above). 2. Create a job that extend the `python_install` job template. 3. If you need to customize the job, check the [jobs customization](https://docs.r2devops.io/get-started/use-templates/#job-templates-customization). ## Variables | Name | Description | Default | |---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------| | `PROJECT_PATH` | The path to the project root directory. | `"."` | | `REQUIREMENTS_FILE` | the path to the requirements file. | `"${PROJECT_PATH}/requirements.txt"` | | `IMAGE_TAG` | The default tag for the docker image. See [Python Docker Official Image](https://hub.docker.com/_/python) for supported tags and respective Dockerfile links | `"latest"` | | `PYTHON_SETUP` | Bash commands to setup your python environment. Default rely on `requirements.txt` to install all dependencies. | `"pip install -r ${PROJECT_PATH}/requirements.txt"` | ## Example of use ```yaml include: # Include the python_install job template (don't forget to replace the version tag) - remote: 'https://api.r2devops.io/job/r/gitlab/dorianturba/r2devops_catalog/python_install@1.0.0.yaml' flake8: extends: - .python_install # extends the python_install job template stage: code_quality variables: PYTHON_SETUP: "pip install flake8" # override the default PYTHON_SETUP variable script: - !reference [.python_install, script] # reuse the script from the python_install job template - flake8 ${PROJECT_PATH} -v ```