Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
README.md 2.37 KiB
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"` |
```yml
  - remote: 'https://api.r2devops.io/job/r/gitlab/dorianturba/r2devops_catalog/python_install@1.0.0.yaml'
flake8:
    extend: python_install
    stage: code_quality
        PROJECT_PATH: "."
        IMAGE_TAG: "3.10"
        PYTHON_SETUP: "pip install ${PROJECT_PATH}[CODE_QUALITY]"
    script:
        python_install
        - flake8 ${PROJECT_PATH} -v