Activities

The following displays information about the release activities that come stock with rever.

Authors

Manages keeping a contributors listing up-to-date.

BibTex

Writes a BibTex reference for the version of software.

Changelog

Manages keeping a changelog up-to-date.

Command

Runs a command

CondaForge

Updates conda-forge feedstocks.

DeploytoGCloud

Deploys a docker container to the google cloud

DeploytoGCloudApp

Deploys an app to the google cloud via the app engine

DockerBuild

Builds a Dockerfile.

DockerPush

Pushes a built Dockerfile.

GHPages

Activity for pushing documentation up to GitHub pages.

GHRelease

Performs a github release.

Nose

Runs nose tests inside of a container.

PushTag

Pushes the current tag up to a remote repository.

PyPI

Uploads a package to the Python Package Index.

PyTest

Runs pytest inside of a container.

Sphinx

Runs sphinx inside of a container.

Tag

Locally tags the current version.

VersionBump

Changes the version to the value of $VERSION.

Listing

Authors

The Authors activity class is available via:

from rever.activities.authors import Authors

Manages keeping a contributors listing up-to-date.

This activity may be configured with the following envionment variables:

$AUTHORS_FILENAME

str, path to input file. The default is ‘AUTHORS’.

$AUTHORS_TEMPLATE

str, This value goes at the top of the authors file. The default value is:

All of the people who have made at least one contribution to $PROJECT
Authors are sorted by {sorting_text}.

{authors}

This is evaluated in the current environment and,

  • “{sorting_text}” is a special textual description of the sort method.

  • “{authors}” is a contcatenated string of all formatted authors.

which the template is formatted with.

$AUTHORS_FORMAT

str, the string that formats each author in the author file. The default is ``”* {name}

``. The valid fields are all of those present

in the author metadata (see below).

$AUTHORS_LATEST

str, file to write just the latest contribuors to, i.e. this is the listing of the contributors for just this release. This defaults to $REVER_DIR/LATEST-AUTHORS.json. This is evaluated in the current environment.

$AUTHORS_METADATA

str, path to YAML file that stores author metadata. The default is ‘.authors.yml’. This is evaluated in the current environment. This file has the following format:

# required fields
- name: Princess Buttercup
  email: buttercup@florin.gov

  # optional fields
  github: bcup
  is_org: False
  aliases:
    - Buttercup
    - beecup
  alternate_emails:
    - b.cup@gmail.com

  # autogenerated fields
  num_commits: 1000
  first_commit: '1987-09-25'
- name: Westley
  email: westley@gamil.com
  github: westley
  aliases:
    - Dread Pirate Roberts
  alternate_emails:
    - dpr@pirates.biz
- name: Florin
  email: help@florin.gov
  github: florin
  is_org: True
$AUTHORS_SORTBY

str, flag that specifies how authors should be sorted in the authors file. Valid options are:

  • "num_commits": Number of commits per author

  • "first_commit": Sort by first commit.

  • "alpha": Alphabetically.

$AUTHORS_INCLUDE_ORGS

bool, Whether or not to include organizations in the authors file, defaults to False.

$AUTHORS_MAILMAP

str, bool, or None, If this is a non-empty string, it will be interperted as a file path to a mailmap file that will be generated based on the metadata provided. The default value is ".mailmap". This is evaluated in the current environment.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['authors']

$AUTHORS_FILENAME = 'AUTHORS'
$AUTHORS_TEMPLATE = 'All of the people who have made at least one contribution to $PROJECT.\nAuthors are sorted {sorting_text}.\n\n{authors}\n'
$AUTHORS_FORMAT = '* {name}\n'
$AUTHORS_LATEST = '$REVER_DIR/LATEST-AUTHORS.json'
$AUTHORS_METADATA = '.authors.yml'
$AUTHORS_SORTBY = 'num_commits'
$AUTHORS_INCLUDE_ORGS = False
$AUTHORS_MAILMAP = '.mailmap'

BibTex

The BibTex activity class is available via:

from rever.activities.bibtex import BibTex

Writes a BibTex reference for the version of software.

Environment variables that directly affect the behaviour of this activity are:

$BIBTEX_BIBFILE

