Python continuous integration (CI) support tools.
Project description
Introduction
Python continuous integration (CI) support tools.
To install: pip install isee
- Introduction
- Goal
- Workflow
- Results and Logs
- Versioning
- Skip CI
- Hosting
- How to setup CI
- Useful resources
Goal
The goal of CI is to automate code formatting, validation, deployment and publishing of packages.
Workflow
A CI pipeline is triggered when new code is pushed to a remote repository. Every CI pipeline does at least:
- Code formatting
- Apply automated linting on source code
- Push back the formatted code to the remote repository
- Code validation
- Testing (unit tests, integration tests, doctests)
- Docstring validation (only for frameworks)
- Deployment to an integration environment for applications / Publishing for frameworks -- (only on master and only if the Validation step succeeded)
- Semi-automated versioning (see the Versioning section) + Tag the repository with the new generated version number
- Packaging
- Deployment / Publishing
Results and Logs
You can see your CI pipeline's result and logs:
- From your GitLab project page → CI/CD → Pipelines
- From your GitHub project page → Actions → Continuous Integration
Versioning
Versioning is semi-automatically resolved: if you want the major or minor part to be bumped, you only have to add [bump major] or [bump minor] to your commit message on master (versioning is not applied to other branches).
Example, the current version number is 1.0.5. If you commit with the following message:
Added some new stuff.
the new version number will be 1.0.6. But if you commit with the following message:
Added some great new stuff! [bump minor]
the new version number will be 1.1.0. Finally, if you commit with the following message:
Added some extraordinary new stuff!!! [bump major]
the new version number will be 2.0.0.
Skip CI
You can prevent the CI pipeline from being triggered by adding [skip ci] to your commit message. Example:
Updated the README file. [skip ci]
Be careful! If you skip the CI process, any new code will not be validated and no new version will be deployed/published. So, think twice before using it.
Hosting
CI pipelines for GitHub public repositories are run on GitHub-hosted runners. See the GitHub documentation for more details
How to setup CI
This "How to" section applies to python package projects only. If you want to setup CI to an application project or another programing language, you will have to modify the CI pipeline definition according to your needs.
For a GitHub repository
- Add this ci.yml file to the
github/workflow/
directory (create the directory if it doesn't exist) into your local repository. Note that wads does it for you by running the following command from the project's root directory (documentation here):
populate . --root-url=GITHUB_ROOT_URL
Note that you can specify the root directory (in case you're not in the root directory), root url (in case the directory is not already associated to a git repo), and have many other parametrization choices.
Fear not: populate
will not create or modify the ci.yml
file (or any other file) if there is one already.
- In the
ci.yml
file, replace#PROJECT_NAME#
with the project name (must be the exact same name as the main module of the project, not needed if you ran thepopulate
tool because it did it for you) and modify the pipeline workflow to suit the project's needs. Documentation here. - Add secrets
PYPI_USERNAME
andPYPI_PASSWORD
with your PYPI credentials to the remote repository. Documentation here. - If you want the project's documentation to be published, configure the project's Github Pages for the project by selecting the
/docs
folder. Documentation here. - Push your code and see the execution of the new
Continuous Integration
workflow. Documentation here. Consider using wads to automatically validate your code locally, commit and push by running the following command (documentation here):
pack check-in 'Your commit message.'
Useful resources
Troubleshooting
Vesion tag misalignment
Sometimes the twine PYPI publishing may fail with such a message:
WARNING Skipping PKGNAME-0.1.4-py3-none-any.whl because it appears to already exist
WARNING Skipping PKGNAME-0.1.4.tar.gz because it appears to already exist
This often means that your git tags are misaligned with the setup.cfg
version.
You can see your git tags here: https://github.com/ORG/REPO/tags
.
To repair, do this:
- go to the https://pypi.org/project/ project page and note the PYPI_VERSION number
- got to
setup.cfg
and see what version is there, called it SETUP_VERSION - make a NEW_VERSION, which is a version number ABOVE the SETUP_VERSION and PYPI_VERSION.
- edit the
setup.cfg
so it shows NEW_VERSION git tag NEW_VERSION
git push origin NEW_VERSION
Sometimes I need to update the setup version again, and push again.
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
File details
Details for the file isee-0.2.24.tar.gz
.
File metadata
- Download URL: isee-0.2.24.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 936dab9121226cea53aa6928ce07b88a29bd073dad5749250e648493aa3575b3 |
|
MD5 | 0c2e066fcfb146e13903c9a18f1ac15d |
|
BLAKE2b-256 | 6dbf87675bf69b5ba1bf93327ae371356da953cd42bbb6a4efd5166fd6f656ae |
File details
Details for the file isee-0.2.24-py3-none-any.whl
.
File metadata
- Download URL: isee-0.2.24-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02205c2865ea868f161499f908a4e4d647e6b42d09dfff9402f8c742eb89547d |
|
MD5 | 044ba2c5d19a4458df1cd405ae2ec995 |
|
BLAKE2b-256 | f81cb89bba1b33cba1dc88b59d1e92bc80f9b5a75f6a8a898c95cb194881f346 |