Hatch plugin for ci system versioning
Project description
hatch-ci
This is a hatch-vcs heavily inspired pluging, managing the version information for a python wheel package.
It gets version information from:
- version-file entry in the tool.hatch.version toml entry (eg. 1.0.0) in the master branch
- augments it with a bNNN build number in creating the package foobar-1.0.0bNNNN (this can be sent to PyPi)
- if there's a tag v1.0.0 on the repo, it will build foobar-1.0.0 release (this can be sent to PyPi)
The last two steps are mean to be managed in a CI/CD system (github at the moment), to ensure hands-off releases.
In essence this pluging:
- manages the version information
- allows version replacement in text files using build information
NOTE: this is heavily inspired from hatch-vcs
Table of Contents
Global dependency
Ensure hatch-ci is defined within the build-system.requires field in your pyproject.toml file.
[build-system]
requires = ["hatchling", "hatch-ci"]
build-backend = "hatchling.build"
Version source
The version source plugin name is ci.
This will enable the hatch-ci pluging:
-
pyproject.toml
[project] .. dynamic = ["version"] # this rerieves the version dynamically ..
Version source options
-
pyproject.toml
[tool.hatch.version] source = "ci" # this pulls the version using the hatch-ci hook # this will put/update __version__ and __hash__ info in version-file version-file = "src/hatch_ci/__init__.py" # these files will be jinja2 processed, the environment will # contains variables as: branch, build, current, ref, runid, # sha, version, workflow etc. paths = [ "README.md" ] # the listed paths will undergo replacement before jinja2 processing and # the strings 'a' & 'b' wil be replaced fixers = [ { 'a': '{ctx.workflows}' }, { 'd': '{ctx.branch}' } ]
| Option | Type | Default | Description |
|---|---|---|---|
version-file |
str |
None | A file where to write version/hash variables |
paths |
`list[str] | str` | None |
fixers |
list[dict[str,str]] |
None | A list of dict, each key is a string to replace with the value |
License
hatch-ci is distributed under the terms of the MIT license.
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 hatch_ci-0.1.2b38.tar.gz.
File metadata
- Download URL: hatch_ci-0.1.2b38.tar.gz
- Upload date:
- Size: 135.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9847d80c769969c4e917859cd127207e5d0246c1892bcc06f4f1fbeefa2c8446
|
|
| MD5 |
47f18dc0dfd13585065afe8fdc89b328
|
|
| BLAKE2b-256 |
e23afc27c51afd69c069779efee3843114dad2de274c00da587360b700d3433b
|
File details
Details for the file hatch_ci-0.1.2b38-py3-none-any.whl.
File metadata
- Download URL: hatch_ci-0.1.2b38-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5ca86dc23547521fee38a7c3810b67c281a4e94a382cc23d3f4fac6d316c54e
|
|
| MD5 |
3b4ac546f93079afd683bb204f087f65
|
|
| BLAKE2b-256 |
e542e158bc4abaea35db6a120a8c441dd65cba7e79447f8451f2164b6d1d72b4
|