Skip to main content

scmver

scmver is a package version manager based on SCM tags.

It can be used to pass the version to the setup function in a setup.py, or to generate a file which contains the version.

https://img.shields.io/pypi/v/scmver.svg https://github.com/hattya/scmver/actions/workflows/ci.yml/badge.svg https://ci.appveyor.com/api/projects/status/l9flwehcgr5pxi33?svg=true https://codecov.io/gh/hattya/scmver/branch/master/graph/badge.svg

Installation

$ pip install scmver

Requirements

  • Python 3.11+

  • setuptools

Usage

pyproject.toml

[build-system]
requires = [
    "setuptools >= 42.0",
    "scmver >= 1.7",
]
build-backend = "setuptools.build_meta"

[tool.scmver]
spec = "micro"
write-to = "scmver/__version__.py"
fallback = {attr = "scmver:__version__"}
write-to

An alias for write_to, but it takes precedence.

fallback
attr

A string which is described in fallback in Configuration.

path (optional)

A path to import the module.

See Configuration for key/value pairs.

setuptools

from setuptools import setup

setup(setup_requires=['scmver'],
      scmver=True)

scmver is either following values:

True

It is same as an empty dict.

callable object

It should return a dict.

dict

See Configuration for details.

distutils

from distutils.core import setup

import scmver

setup(version=scmver.get_version())

See Configuration for the scmver.get_version arguments.

Configuration

root

A path of the working directory.

Default: '.'

spec

A version specifier to construct the public version identifiers. It will be incremented by the number of commits from the latest tag.

major

It will increment the major version.

minor

It will increment the minor version.

micro or patch

It will increment the micro (patch) version.

post

It will increment the post-release segment.

major.dev

It will increment the development release segment after incrementing the major version by 1.

minor.dev

It will increment the development release segment after incrementing the minor version by 1.

micro.dev or patch.dev

It will increment the development release segment after incrementing the micro (patch) version by 1.

Default: 'post'

local

A string or callable object to construct the local version identifiers.

string

A format string.

Available keywords:

  • {distance}

  • {revision}

  • {branch}

  • {utc} - Return value of datetime.datetime.now(datetime.timezone.utc)

  • {local} - Return value of datetime.datetime.now()

callable object

It will be called with scmver.core.SCMInfo.

Default: '{local:%Y-%m-%d}'

version

A regular expression object to extract the version from SCM tags. It should contain the version group.

write_to

A path to a file which will be generated using template.

template

A format string which is used by write_to.

Available keywords:

  • {version}

  • {revision}

  • {branch}

fallback

It will be used when there is outside of a working copy.

string

It is in the 'package.module:some.attribute' format (ex: 'scmver:__version__').

list

It consists of a string which is described above, and a path to import the module.

callable object

It should return the version.

bazaar.tag

A regular expression pattern to filter tags.

darcs.tag

A regular expression pattern to filter tags.

fossil.tag

A regular expression pattern to filter tags.

git.tag

It will be passed to git describe as --match.

mercurial.tag

A regular expression pattern to filter tags.

subversion.tag

A regular expression pattern to filter tags.

subversion.trunk

A relative repository path of the trunk directory.

Default: 'trunk'

subversion.branches

A relative repository path of the directory where branches are located.

Default: 'branches'

subversion.tags

A relative repository path of the directory where tags are located.

Default: 'tags'

License

scmver is distributed under the terms of the MIT License.

Metadata

Release files for scmver 1.10

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

Source distribution (sdist)

Source distribution for scmver 1.10
File Size Uploaded
scmver-1.10.tar.gz 30.6 kB Details

Built distribution (wheel)

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

Total release size: 53.0 kB

Release files / scmver-1.10.tar.gz

Download URL scmver-1.10.tar.gz
Size 30.6 kB
Tags Source
SHA-256 checksum
How to use checksums
faa3ce90c3ff827408b6af4a40b455631b14d70415bc01182690f3c2c8b53427
BLAKE2b-256 checksum
How to use checksums
e6b25c5b5b6cfd3f3d36f41318ee4eeb00a610e937bb7780ca911fa363c653ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / scmver-1.10-py3-none-any.whl

Download URL scmver-1.10-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
786b4e6baee35c7439f97de7ab92385d6290273ba47ec41b1a09d91ce910a539
BLAKE2b-256 checksum
How to use checksums
574f21ee1ac3d5692a3752bf4c6e59f751665d6262d768656db22df54eb51271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

1.10 This release

2 release files

1.9

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

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