Skip to content
Snippets Groups Projects
README.md 24.70 KiB

GitLab CI template for Python

This project implements a GitLab CI/CD template to build, test and analyse your Python projects.

Usage

In order to include this template in your project, add the following to your gitlab-ci.yml:

include:
  - project: 'to-be-continuous/python'
    ref: '6.1.3'
    file: '/templates/gitlab-ci-python.yml'

Global configuration

The Python template uses some global configuration used throughout all jobs.

Name description default value
PYTHON_IMAGE The Docker image used to run Python
⚠️ set the version required by your project
registry.hub.docker.com/library/python:3
PYTHON_PROJECT_DIR Python project root directory .
PYTHON_BUILD_SYSTEM Python build-system to use to install dependencies, build and package the project (see below) none (auto-detect)
PIP_INDEX_URL Python repository url none
PIP_EXTRA_INDEX_URL Exra Python repository url none
PIP_OPTS pip extra options none
PYTHON_EXTRA_DEPS Python extra sets of dependencies to install
For Setuptools or Poetry only
none
PYTHON_REQS_FILE Main requirements file (relative to $PYTHON_PROJECT_DIR)
For Requirements Files build-system only
requirements.txt
PYTHON_EXTRA_REQS_FILES Extra dev requirements file(s) to install (relative to $PYTHON_PROJECT_DIR) requirements-dev.txt

The cache policy also makes the necessary to manage pip cache (not to download Python dependencies over and over again).

Multi build-system support