str, The filename to create. Defaults to 'bibtex.bib'.

$BIBTEX_PROJECT_NAME

str, The name of the project. This is expanded in the current envrionment, default $PROJECT.

$BIBTEX_AUTHORS

list of str, The name of the authors to credit in the citation. Default has no authors.

$BIBTEX_URL

str, URL to the project. This is expanded in the current environment, default '$WEBSITE_URL'.

Other environment variables that affect the behaviour of the bibtex activity are:

$PROJECT

Used as the default project name.

$WEBSITE_URL

Used as the default URL.

$VERSION

Used in the bibtex entry as part of the identifier.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['bibtex']

$BIBTEX_BIBFILE = 'bibtex.bib'
$BIBTEX_PROJECT_NAME = '$PROJECT'
$BIBTEX_AUTHORS = ()
$BIBTEX_URL = '$WEBSITE_URL'

Changelog

The Changelog activity class is available via:

from rever.activities.changelog import Changelog

Manages keeping a changelog up-to-date.

This activity may be configured with the following envionment variables:

$CHANGELOG_FILENAME

str, path to input file. The default is ‘CHANGELOG’.

$CHANGELOG_PATTERN

str, Python regex that is used to find the location in the file where new changelog entries should be placed. The default is '.. current developments'.

$CHANGELOG_HEADER

str or callable that accepts a single version argument, this is the replacement that goes above the new merge entries. This should contain a string that matches the pattern arg so that the next release may be inserted automatically. The default value is:

.. current developments

v$VERSION

====================
$CHANGELOG_NEWS

str, path to directory containing news files. The default is 'news'.

$CHANGELOG_IGNORE

list of str, regexes of filenames in the news directory to ignore. The default is to ignore the template file.

$CHANGELOG_LATEST

str, file to write just the latest part of the changelog to. This defaults to $REVER_DIR/LATEST. This is evaluated in the current environment. If this file is not within $REVER_DIR, it is added to the repository.

$CHANGELOG_TEMPLATE

str, filename of the template file in the news directory. The default is 'TEMPLATE'.

$CHANGELOG_CATEGORIES

iterable of str, the news categories that are used. Default:('Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Security')

$CHANGELOG_CATEGORY_TITLE_FORMAT

str or callable, a format string with {category} entry for formatting changelog and template category titles. If this is a callable, it is a function which takes a single category argument and returns the title string. The default is ``{category}:

``.
$CHANGELOG_AUTHORS_TITLE

str or bool, If this is a non-empty string and the authors activitiy is being run, this will append an authors section to this changelog entry that contains all of the authors that contributed to this version. This string is the section title and is formatted as if it were a category with $CHANGELOG_CATEGORY_TITLE_FORMAT. The default is "Authors".

$CHANGELOG_AUTHORS_FORMAT

str, this is a format string that formats each author who contributed to this release, if an authors section will be appened. This is evaluated in the context of the authors, see the authors activity for more details on the available fields. The default is ``”* {name}

``.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['changelog']

$CHANGELOG_FILENAME = 'CHANGELOG'
$CHANGELOG_PATTERN = '.. current developments'
$CHANGELOG_HEADER = '.. current developments\n\nv$VERSION\n====================\n\n'
$CHANGELOG_NEWS = 'news'
$CHANGELOG_IGNORE = None
$CHANGELOG_LATEST = '$REVER_DIR/LATEST'
$CHANGELOG_TEMPLATE = 'TEMPLATE'
$CHANGELOG_CATEGORIES = ('Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Security')
$CHANGELOG_CATEGORY_TITLE_FORMAT = '**{category}:**\n\n'
$CHANGELOG_AUTHORS_TITLE = 'Authors'
$CHANGELOG_AUTHORS_FORMAT = '* {name}\n'

Command

The Command activity class is available via:

from rever.activities.command import Command

Runs a command

Optionally, an undo command can also be given to undo the given command

Note

The recommended way to create a command is with the rever.activities.command.command() function.


CondaForge

The CondaForge activity class is available via:

from rever.activities.conda_forge import CondaForge

Updates conda-forge feedstocks.

The behaviour of this activity may be adjusted through the following environment variables:

$CONDA_FORGE_FEEDSTOCK

