Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CI/Python

This project contains GitLab CI templates and components that we can use in GitLab CI pipelines of Python projects.

[TOC]

Components

build-wheel

Component that builds a wheel and tarball for the given project (it runs python3 -m build) using the provided python-version. In addition, the component checks that the wheel does not contain the tests/ directory, and that the files with the files-not-in-dist regex pattern are not present either in the produced wheel or tarball.

Example:

include:
  - component: "gitlab.desy.de/fs-sc/ci/python/build-wheel@main"
    inputs:
      python-version: "3.10"
      files-not-in-dist: "(cspell|etc/|templates/)"

pre-commit

Component that runs pre-commit using the provided python-versions. You can install packages before pre-commit runs by providing install-commands a list of commands to execute. Typical install commands are python3 -m pip install <package> and apt-get install <package>.

Example:

include:
  - component: "gitlab.desy.de/fs-sc/ci/python/pre-commit@main"
    inputs:
      python-versions: ["3.10"]
      install-commands:
        - apt-get install -y --no-install-recommends libatomic1
        - python3 -m pip install mypy

publish-wheel

Component that publishes the wheel and tarball produced by the build-wheel component to PyPI by running the twine upload command with the provided python-version and twine-options, the default provided twine-options being --password "$PYPI_API_TOKEN" --skip-existing. The component only runs for Git tags.

Example:

include:
  - component: "gitlab.desy.de/fs-sc/ci/python/publish-wheel@main"
    inputs:
      python-version: "3.10"
      # Assuming that you already defined PYPI_API_TOKEN:
      twine-options: --password "$PYPI_API_TOKEN" --skip-existing

pytest, pytest-tarball, pytest-wheel, pytest-with-coverage

The pytest component runs pytest using the provided python-versions and pytest-options. You can install packages before pytest runs by providing install-commands a list of commands to execute. Typical install commands are python3 -m pip install <package> and apt-get install <package>. You can also provide the CI job with services that will run Docker containers accessible from the tests.

Example:

include:
  - component: "gitlab.desy.de/fs-sc/ci/python/pytest@main"
    inputs:
      python-versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
      install-commands:
        - python3 -m pip install "${CI_PROJECT_DIR}[asapo,tests,zmq]"
      pytest-options: "-vv --log-cli-level=DEBUG"
      services:
        - name: gitlab.desy.de:5555/asapo/asapo/asapo-standalone-dev:latest

Similarly, the components pytest-tarball and pytest-wheel runs pytest respectively on the tarball and wheel produced by the build-wheel component.

The component pytest-with-coverage runs pytest with coverage and produces a JUnit XML test report. This component accepts a single python-version instead of several python-versions for the other components.

To avoid repeating the code between the includes of these components, we can extract a YAML anchor. For example:

.common_test_inputs: &common_test_inputs
  install-commands:
    - python3 -m pip install "${PACKAGE}[asapo,tests,zmq]"
  pytest-options: "-vv --log-cli-level=DEBUG"
  services:
    - name: gitlab.desy.de:5555/asapo/asapo/asapo-standalone-dev:latest

include:
  - component: "gitlab.desy.de/fs-sc/ci/python/build-wheel@main"
  - component: "gitlab.desy.de/fs-sc/ci/python/pytest@main"
    inputs:
      <<: *common_test_inputs
      python-versions: ["3.9"]
  - component: "gitlab.desy.de/fs-sc/ci/python/pytest-with-coverage@main"
    inputs:
      <<: *common_test_inputs
      python-version: "3.9"
  - component: "gitlab.desy.de/fs-sc/ci/python/pytest-wheel@main"
    inputs:
      <<: *common_test_inputs
      python-versions: ["3.9", "3.10", "3.11", "3.12"]
  - component: "gitlab.desy.de/fs-sc/ci/python/pytest-tarball@main"
    inputs:
      <<: *common_test_inputs
      python-versions: ["3.9"]

Templates

templates/workflows/branch-pipelines.yml

You can use the branch-pipelines workflow template to allow CI pipelines to run only on branches and tags with the format v<PEP 440 version>, see PEP_440_VERSION_REGEX.

Usage example:

include:
  - project: "fs-sc/ci/python"
    ref: "main"
    file:
      - "templates/workflows/branch-pipelines.yml"

Metadata

Release files for desy-fssc-ci-python 0.1.0a4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for desy-fssc-ci-python 0.1.0a4
File Size Uploaded Provenance Actions
desy_fssc_ci_python-0.1.0a4.tar.gz 7.1 kB Without provenance Details for desy_fssc_ci_python-0.1.0a4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for desy-fssc-ci-python 0.1.0a4
File Interpreter ABI Platform Actions
desy_fssc_ci_python-0.1.0a4-py3-none-any.whl Python 3 none any Details for desy_fssc_ci_python-0.1.0a4-py3-none-any.whl

Total release size: 11.5 kB

Release files / desy_fssc_ci_python-0.1.0a4.tar.gz

Download URL desy_fssc_ci_python-0.1.0a4.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9006bde7d31368d033bb4eab4fd3906d90c37bef491fc34fbce2f4f8455ca8ce
BLAKE2b-256 checksum
How to use checksums
922df3784baff4412d7069f2f4cbfa2fa980bc9478a051fe49650b4ca9b22f8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / desy_fssc_ci_python-0.1.0a4-py3-none-any.whl

Download URL desy_fssc_ci_python-0.1.0a4-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fb1e499020abc49731bf40e87148bdc1881b6607c9746807f2f309b3d95ca70
BLAKE2b-256 checksum
How to use checksums
460821a5f24c491912665d9dad149bea0fc87dbb894aeeb9da01c14ddad7be9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for desy-fssc-ci-python 0.1.0a4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page