Newer
Older
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.
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"` |
# 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'
extends:
- .python_install # extends the python_install job template
PYTHON_SETUP: "pip install flake8" # override the default PYTHON_SETUP variable
- !reference [.python_install, script] # reuse the script from the python_install job template