str or None, feedstock name or URL, default $PROJECT-feedstock.

$CONDA_FORGE_PROTOCOL

str, one of 'ssh', 'http', or 'https' that specifies how the activity should interact with github when cloning, pulling, or pushing to the feedstock repo. Note that 'ssh' requires you to have an SSH key registered with github. The default is 'ssh'.

$CONDA_FORGE_SOURCE_URL

str, the URL that the recipe will use to download the source code. This is needed so that we may update the hash of the downloaded file. This string is evaluated with the current environment. Default 'https://github.com/$GITHUB_ORG/$GITHUB_REPO/archive/$VERSION.tar.gz'.

$CONDA_FORGE_HASH_TYPE

str, the type of hash that the recipe uses, eg 'md5' or 'sha256'. Default 'sha256'.

$CONDA_FORGE_PATTERNS

list or 3-tuples of str, this is list of (filename, pattern-regex, replacement) tuples that is evaluated inside of the recipe directory. This is similar to the version bump pattern structure. Both the pattern-regex str and the replacement str will have environment variables expanded. The following environment variables are added for this evaluation:

  • $SOURCE_URL: the fully expanded source code URL.

  • $HASH_TYPE: the hash type used to hash $SOURCE_URL.

  • $HASH: the hexdigest of $SOURCE_URL.

The default patterns match most standard recipes.

$CONDA_FORGE_PULL_REQUEST

bool, whether the activity should open a pull request to the upstream conda-forge feestock, default True.

$CONDA_FORGE_RERENDER

bool, whether the activity should rerender the feedstock using conda-smithy, default True.

$CONDA_FORGE_FORK

bool, whether the activity should create a new fork of the feedstock if it doesn’t exist already, default True.

$CONDA_FORGE_FORK_ORG

str, the org to fork the recipe to or which holds the fork, if '' use the registered gh username, defaults to ''

Other environment variables that affect the behavior are:

$GITHUB_CREDFILE

the credential file to use. This should NOT be set in the rever.xsh file

$GITHUB_ORG

the github organization that the project belongs to.

$GITHUB_REPO

the github repository of the project.

$TAG_TEMPLATE

str, the template string used to tag the version, by default this is ‘$VERSION’. Used to download project source.

$PROJECT

the name of the project being released.

$REVER_CONFIG_DIR

the user’s config directory for rever, which is where the GitHub credential files are stored by default.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['conda_forge']

$CONDA_FORGE_FEEDSTOCK = None
$CONDA_FORGE_PROTOCOL = 'ssh'
$CONDA_FORGE_SOURCE_URL = None
$CONDA_FORGE_HASH_TYPE = 'sha256'
$CONDA_FORGE_PATTERNS = (
    ('meta.yaml', '  version:\\s*[A-Za-z0-9._-]+', '  version: "$VERSION"'),
    (
        'meta.yaml',
        '{% set version = ".*" %}',
        '{% set version = "$VERSION" %}',
    ),
    ('meta.yaml', '  number:.*', '  number: 0'),
    (
        'meta.yaml',
        '{% set $HASH_TYPE = "[0-9A-Fa-f]+" %}',
        '{% set $HASH_TYPE = "$HASH" %}',
    ),
    ('meta.yaml', '  $HASH_TYPE:\\s*[0-9A-Fa-f]+', '  $HASH_TYPE: $HASH'),
)
$CONDA_FORGE_PULL_REQUEST = True
$CONDA_FORGE_RERENDER = True
$CONDA_FORGE_FORK = True
$CONDA_FORGE_FORK_ORG = ''

DeploytoGCloud

The DeploytoGCloud activity class is available via:

from rever.activities.gcloud import DeploytoGCloud

Deploys a docker container to the google cloud

This activity may be configured with the following environment variables:

$GCLOUD_PROJECT_ID

str, the gcloud project id

$GCLOUD_CLUSTER

str the kubernetes cluster to deploy to

$GCLOUD_ZONE

str, the gcloud zone

$GCLOUD_CONTAINER_NAME

str, the name of the container image to deploy to

$GCLOUD_DOCKER_HOST

str, the name of the docker host to pull the container from, defaults to docker.io

$GCLOUD_DOCKER_ORG

