HomeDocs
DocsCommunityTestimonialsUsersGitHubTwitterBlogJobsTermsPrivacyCookies
TermsPrivacyCookies
Hey! These docs are for version 2.13, which is no longer officially supported. Click here for the latest version, 2.18!

vcs_version

Generates a version string from VCS state.

Uses a constrained but useful subset of the full functionality of setuptools_scm (https://github.com/pypa/setuptools_scm). These constraints avoid pitfalls in the interaction of setuptools_scm with Pants's hermetic environments.

In particular, we ignore any existing setuptools_scm config. Instead you must provide a subset of that config in this target's fields.

If you need functionality that is not currently exposed here, please reach out to us at Getting help.

Backend: pants.backend.experimental.python

generate_to

type: str
required

Generate the version data to this relative path, using the template field.

Note that the generated output will not be written to disk in the source tree, but will be available as a generated dependency to code that depends on this target.

template

type: str
required

Generate the version data using this format string, which takes a version format kwarg.

E.g., 'version = "{version}"'

description

type: str | None
default: None

A human-readable description of the target.

Use ./pants list --documented :: to see all targets with descriptions.

python_resolve

type: str | None
default: None
backend: pants.backend.experimental.python

The resolve from [python].resolves to use.

If not defined, will default to [python].default_resolve.

All dependencies must share the same value for their resolve field.

tag_regex

type: str | None
default: '^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$'

A Python regex string to extract the version string from a VCS tag.

The regex needs to contain either a single match group, or a group named version, that captures the actual version information.

Note that this is unrelated to the tags field and Pants's own tags concept.

See https://github.com/pypa/setuptools_scm for implementation details.

tags

type: Iterable[str] | None
default: None

Arbitrary strings to describe a target.

For example, you may tag some test targets with 'integration_test' so that you could run ./pants --tag='integration_test' test :: to only run on targets with that tag.