A collection of Python modules and libraries for CI/CD pipelines in the jEAP context.
Project description
jEAP CI/CD Python Library Documentation
Welcome to the jEAP CI/CD Python library.
This project provides a collection of reusable Python modules designed to support and standardize CI/CD pipeline operations in the jEAP context.
For more details about the library, please refer to the modules documentation.
Local Development
Setup
-
Clone the repository:
git clone https://github.com/jeap-admin-ch/jeap-python-pipeline-lib.git cd jeap-python-pipeline-lib
-
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate
-
Install the dependencies:
pip install -r requirements.txt
-
Or to install just the tools use:
pip install build twine pip-licenses pytest
Development basics
-
Adding New Modules:
- Create a new Python file in the
src/jeap_pipeline/directory. - Ensure the new module has a corresponding test file in the
tests/directory. - Follow the naming conventions and structure of existing modules.
- Create a new Python file in the
-
Writing Documentation:
- Add docstrings to all public classes and functions.
- Update the
CHANGELOG.mdwith any new features or changes. - If necessary, add detailed documentation in the
docs/directory.
-
Changing the Version:
- Update the version number in the
pyproject.tomlfile. - Ensure the version number complies with semantic versioning and the PEP 440 standard.
- Update the version number in the
-
Add new dependencies:
- Add the dependency to the
requirements.txtfile. - Ensure the license of the dependency is compatible with the project's license.
- Keep the THIRD-PARTY-LICENSES.md file up to date.
- Add the dependency to the
Build
To combine the build with automated testing and the generation of the THIRD-PARTY-LICENSES.md file, run the following command:
python3 scripts/full_build.py
If you did like to execute single steps, you can use the following commands. A more comprehensive documentation can be found here: https://packaging.python.org/en/latest/tutorials/packaging-projects/
Install the build tool via pip. Make sure you have the latest version of PyPA’s build installed:
pip install build
To create the package run this command from the same directory where pyproject.toml is located:
python -m build
This command should generate two files in the dist directory. The tar.gz file is a source distribution whereas the .whl file is a built distribution.
Test
To run the tests, use the following command:
python3 -m pytest
Upload
It should be noted that the publishing process takes place automatically in the pipeline. The following steps are only necessary for manual publishing.
First install twine via pip:
python3 -m pip install --upgrade twine
Once installed, run Twine to upload all the archives under dist:
python3 -m twine upload --repository testpypi dist/*
Use testpypi to upload the package to test instance of PyPI. To upload to the real PyPI repository, use pypi instead of testpypi. You will be prompted for an API token. Use the token value, including the pypi- prefix.
Package installation
You can use pip to install your package and verify that it works. Create a virtual environment and install your package from TestPyPI:
python3 -m pip install -i https://test.pypi.org/simple/ jeap-pipeline==0.1.0
Check licenses of dependencies and generate THIRD-PARTY-LICENSES.md
To check the licenses of the dependencies and generate the THIRD-PARTY-LICENSES.md file, run the following command:
python3 scripts/check_licenses.py
Publishing
Versioning
The version can be set in the pyproject.toml file. The version number has to comply with semantic versioning and the PEP 440 standard. On every push a CI pipeline is triggered, which builds and uploads the artifact to the (test)-pypi repository.
- On the main branch, the version number remains unchanged and the artifact is published as a stable release to pypi.
- On feature branches, a valid development release suffix (.dev) is added to the version. The artifact is published to TestPyPI.
Publishing via GitHub Actions
The publishing process is automated using GitHub Actions. The CI pipeline is defined in the .github/workflows/publish.yml file. The key steps involved are:
- Setup Python Environment: The pipeline sets up the Python environment using the specified version in the
pyproject.tomlfile. - Install Dependencies: All necessary dependencies are installed using
pip. - Run Tests: The test suite is executed to ensure the code is functioning as expected.
- Generate Version: The version number is generated based on the branch name.
- Generate License File: The license file is generated using the
third_party_license_file_generatortool. - Build Package: The package is built using
python -m build. - Upload to PyPI: The built package is uploaded to PyPI or TestPyPI using
twine.
Project Files
-
LICENSEContains the license information for the project. -
MANIFEST.inSpecifies additional files to include in the distribution package. -
pyproject.tomlModern configuration file for build systems. Contains metadata and dependencies of the project. -
requirements.txtLists the dependencies for development and testing. -
THIRD-PARTY-LICENSES.mdGenerated file that lists the licenses of third-party dependencies.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jeap_pipeline-0.8.0.tar.gz.
File metadata
- Download URL: jeap_pipeline-0.8.0.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d452efa69c4e5aa2567e1daf9ecd5f1fa22bd5992c46bf9fba389833b6cf7366
|
|
| MD5 |
cb7c51c90ca8fea3071ee4c971587cc3
|
|
| BLAKE2b-256 |
70631e908e1b507d1b491b98d6dd4f37b9ce623e989669d4ff2a676b2958f726
|
File details
Details for the file jeap_pipeline-0.8.0-py3-none-any.whl.
File metadata
- Download URL: jeap_pipeline-0.8.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d83916671dc9382f931bdb7486991c87777cd2b3ed883b11feb6986f01b893b8
|
|
| MD5 |
d4dcc8cb0238f5bb4758bab5ef159648
|
|
| BLAKE2b-256 |
bcbab9556f668336d111a8f7dfcdec084946326f5893026afbe6cdd6f0fd7450
|