str, the name of the docker org to pull the container from

$GCLOUD_DOCKER_REPO

str, the name of the docker container repo to use

$VERSION

str, the version of the container to use

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['deploy_to_gcloud']

$DEPLOY_TO_GCLOUD_PROJECT_ID = '$$GCLOUD_PROJECT_ID'
$DEPLOY_TO_GCLOUD_CLUSTER = '$GCLOUD_CLUSTER'
$DEPLOY_TO_GCLOUD_ZONE = '$GCLOUD_ZONE'
$DEPLOY_TO_GCLOUD_CONTAINER_NAME = '$GCLOUD_CONTAINER_NAME'
$DEPLOY_TO_GCLOUD_DOCKER_ORG = '$GCLOUD_DOCKER_ORG'
$DEPLOY_TO_GCLOUD_DOCKER_REPO = '$GCLOUD_DOCKER_REPO'

DeploytoGCloudApp

The DeploytoGCloudApp activity class is available via:

from rever.activities.gcloud import DeploytoGCloudApp

Deploys an app to the google cloud via the app engine

This activity may be configured with the following environment variables:

$GCLOUD_PROJECT_ID

str, the gcloud project id

$GCLOUD_ZONE

str, the gcloud zone

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['deploy_to_gcloud_app']

$DEPLOY_TO_GCLOUD_APP_PROJECT_ID = '$$GCLOUD_PROJECT_ID'
$DEPLOY_TO_GCLOUD_APP_ZONE = '$GCLOUD_ZONE'

DockerBuild

The DockerBuild activity class is available via:

from rever.activities.docker import DockerBuild

Builds a Dockerfile.

The behaviour of this activity may be adjusted through the following environment variables:

$DOCKER_BUILD_PATH

str, path to the Dockerfile, default (None) looks from reads from $DOCKERFILE.

$DOCKER_BUILD_CONTEXT

str, directory to execute the build within. An empty string indicates that the image should be built in directory containing the path. The default (None) reads from $DOCKERFILE_CONTEXT.

$DOCKER_BUILD_TAGS

list of str, Tags the $DOCKERFILE should be built and pushed with. Default (None) reads from $DOCKERFILE_TAGS.

$DOCKER_BUILD_CACHE

bool, Flag for whether or not to use the cache, default False.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['docker_build']

$DOCKER_BUILD_PATH = None
$DOCKER_BUILD_CONTEXT = None
$DOCKER_BUILD_TAGS = None
$DOCKER_BUILD_CACHE = False

DockerPush

The DockerPush activity class is available via:

from rever.activities.docker import DockerPush

Pushes a built Dockerfile.

The behaviour of this activity may be adjusted through the following environment variables:

$DOCKER_PUSH_TAGS

list of str, Tags that the $DOCKERFILE should be built and pushed with. Default (None) reads from $DOCKERFILE_TAGS.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['docker_push']

$DOCKER_PUSH_TAGS = None

GHPages

The GHPages activity class is available via:

from rever.activities.ghpages import GHPages

Activity for pushing documentation up to GitHub pages.

This activity uses the following environment variable:

$GHPAGES_REPO

str, the URL of the GitHUb pages repository.

$GHPAGES_BRANCH

str, the GitHub pages branch name, i.e. either gh-pages or master. If not provided, the activity will attempt to deduce it from the repo name.

$GHPAGES_COPY

list or str 2-tuples, This is a list of (src, dst) pairs of files to copy from the project into the gh-pages repo. These pairs will have environment variables expanded and it is evaluated in the current directory (where rever was run from). src files or directories that don’t exist will be skipped. After variable expansion, this list will be deduplicated. Additionally, the environment variable $GHPAGES_REPO_DIR is added to allow easy access to the local clone of the repo, which is at $REVER_DIR/ghpages-repo. By default, this will look in the sphinx html directory created by the sphinx activity.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['ghpages']

$GHPAGES_REPO = '<no default value>'
$GHPAGES_BRANCH = None
$GHPAGES_COPY = (
    ('$SPHINX_HOST_DIR/html', '$GHPAGES_REPO_DIR'),
    ('$REVER_DIR/sphinx-build/html', '$GHPAGES_REPO_DIR'),
)

