Loading README.md +2 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ and/or `setup.py` and/or `requirements.txt`), but the build system might also be | `poetry` | [](https://python-poetry.org/)  | | `uv` | [](https://docs.astral.sh/uv/)  | | `hatch` | [](https://hatch.pypa.io/latest/)  | | `pdm` | [](https://pdm-project.org)  | `pipenv` | [](https://pipenv.pypa.io/)  | | `reqfile` | [](https://pip.pypa.io/en/stable/user_guide/#requirements-files)  | Loading Loading @@ -153,7 +154,7 @@ In addition to a textual report in the console, this job produces the following | Report | Format | Usage | | -------------- | ---------------------------------------------------------------------------- | ----------------- | | `$PYTHON_PROJECT_DIR/reports/py-lint.codeclimate.json` | [Code Climate](https://docs.codeclimate.com/docs/pylint) | [GitLab integration](https://docs.gitlab.com/ci/yaml/artifacts_reports/#artifactsreportscodequality) | | `$PYTHON_PROJECT_DIR/reports/py-lint.codeclimate.json` | [Code Climate](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types) | [GitLab integration](https://docs.gitlab.com/ci/yaml/artifacts_reports/#artifactsreportscodequality) | | `$PYTHON_PROJECT_DIR/reports/py-lint.parseable.txt` | [parseable](https://pylint.pycqa.org/en/latest/user_guide/usage/output.html) | [SonarQube integration](https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/importing-external-issues/external-analyzer-reports/) | ### Test jobs Loading kicker.json +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ "name": "PYTHON_BUILD_SYSTEM", "description": "Python build-system to use to install dependencies, build and package the project", "type": "enum", "values": ["auto", "setuptools", "poetry", "pipenv", "reqfile", "uv", "hatch"], "values": ["auto", "setuptools", "poetry", "pipenv", "reqfile", "uv", "hatch", "pdm"], "default": "auto", "advanced": true }, Loading templates/gitlab-ci-python.yml +52 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ spec: - reqfile - uv - hatch - pdm default: auto reqs-file: description: |- Loading Loading @@ -640,7 +641,7 @@ variables: case "${PYTHON_BUILD_SYSTEM:-auto}" in auto) ;; poetry*|setuptools*|pipenv*|uv*|hatch*) poetry*|setuptools*|pipenv*|uv*|hatch*|pdm*) export PYTHON_BUILD_SYSTEM_CMD="${PYTHON_BUILD_SYSTEM%%[=<>]*}" log_info "--- Build system explicitly declared: ${PYTHON_BUILD_SYSTEM} cmd=\\e[33m$PYTHON_BUILD_SYSTEM_CMD\\e[0m" return Loading Loading @@ -699,6 +700,12 @@ variables: export PYTHON_BUILD_SYSTEM="setuptools" return ;; pdm.backend) log_info "--- Build system auto-detected: PEP 517 with PDM backend" export PYTHON_BUILD_SYSTEM="pdm" export PYTHON_BUILD_SYSTEM_CMD="pdm" return ;; *) log_error "--- Build system auto-detected: PEP 517 with unsupported backend \\e[33;1m${build_backend}\\e[0m: please read template doc" exit 1 Loading Loading @@ -784,6 +791,10 @@ variables: maybe_install_build_system hatch env create ;; pdm*) maybe_install_build_system pdm sync --dev ${PYTHON_EXTRA_DEPS:+--extra "$PYTHON_EXTRA_DEPS"} ;; esac log_elapsed_time "install_requirements" "$_start_time" Loading @@ -791,7 +802,7 @@ variables: function _run() { case "$PYTHON_BUILD_SYSTEM" in poetry*|uv*|hatch*) poetry*|uv*|hatch*|pdm*) maybe_install_build_system $PYTHON_BUILD_SYSTEM_CMD run "$@" ;; Loading Loading @@ -837,6 +848,11 @@ variables: log_info "--- build packages (hatch)..." $PYTHON_BUILD_SYSTEM_CMD build ;; pdm*) maybe_install_build_system log_info "--- build packages (pdm)..." pdm build ${TRACE+--verbose} ;; *) log_info "--- build packages ..." # shellcheck disable=SC2086 Loading Loading @@ -974,6 +990,23 @@ variables: hatch version "$py_next_version" fi py_git_tag_commit_release_change "$py_cur_version" "$py_next_version" elif [[ "$PYTHON_BUILD_SYSTEM" =~ ^pdm ]] then maybe_install_build_system if [[ -z "$py_next_version" ]] then py_cur_version=$(pdm show --version) log_info "[pdm version] increase \\e[1;94m${PYTHON_RELEASE_NEXT}\\e[0m (from current \\e[1;94m${py_cur_version}\\e[0m)" pdm self add pdm-bump pdm bump ${TRACE+--verbose} "$PYTHON_RELEASE_NEXT" py_next_version=$(pdm show --version) else log_info "[pdm] change version \\e[1;94m${py_cur_version}\\e[0m → \\e[1;94m${py_next_version}\\e[0m" pdm self add pdm-bump pdm bump ${TRACE+--verbose} "$py_next_version" fi py_git_tag_commit_release_change "$py_cur_version" "$py_next_version" else # Setuptools / bump-my-version Loading Loading @@ -1046,6 +1079,12 @@ variables: log_info "--- publish packages (hatch) to $PYTHON_REPOSITORY_URL with user $PYTHON_REPOSITORY_USERNAME..." hatch publish ${TRACE+--verbose} --no-prompt --yes --user "$PYTHON_REPOSITORY_USERNAME" --auth "$PYTHON_REPOSITORY_PASSWORD" --repo "$PYTHON_REPOSITORY_URL" elif [[ "$PYTHON_BUILD_SYSTEM" =~ ^pdm ]] then maybe_install_build_system log_info "--- publish packages (pdm) to $PYTHON_REPOSITORY_URL with user $PYTHON_REPOSITORY_USERNAME..." pdm publish ${TRACE+--verbose} --username "$PYTHON_REPOSITORY_USERNAME" --password "$PYTHON_REPOSITORY_PASSWORD" --repository "$PYTHON_REPOSITORY_URL" else # shellcheck disable=SC2086 pip install ${PIP_OPTS} build twine Loading Loading @@ -1104,6 +1143,7 @@ stages: UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv" HATCH_CACHE_DIR: "$CI_PROJECT_DIR/.cache/hatch/.cache/" HATCH_DATA_DIR: "$CI_PROJECT_DIR/.cache/hatch/.local" PDM_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pdm" POETRY_VIRTUALENVS_IN_PROJECT: "false" cache: key: "$CI_COMMIT_REF_SLUG-python" Loading Loading @@ -1435,6 +1475,11 @@ py-trivy: maybe_install_build_system hatch run python -m pip freeze > reports/requirements.txt # hatch dep show requirements not working and complete ;; pdm*) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt\\e[0m)" maybe_install_build_system pdm export --format requirements > reports/requirements.txt ;; *) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt\\e[0m)" install_requirements Loading Loading @@ -1499,6 +1544,11 @@ py-sbom: maybe_install_build_system hatch run python -m pip freeze > reports/requirements.txt # hatch dep show requirements not working and complete ;; pdm*) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt from pdm.lock\\e[0m)" maybe_install_build_system pdm export --format requirements > reports/requirements.txt ;; *) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt\\e[0m)" install_requirements Loading Loading
README.md +2 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ and/or `setup.py` and/or `requirements.txt`), but the build system might also be | `poetry` | [](https://python-poetry.org/)  | | `uv` | [](https://docs.astral.sh/uv/)  | | `hatch` | [](https://hatch.pypa.io/latest/)  | | `pdm` | [](https://pdm-project.org)  | `pipenv` | [](https://pipenv.pypa.io/)  | | `reqfile` | [](https://pip.pypa.io/en/stable/user_guide/#requirements-files)  | Loading Loading @@ -153,7 +154,7 @@ In addition to a textual report in the console, this job produces the following | Report | Format | Usage | | -------------- | ---------------------------------------------------------------------------- | ----------------- | | `$PYTHON_PROJECT_DIR/reports/py-lint.codeclimate.json` | [Code Climate](https://docs.codeclimate.com/docs/pylint) | [GitLab integration](https://docs.gitlab.com/ci/yaml/artifacts_reports/#artifactsreportscodequality) | | `$PYTHON_PROJECT_DIR/reports/py-lint.codeclimate.json` | [Code Climate](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types) | [GitLab integration](https://docs.gitlab.com/ci/yaml/artifacts_reports/#artifactsreportscodequality) | | `$PYTHON_PROJECT_DIR/reports/py-lint.parseable.txt` | [parseable](https://pylint.pycqa.org/en/latest/user_guide/usage/output.html) | [SonarQube integration](https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/importing-external-issues/external-analyzer-reports/) | ### Test jobs Loading
kicker.json +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ "name": "PYTHON_BUILD_SYSTEM", "description": "Python build-system to use to install dependencies, build and package the project", "type": "enum", "values": ["auto", "setuptools", "poetry", "pipenv", "reqfile", "uv", "hatch"], "values": ["auto", "setuptools", "poetry", "pipenv", "reqfile", "uv", "hatch", "pdm"], "default": "auto", "advanced": true }, Loading
templates/gitlab-ci-python.yml +52 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ spec: - reqfile - uv - hatch - pdm default: auto reqs-file: description: |- Loading Loading @@ -640,7 +641,7 @@ variables: case "${PYTHON_BUILD_SYSTEM:-auto}" in auto) ;; poetry*|setuptools*|pipenv*|uv*|hatch*) poetry*|setuptools*|pipenv*|uv*|hatch*|pdm*) export PYTHON_BUILD_SYSTEM_CMD="${PYTHON_BUILD_SYSTEM%%[=<>]*}" log_info "--- Build system explicitly declared: ${PYTHON_BUILD_SYSTEM} cmd=\\e[33m$PYTHON_BUILD_SYSTEM_CMD\\e[0m" return Loading Loading @@ -699,6 +700,12 @@ variables: export PYTHON_BUILD_SYSTEM="setuptools" return ;; pdm.backend) log_info "--- Build system auto-detected: PEP 517 with PDM backend" export PYTHON_BUILD_SYSTEM="pdm" export PYTHON_BUILD_SYSTEM_CMD="pdm" return ;; *) log_error "--- Build system auto-detected: PEP 517 with unsupported backend \\e[33;1m${build_backend}\\e[0m: please read template doc" exit 1 Loading Loading @@ -784,6 +791,10 @@ variables: maybe_install_build_system hatch env create ;; pdm*) maybe_install_build_system pdm sync --dev ${PYTHON_EXTRA_DEPS:+--extra "$PYTHON_EXTRA_DEPS"} ;; esac log_elapsed_time "install_requirements" "$_start_time" Loading @@ -791,7 +802,7 @@ variables: function _run() { case "$PYTHON_BUILD_SYSTEM" in poetry*|uv*|hatch*) poetry*|uv*|hatch*|pdm*) maybe_install_build_system $PYTHON_BUILD_SYSTEM_CMD run "$@" ;; Loading Loading @@ -837,6 +848,11 @@ variables: log_info "--- build packages (hatch)..." $PYTHON_BUILD_SYSTEM_CMD build ;; pdm*) maybe_install_build_system log_info "--- build packages (pdm)..." pdm build ${TRACE+--verbose} ;; *) log_info "--- build packages ..." # shellcheck disable=SC2086 Loading Loading @@ -974,6 +990,23 @@ variables: hatch version "$py_next_version" fi py_git_tag_commit_release_change "$py_cur_version" "$py_next_version" elif [[ "$PYTHON_BUILD_SYSTEM" =~ ^pdm ]] then maybe_install_build_system if [[ -z "$py_next_version" ]] then py_cur_version=$(pdm show --version) log_info "[pdm version] increase \\e[1;94m${PYTHON_RELEASE_NEXT}\\e[0m (from current \\e[1;94m${py_cur_version}\\e[0m)" pdm self add pdm-bump pdm bump ${TRACE+--verbose} "$PYTHON_RELEASE_NEXT" py_next_version=$(pdm show --version) else log_info "[pdm] change version \\e[1;94m${py_cur_version}\\e[0m → \\e[1;94m${py_next_version}\\e[0m" pdm self add pdm-bump pdm bump ${TRACE+--verbose} "$py_next_version" fi py_git_tag_commit_release_change "$py_cur_version" "$py_next_version" else # Setuptools / bump-my-version Loading Loading @@ -1046,6 +1079,12 @@ variables: log_info "--- publish packages (hatch) to $PYTHON_REPOSITORY_URL with user $PYTHON_REPOSITORY_USERNAME..." hatch publish ${TRACE+--verbose} --no-prompt --yes --user "$PYTHON_REPOSITORY_USERNAME" --auth "$PYTHON_REPOSITORY_PASSWORD" --repo "$PYTHON_REPOSITORY_URL" elif [[ "$PYTHON_BUILD_SYSTEM" =~ ^pdm ]] then maybe_install_build_system log_info "--- publish packages (pdm) to $PYTHON_REPOSITORY_URL with user $PYTHON_REPOSITORY_USERNAME..." pdm publish ${TRACE+--verbose} --username "$PYTHON_REPOSITORY_USERNAME" --password "$PYTHON_REPOSITORY_PASSWORD" --repository "$PYTHON_REPOSITORY_URL" else # shellcheck disable=SC2086 pip install ${PIP_OPTS} build twine Loading Loading @@ -1104,6 +1143,7 @@ stages: UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv" HATCH_CACHE_DIR: "$CI_PROJECT_DIR/.cache/hatch/.cache/" HATCH_DATA_DIR: "$CI_PROJECT_DIR/.cache/hatch/.local" PDM_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pdm" POETRY_VIRTUALENVS_IN_PROJECT: "false" cache: key: "$CI_COMMIT_REF_SLUG-python" Loading Loading @@ -1435,6 +1475,11 @@ py-trivy: maybe_install_build_system hatch run python -m pip freeze > reports/requirements.txt # hatch dep show requirements not working and complete ;; pdm*) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt\\e[0m)" maybe_install_build_system pdm export --format requirements > reports/requirements.txt ;; *) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt\\e[0m)" install_requirements Loading Loading @@ -1499,6 +1544,11 @@ py-sbom: maybe_install_build_system hatch run python -m pip freeze > reports/requirements.txt # hatch dep show requirements not working and complete ;; pdm*) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt from pdm.lock\\e[0m)" maybe_install_build_system pdm export --format requirements > reports/requirements.txt ;; *) log_info "$PYTHON_BUILD_SYSTEM build system used (\\e[32mmust generate pinned requirements.txt\\e[0m)" install_requirements Loading