Configuration¶
Bump My Version looks in three places for configuration information (in order of precedence):
- command line
- configuration file
- environment variables
Configuration files¶
Bump My Version looks in four places for the configuration file to parse (in order of precedence):
--config-file <FILE>(command line argument)BUMPVERSION_CONFIG_FILE=file(environment variable).bumpversion.cfg(legacy).bumpversion.tomlsetup.cfg(legacy)pyproject.toml
Items 3-6 are searched for in the current directory, then, when inside a git or mercurial repository, in each parent directory up to the repository root. The nearest directory containing a configuration file wins. Outside a repository, only the current directory is searched.
A .toml file counts as a configuration file when it is valid TOML and contains a [tool.bumpversion] table. A table that only holds [[tool.bumpversion.files]] is enough. Invalid TOML is skipped, not reported as an error. .cfg files must contain a bumpversion section.
If no file with Bump My Version configuration is found, the nearest pyproject.toml with a static project.version (PEP 621) is used instead, and that version becomes the current version. A pyproject.toml that lists version in project.dynamic is ignored.
.toml files are recommended. We will likely drop support for ini-style formats in the future. You should add your configuration file to your source code management system.
By using a configuration file, you no longer need to specify those options on the command line. The configuration file also allows greater flexibility in specifying how files are modified.