GHRelease

The GHRelease activity class is available via:

from rever.activities.ghrelease import GHRelease

Performs a github release.

The behaviour of this activity may be adjusted through the following environment variables:

$GHRELEASE_NAME

str, Name of the release. This is evaluated with the version. Default is $VERSION

$GHRELEASE_NOTES

str or None, Release notes to send to the release page. If None (the default), this is read from $CHANGELOG_LATEST, if present, or failing that $REVER_DIR/LATEST. If neither file exists, an empty string is passes in.

$GHRELEASE_PREPEND

str, string to prepend to the release notes, defaults to ‘’

$GHRELEASE_APPEND

str, string to append to the release notes, defaults to ‘’

$GHRELEASE_ASSETS

iterable of str or functions, Extra assests to upload to the GitHub release. This is ususally a tarball of the source code or a binary package. If the asset is a string, it is interpreted as a filename (and evalauated in the current environment). If the asset is a function, the function is called with no arguments and should return either a string filename or a list of string filenames. The asset functions will usually generate or acquire the asset. By default, this a tarball of the release tag will be uploaded.

Other environment variables that affect the behavior are:

$GITHUB_CREDFILE

the credential file to use.

$GITHUB_ORG

the github organization that the project belongs to.

$GITHUB_REPO

the github repository of the project.

$REVER_CONFIG_DIR

the user’s config directory for rever, which is where the GitHub credential files are stored by default.

$CHANGELOG_LATEST

path to the latest release notes file created by the changelog activity.

$TAG_TEMPLATE

may used to find the tag name when creating the default asset.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['ghrelease']

$GHRELEASE_NAME = '$VERSION'
$GHRELEASE_NOTES = None
$GHRELEASE_PREPEND = ''
$GHRELEASE_APPEND = ''
$GHRELEASE_ASSETS = (<function git_archive_asset at 0x7f8d031f4e60>, )

Nose

The Nose activity class is available via:

from rever.activities.nose import Nose

Runs nose tests inside of a container.

Environment variables that modify this activity’s behaviour are:

$NOSE_COMMAND

str, nose command to execute, defaults to ‘nosetests’.

$NOSE_ARGS

str or list of str, additional arguments to send to the nose command. By default no additional arguments are sent.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['nose']

$NOSE_COMMAND = 'nosetests'
$NOSE_ARGS = ()

PushTag

The PushTag activity class is available via:

from rever.activities.push_tag import PushTag

Pushes the current tag up to a remote repository.

This activity takes the following parameters:

$PUSH_TAG_REMOTE

str or None, remote URL to push tags to. If $REVER_VCS is set to 'git' and both $GITHUB_ORG and $GITHUB_REPO are also set, this variable will default to git@github.com:$GITHUB_ORG/$GITHUB_REPO.git.

$PUSH_TAG_TARGET

str or None, remote branch to push to once the tag has been made. The default is None, which uses the current branch.

$PUSH_TAG_PROTOCOL

str or None, the protocol to use to for the push, if None, use ssh. Available protocols are http, https, and ssh

Other environment variables that affect the behavior are:

$REVER_VCS

str or None, is used to help specify default remote URLs.

$GITHUB_ORG

str or None, GitHub org to push to if no $PUSH_TAG_REMOTE

$GITHUB_REPO

str or None GitHub repo to push to if no $PUSH_TAG_REMOTE

$TAG_TEMPLATE

str, the template string to tag the version with, by default this is ‘$VERSION’. This is used in undoing remote tags

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['push_tag']

$PUSH_TAG_REMOTE = None
$PUSH_TAG_TARGET = None
$PUSH_TAG_PROTOCOL = None

PyPI

The PyPI activity class is available via:

from rever.activities.pypi import PyPI

Uploads a package to the Python Package Index.

The behaviour of this activity may be adjusted through the following environment variables:

$PYPI_RC

str, path to the pypirc file, default ~/.pypirc.

$PYPI_BUILD_COMMANDS

list of str, The commands to run in setup.py that will build the project, default ['sdist']. Other examples include 'bdist' or 'bdist_wininst'.

$PYPI_UPLOAD

bool, whether or not to upload PyPI, default True.

$PYPI_NAME

str or None, The name of the package on PyPI. If None, This will default to the result of python setup.py --name

$PYPI_SIGN

bool or None, whether the packages should be signed (with gpg) when uploaded. If None (default), packages will be signed if a gpg key is available and skipped otherwise.

Other environment variables that affect the behavior are:

$PYTHON

the path to the Python interpreter.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['pypi']

$PYPI_RC = '$HOME/.pypirc'
$PYPI_BUILD_COMMANDS = ('sdist', )
$PYPI_UPLOAD = True
$PYPI_NAME = None
$PYPI_SIGN = None

PyTest

The PyTest activity class is available via:

from rever.activities.pytest import PyTest

Runs pytest inside of a container.

The environment variable that affects the behaviour of this activity is:

$PYTEST_COMMAND

str, the test command to run. The defaults to 'pytest'.

Additionally, the $DOCKER_* environment variables will affect the behaviour of the conatiner that is used for testing.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['pytest']

$PYTEST_COMMAND = 'pytest'

Sphinx

The Sphinx activity class is available via:

from rever.activities.sphinx import Sphinx

Runs sphinx inside of a container.

Environment variables that modify this activity’s behaviour are:

$SPHINX_DOCS_DIR

str, the directory in the container that is the root of the documentation. This must be an absolute path. Defaults to '$DOCKER_HOME/$PROJECT/docs'.

$SPHINX_HOST_DIR

str, the directory on the host (ie outside of the container to place the built docs in, default '$REVER_DIR/sphinx-build'.

$SPHINX_BUILD_DIR

str, the directory in the container where sphinx will build the docs, default '{docs_dir}/_build'. If '{docs_dir}' is present in the string, then the string will be formated with the value of $SPHINX_DOCS_DIR. Otherwise, enviroment variables will be expanded.

$SPHINX_OPTS

str or list of str, Additional options to provide to the sphinx builders. Default to no extra options.

$SPHINX_PAPER

str, The paper size to use in latex. Maybe '', 'a4', 'letter', or similar. Defaults to an empty string, which disables this option.

$SPHINX_BUILDER

list of str, The build targets that sphinx should construct. This defaults to ['html'].

As a dockerized activity, the docker environment variables affect the execution of the sphinx activity.

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['sphinx']

$SPHINX_DOCS_DIR = '$DOCKER_HOME/$PROJECT/docs'
$SPHINX_HOST_DIR = '$REVER_DIR/sphinx-build'
$SPHINX_BUILD_DIR = '{docs_dir}/_build'
$SPHINX_OPTS = ()
$SPHINX_PAPER = ''
$SPHINX_BUILDERS = ('html', )

Tag

The Tag activity class is available via:

from rever.activities.tag import Tag

Locally tags the current version.

This activity takes the following parameters:

$TAG_TEMPLATE

str, the template string to tag the version with, by default this is ‘$VERSION’

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['tag']

$TAG_TEMPLATE = '$VERSION'

VersionBump

The VersionBump activity class is available via:

from rever.activities.version_bump import VersionBump

Changes the version to the value of $VERSION.

This activity is parameterized by the following environment variable:

$VERSION_BUMP_PATTERNS

list of 3-tuples of str, This activity is only usefule if replacement patterns are supplied to it. This argument is an iterable of 3-tuples consisting of:

  • filename, str - file to update the version in

  • pattern, str - A Python regular expression that specifies how to find matching lines for the replacement string. Leading whitespace will be captured and replaced. The pattern here can start at the first non-whitespace character.

  • new, str or function returning a string - the replacement template as a string or a simple callable that accepts the version. If it is a string, it is expanded with environment variables.

For example:

$VERSION_BUMP_PATTERNS = [
    # replace __version__ in init file
    ('src/__init__.py', r'__version__\s*=.*', "__version__ = '$VERSION'"),

    # replace version in appveyor
    ('.appveyor.yml', r'version:\s*',
      (lambda ver: 'version: {0}.{{build}}'.format(ver))),
  ...
]

This activity’s defaults are equivalent to the following rever.xsh file:

$ACTIVITIES = ['version_bump']

$VERSION_BUMP_PATTERNS = ()