A CLI tool for calendar-based version bumping
Project description
Support Python Versions
CI/CD Pipeline:
SonarCloud:
BumpCalver CLI Documentation
Note
This project should be consider in beta and is not yet ready for production use.
Overview
The BumpCalver CLI is a command-line interface for calendar-based version bumping. It automates the process of updating version strings in your project's files based on the current date and build count. Additionally, it can create Git tags and commit changes automatically. The CLI is highly configurable via a pyproject.toml
file and supports various customization options to fit your project's needs.
Table of Contents
-
Documentation Site: BumpCalver CLI
Installation
To install the BumpCalver CLI, you can add it to your project's dependencies. If it's packaged as a Python module, you might install it via:
pip install bumpcalver
Note: Replace the installation command with the actual method based on how the package is distributed.
Getting Started
-
Configure Your Project: Create or update the
pyproject.toml
file in your project's root directory to include the[tool.bumpcalver]
section with your desired settings. -
Run the CLI: Use the
bumpcalver
command with appropriate options to bump your project's version.
Example:
bumpcalver --build --git-tag --auto-commit
Configuration
The BumpCalver CLI relies on a pyproject.toml
configuration file located at the root of your project. This file specifies how versioning should be handled, which files to update, and other settings.
As an alternative, you can use configuration file named bumpcalver.toml
. The CLI will look for this file if pyproject.toml
is not found.
Configuration Options
version_format
(string): Format string for the version. Should include{current_date}
and{build_count}
placeholders.timezone
(string): Timezone for date calculations (e.g.,UTC
,America/New_York
).file
(list of tables): Specifies which files to update and how to find the version string.path
(string): Path to the file to be updated.file_type
(string): Type of the file (e.g.,python
,toml
,yaml
,json
,xml
,dockerfile
,makefile
).variable
(string, optional): The variable name that holds the version string in the file.pattern
(string, optional): A regex pattern to find the version string.version_standard
(string, optional): The versioning standard to follow (e.g.,python
for PEP 440).
git_tag
(boolean): Whether to create a Git tag with the new version.auto_commit
(boolean): Whether to automatically commit changes when creating a Git tag.
Example Configuration
[tool.bumpcalver]
version_format = "{current_date}-{build_count:03}"
timezone = "America/New_York"
git_tag = true
auto_commit = true
[[tool.bumpcalver.file]]
path = "pyproject.toml"
file_type = "toml"
variable = "project.version"
version_standard = "python"
[[tool.bumpcalver.file]]
path = "examples/makefile"
file_type = "makefile"
variable = "APP_VERSION"
version_standard = "default"
[[tool.bumpcalver.file]]
path = "examples/dockerfile"
file_type = "dockerfile"
variable = "arg.VERSION"
version_standard = "default"
[[tool.bumpcalver.file]]
path = "examples/dockerfile"
file_type = "dockerfile"
variable = "env.APP_VERSION"
version_standard = "default"
[[tool.bumpcalver.file]]
path = "examples/p.py"
file_type = "python"
variable = "__version__"
version_standard = "python"
Command-Line Usage
The CLI provides several options to customize the version bumping process.
Usage: bumpcalver [OPTIONS]
Options:
--beta Use beta versioning.
--build Use build count versioning.
--timezone TEXT Timezone for date calculations (default: value
from config or America/New_York).
--git-tag / --no-git-tag Create a Git tag with the new version.
--auto-commit / --no-auto-commit
Automatically commit changes when creating a Git
tag.
--help Show this message and exit.
Options
--beta
: Prefixes the version withbeta-
.--build
: Increments the build count based on the current date.--timezone
: Overrides the timezone specified in the configuration.--git-tag
/--no-git-tag
: Forces Git tagging on or off, overriding the configuration.--auto-commit
/--no-auto-commit
: Forces auto-commit on or off, overriding the configuration.
Examples
Basic Version Bump
To bump the version using the current date and build count:
bumpcalver --build
Beta Versioning
To create a beta version:
bumpcalver --build --beta
Specifying Timezone
To use a specific timezone:
bumpcalver --build --timezone Europe/London
Creating a Git Tag with Auto-Commit
To bump the version, commit changes, and create a Git tag:
bumpcalver --build --git-tag --auto-commit
Error Handling
- Unknown Timezone: If an invalid timezone is specified, the default timezone (
America/New_York
) is used, and a warning is printed. - File Not Found: If a specified file is not found during version update, an error message is printed.
- Invalid Build Count: If the existing build count in a file is invalid, it resets to
1
, and a warning is printed. - Git Errors: Errors during Git operations are caught, and an error message is displayed.
- Malformed Configuration: If the
pyproject.toml
file is malformed, an error is printed, and the program exits.
Support
For issues or questions, please open an issue on the project's repository.
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 bumpcalver-2024.11.8.tar.gz
.
File metadata
- Download URL: bumpcalver-2024.11.8.tar.gz
- Upload date:
- Size: 66.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d446edd434d402d0f0454783445946068e83909a71f8d64e4ebe0b09fa094dd2 |
|
MD5 | b2717f9d461211063e7d126195747a8c |
|
BLAKE2b-256 | 4207820e843750968fb7a8c6f50db8ff4e591bb2d7c3e368343e2301c3af293b |
File details
Details for the file bumpcalver-2024.11.8-py3-none-any.whl
.
File metadata
- Download URL: bumpcalver-2024.11.8-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e35073b20e758845227617757b058354996faf9e52ee8f6d0b06530aa88060ca |
|
MD5 | 84e59dd001c41b8c684bbd7e1bf7aad6 |
|
BLAKE2b-256 | 7efb552f432ca5550a532767e2741af5b5edc9d2f415f8b01cc3dfa5c0bd08e8 |