A tool to assist the maintenance of package versioning with scm tags
Project description
Vertagus
Vertagus is a tool to enable automation around maintining versions for your source code via a source control management tool like git. You can automate checks to compare the current code version string with version string(s) found on a specific branch of your repo or in repo tags.
Installation
To install from pip:
pip install vertagus
To install from GitHub, clone and then pip install from source:
git clone https://github.com/jdraines/vertagus.git
pip install ./vertagus
Assumptions
Vertagus assumes some things about your development and versioning process:
- You are using some sort of packaging or distribution tool that contains a structured text document like
yamlortoml, and you declare your package version in that document. Vertagus calls these documents "manifests". - You are using a source control manager (scm) like git to manage your code's changes. (Only git is currently supported.)
What it does
Configuration
Vertagus lets you declare some things about how you'd like to maintain your versioning:
- Version Strategy -- there are two strategies supported,
"branch", and "tag", and you declare this as part of your scm configuration. The"branch"strategy will look at a manifest file on a particular branch to determine the highest previous version. The"tag"strategy will look through tags in a repo to determine the highest previous version. - Manifests, which are the source of truth for your versioning. (You can declare more than one if you like, but the first one will be considered the authoritative version.)
- Rules that your versioning should follow. For example, should it match a certain regex pattern? Should it always
be incrementally higher than the last version? Is your version required to be in multiple manifests, and you need to
know if they are out of sync with each other? For a list of rules, you can run
vertagus list-rules. - Version Aliases whose tags can move around a bit. For example, you might use major-minor-patch semantic versioning, but you'd like to maintain a major-minor alias on whatever your most recent patch version is.
- Stages of your development process that might need different rules or aliases. This might correspond to names like
dev,staging, orprod, or it could be whatever else you like, depending on how you plan to use it. - Tag Prefixes in case you're developing in a repository that holds multiple packages. Or maybe you just like prefixes.
You declare these in either a vertagus.toml or vertagus.yaml file next to your package in your repository.
Here's an example of the yaml format:
scm:
type: git
tag_prefix: v
version_strategy: tag
project:
rules:
current:
- not_empty
increment:
- any_increment
manifests:
- type: setuptools_pyproject
path: ./pyproject.toml
name: pyproject
stages:
dev:
rules:
current:
- regex_dev_mmp
prod:
aliases:
- string:latest
- major.minor
rules:
current:
- regex_mmp
Version strategies
Vertagus uses your scm as the source of truth for previous versions, so the version strategy is declared within the scm configuration block. Two version strategies are supported, tag and branch.
In the case of using tag, running vertagus validate will look for version tags in your source control repo
and will attempt to extract the highest version seen there for use in validation of the local version state.
In the case of using branch, some additional config parameters are required:
scm:
# other scm params
version_strategy: branch
target_branch: main
manifest_path: pyproject.toml # path relative to repo root
manifest_type: toml
manifest_loc: ["project", "version"]
For branch, vertagus will extract the version from the manifest on the target branch to be used as the highest previous version for use in validation of the local version state.
Also note that when branch strategy is specified, the branch to be used can be overridden in the vertagus validate CLI command. (See below.) This allows for adding automated version checks against other branches in the case of a git-flow style merge pattern.
Available Rules
For a complete list of rules that can be used in the configuration, you can run vertagus list-rules
to see the available rules and whether they can be used as increment or current rules.
(See the configuration docs for more on the format of this file.)
Command Line Interface
Vertagus provides two main operations in its vertagus CLI:
validate
The validate command looks like this:
vertagus validate [--stage-name STAGE_NAME --config CONFIG_FILEPATH --scm-branch SCM_BRANCH_NAME]
The validate command will check your configuration and run any rules that you have declared there. If any of the rules
are being broken by the current state of the code, then it will exit with exit code 1. Otherwise, it exits without
error.
create-tag
The create-tag command looks like this:
vertagus create-tag [--stage-name STAGE_NAME --config CONFIG_FILEPATH]
The create-tag command will check your configuration and create tags for the current version of your code as well as
for any aliases that may be declared. These tags are created locally, but then pushed to your remote.
Additionally, Vertagus provides a number of commands for discovering the names of rules, aliases, manifets, ans scm providers:
list-rules
vertagus list-rules
list-aliases
vertagus list-aliases
list-manifests
vertagus list-manifests
list-scms
vertagus list-scms
Continuous Integration
You may have noticed that the operations described above are a little odd to run just anywhere any time. Vertagus is
best suited to be executed in CI automation. For example, you could configure your scm platform to run the validate
command when a pull request is created as a check that must pass in order to merge. Then, you could configure your
scm platform to run the create-tag command after a pull request has merged and closed.
Documentation
For more documentation, see the docs directory.
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 vertagus-0.2.1.tar.gz.
File metadata
- Download URL: vertagus-0.2.1.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
732880f33f459bf4559ef98ba59b93b06292a97ce82188056187b7c2155c7b78
|
|
| MD5 |
9b147bfd917161f957193c5423bde0a5
|
|
| BLAKE2b-256 |
d07ace6b714f3910a0cba678f4c1a7421d8bd95bbdb8a201a4ad7e3fce4f91f0
|
Provenance
The following attestation bundles were made for vertagus-0.2.1.tar.gz:
Publisher:
workflow.on-pr-merge.yml on jdraines/vertagus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vertagus-0.2.1.tar.gz -
Subject digest:
732880f33f459bf4559ef98ba59b93b06292a97ce82188056187b7c2155c7b78 - Sigstore transparency entry: 252066509
- Sigstore integration time:
-
Permalink:
jdraines/vertagus@d5e5427f7e27d6963203b79366ddd7255a7a577f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jdraines
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.on-pr-merge.yml@d5e5427f7e27d6963203b79366ddd7255a7a577f -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file vertagus-0.2.1-py3-none-any.whl.
File metadata
- Download URL: vertagus-0.2.1-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7f8404e9bb64f5b3a3167d42e4d0eb0e97305d9ae2d68754b9aab063223b57f
|
|
| MD5 |
fe0dc1799bfa6553bd4023fbc151b45e
|
|
| BLAKE2b-256 |
86f8f88e585ab0c61a28f6415f9fc06a8293ef73e92911aa4108470b2abef7ba
|
Provenance
The following attestation bundles were made for vertagus-0.2.1-py3-none-any.whl:
Publisher:
workflow.on-pr-merge.yml on jdraines/vertagus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vertagus-0.2.1-py3-none-any.whl -
Subject digest:
f7f8404e9bb64f5b3a3167d42e4d0eb0e97305d9ae2d68754b9aab063223b57f - Sigstore transparency entry: 252066510
- Sigstore integration time:
-
Permalink:
jdraines/vertagus@d5e5427f7e27d6963203b79366ddd7255a7a577f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jdraines
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.on-pr-merge.yml@d5e5427f7e27d6963203b79366ddd7255a7a577f -
Trigger Event:
pull_request
-
Statement type: