Skip to main content

A package version manager based on SCM tags

Project description

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.10+

  • setuptools

Usage

pyproject.toml

[build-system]
requires = [
    "setuptools >= 42.0",
    "scmver[toml] >= 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.

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

scmver-1.9.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

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

scmver-1.9-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file scmver-1.9.tar.gz.

File metadata

  • Download URL: scmver-1.9.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for scmver-1.9.tar.gz
Algorithm Hash digest
SHA256 eeedfb7dabe9e326fb8a07ff59dea10da0fa0f523f36f32f475a49aee2c1d5f0
MD5 129fdfbc5be9f433b1bb5050f7bf33cf
BLAKE2b-256 d2caf502ccfd74981963e1898e3cc74f98c573238d3796541203f323dd429102

See more details on using hashes here.

File details

Details for the file scmver-1.9-py3-none-any.whl.

File metadata

  • Download URL: scmver-1.9-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for scmver-1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c486b0cdef9ef93d09f8d1ffae3cb91ad8e179b03211c3111be85ddc11330c
MD5 13720110a20d7c3fac614f94a3b4e8e5
BLAKE2b-256 c15094a9ef2ce273e6aef4436c942f748d05e0587bf6b60fb8ba6eb70cecae69

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