Skip to main content

Manage properly semver in your repository

Project description

Semversioner

The easiest way to manage semantic versioning in your project and generate CHANGELOG.md file automatically.

Semversioner will provide the tooling to automate semver release process for libraries, docker images, etc.

This project was inspired by the way AWS manages their versioning for AWS-cli.

Semantic Versioning

The semantic versioning spec involves several possible variations, but to simplify, in Semversioner we are using the three-part version number:

<major>.<minor>.<patch>

Constructed with the following guidelines:

  • Breaking backward compatibility or major features bumps the major (and resets the minor and patch).
  • New additions without breaking backward compatibility bumps the minor (and resets the patch).
  • Bug fixes and misc changes bumps the patch.

An example would be 1.0.0

How it works

At any given time, the .semversioner/ directory looks like:

.semversioner
└── next-release
    ├── minor-20181227010225.json
    └── major-20181228010225.json
├── 1.1.0.json
├── 1.1.1.json
├── 1.1.2.json

The release process takes everything in next-release and aggregates them all together in a single JSON file for that release (e.g 1.12.0.json). This JSON file is a list of all the individual JSON files from next-release.

Install

$ pip install semversioner

Usage

Bumping the version

In your local environment your will use the CLI to create the different changeset files that will be committed with your code. For example:

$ semversioner add-change --type patch --description "Fix security vulnerability with authentication."

Then, in your CI/CD tool you will need to release (generating automatically version number) and creating the the changelog file.

$ semversioner release

Generating Changelog

As a part of your CI/CD workflow, you will be able to generate the changelog file with all changes.

$ semversioner changelog > CHANGELOG.md

You can customize the changelog by creating a template and passing it as parameter to the command. For example:

$ semversioner changelog --template .semversioner/config/template.j2

The template is using Jinja2, a templating language for Python. For example:

# Changelog
{% for release in releases %}

## {{ release.version }}

{% for change in release.changes %}
- {{ change.type }}: {{ change.description }}
{% endfor %}
{% endfor %}

You can filter the changelog by only showing changes for a specific version:

$ semversioner changelog --version "1.0.0"

Alternatively, you can use the following command to filter changes by the last released version:

$ semversioner changelog --version $(semversioner current-version)

License

Copyright (c) 2021 Raul Gomis. MIT licensed, see LICENSE file.


Made with ♥ by Raul Gomis <https://twitter.com/rgomis>.

Changelog

Note: version releases in the 0.x.y range may introduce breaking changes.

0.13.0

  • minor: Add support for custom changelog template
  • patch: Fix security vulnerability with jinja2 CVE-2020-28493

0.12.0

  • minor: Improved performance by supporting multiple changeset files per second
  • minor: Status command now sorts unreleased changes by type and description in order to display consistent results
  • patch: Internal code refactor to improve code readability and maintanability

0.11.0

  • minor: Add '--version' filter to the 'changelog' command to display the changelog only for a specific version

0.10.0

  • minor: Add new 'status' command to display the state of the working directory and unreleased changes
  • patch: Fix build and deployment configuration
  • patch: Refactor method names and code for better code readability and testability

0.9.0

  • minor: Deprecated .changes directory in favour of .semversioner directory
  • patch: Internal refactor to improve code quality and test coverage

0.8.1

  • patch: Fix installer error when referencing to LICENSE file

0.8.0

  • minor: Enabled autocompletion by default

0.7.1

  • patch: Improve docs for open source

0.7.0

  • minor: Fail with error code when no changes are provided in the release command

0.6.16

  • patch: Fix bug: add require module in setup.py

0.6.15

  • patch: Fix packaging for LICENSE
  • patch: Improve README.md documentation
  • patch: Use jinja2 template engine internally to generate the changelog

0.6.14

  • patch: Update docs

0.6.13

  • patch: Fix README.md

0.6.12

  • patch: Fix long description content type

0.6.11

  • patch: Add README.md file

0.6.10

  • patch: Fix code consistency

0.6.9

  • patch: Fix packaging

0.6.8

  • patch: Tag the repository when releasing

0.6.7

  • patch: Fix tests and improve coverage

0.6.6

  • minor: Initial version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semversioner-0.13.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semversioner-0.13.0-py2.py3-none-any.whl (9.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file semversioner-0.13.0.tar.gz.

File metadata

  • Download URL: semversioner-0.13.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for semversioner-0.13.0.tar.gz
Algorithm Hash digest
SHA256 042f3b65f88bb0ec74b4226c81c9622a042f5adc0698a9db0417641ab9781bc9
MD5 a17bfb6406a15b1cd6a1640e56d936e3
BLAKE2b-256 1d9946a53d0985bf8acb2fc3239ef8b34d4e9ef79fa509533d4dd882b99fdde9

See more details on using hashes here.

File details

Details for the file semversioner-0.13.0-py2.py3-none-any.whl.

File metadata

  • Download URL: semversioner-0.13.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for semversioner-0.13.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 299ced0bc283e71e9480fa57d11375374bf478b07d02be34f2b83ff214286a26
MD5 0d6280322dd0bfab5cf906afad573931
BLAKE2b-256 a70c319434af018e5aa30a50c2cf513a7eb5cbd966e6a57695f379566cd0741d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page