Skip to main content

Automatic Semantic Versioning for Poetry

Handle automatically incrementing the version in your pyproject.toml

Installation

pip install poetryupvers

Upversion process

This package executes the following processes:

  • open pyproject.toml and read version
  • parse version into a semver-friendly format
  • read the commit history of the repo from HEAD to the latest numeric tag
  • searches for keyword matches in the commit messages compared to the content of the messages.json file
  • if any keywords match with phrases defined the major, minor, or patch json objects, then the bump type will reflect major, minor, or patch
    • For example, if a commit message with "[BREAKING CHANGE]" is found in the history, the bump type will be major
  • bump version based on version type determined
  • update pyproject.toml file

Usage

Usage:
    ppuv bump [--messages-file=<path>]
    ppuv push-bump [--config-user=<user>] [--config-email=<email>] [--remote=<remote>] [--branch=<branch>]
    ppuv generate-release-notes [--save] [--path=<path>]

Options:
    -h, --help      Show Usage.

Commands:
    bump                    Bump the version of the pyproject.toml file. 
                            This is based on specific keywords, defined in the messages.json file, 
                            found in commit messages ranging from HEAD to the last numeric tag
    
    push-bump               Commits the pyproject.toml file to the git repository.
                            Contains multiple options to run this command in a CI pipeline

    generate-release-notes  Generates release notes based on commits and related MRs in GitLab

Arguments:
    messages-file   Override the messages file JSON (text snippets denoting the version bump), 
                    if not using a local messages.json or installed messages.json
    save            Writes release notes to file (default path = ./release_notes.md)
    path            Override release notes file path
    config-user     Sets git user
    config-email    Sets git user email
    remote          Sets git remote name (ex: origin)
    branch          Sets git push branch

Bump version with default configuration

ppuv bump

Bump version with overriden messages.json

# If you have a messages.json defined directly at the root of your repository
ppuv bump

# If you have a different location for your messages.json (or a different filename)
ppuv bump --messages-file=<path-to-file>

Example messages.json

{
    "major": "[BREAKING CHANGE]",
    "minor": [
        "[New Feature]",
        "Add",
        "Update"
    ],
    "patch": [
        "[BUGFIX]",
        "Fix"
    ]
}

Generate release notes (For GitLab only)

ppuv generate-release-notes

This process is dependent on the following environment variables being set:

  • CI_PROJECT_ID: The ID of the project, should be available within a CI pipeline. You will need to set this manually if you run this command outside of a GitLab CI pipeline
  • CI_SERVER_URL: The base url of the GitLab instance itself (e.g https://gitlab.com). Also should be available within a CI pipeline, but you will need to set it manually to run this script outside of a GitLab CI pipeline
  • ACCESS_TOKEN: Personal access token or Project-level access token. Used to interact with the GitLab API to retrieve the related MRs to the git commits. You will need to store this as a CI/CD variable

The process is the following:

  • Grab a list of commit hashes between HEAD and the latest numeric tag
  • Iterate over the hashes and send a request to projects/{id}/repository/commits/{commit}/merge_requests to retrieve any related MRs to that commit
  • Append the MR title and ID to an internal dictionary to prevent any duplicate entries
  • Format each MR title and ID to a markdown bullet
  • Print out release notes and write them to a file

Metadata

Release files for PoetryUpvers 0.3.4

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

Source distribution (sdist)

Source distribution for PoetryUpvers 0.3.4
File Size Uploaded Provenance
poetryupvers-0.3.4.tar.gz 7.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for PoetryUpvers 0.3.4
File Interpreter ABI Platform
poetryupvers-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / poetryupvers-0.3.4.tar.gz

Download URL poetryupvers-0.3.4.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
43c62365031eca7efb0db71c8285b7db1756bf4cc697354b68ab10bd3b78ecd8
BLAKE2b-256 checksum
How to use checksums
11869a0d4c064b7aba61cfe1689683810e43ef234ebbf78eb687f45c631488b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.8.12 Linux/5.4.109+

Release files / poetryupvers-0.3.4-py3-none-any.whl

Download URL poetryupvers-0.3.4-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f754402582c7ea2ea0c77b1a83caf4da1f7cea20867ceebcd9f1951775a8da4f
BLAKE2b-256 checksum
How to use checksums
61730fd15dcb9ef9b1552ebdca634edd9f290432c2be3748dcbf559c801a6f13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.8.12 Linux/5.4.109+

Security for PoetryUpvers 0.3.4

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