bumpversion.bump
Version changing methods.
logger
python
logger = get_indented_logger(__name__)get_next_version
python
def get_next_version(current_version: Version, config: Config, version_part: Optional[str], new_version: Optional[str], to_value: Optional[str] = None) -> VersionBump the version_part to the next value.
Parameters
current_version: The current versionconfig: The current configurationversion_part: Optional part of the version to bumpnew_version: Optional specific version to bump toto_value: Optional specific value to setversion_partto
Returns
- The new version
Raises
ConfigurationError: If it can't generate the next version.
do_bump
python
def do_bump(version_part: Optional[str], new_version: Optional[str], config: Config, config_file: Optional[Path] = None, dry_run: bool = False, to_value: Optional[str] = None) -> NoneBump the version_part to the next value or set the version to new_version.
Parameters
version_part: The name of the version component to bumpnew_version: The explicit version to setconfig: The configuration to useconfig_file: The configuration file to updatedry_run: True if the operation should be a dry runto_value: The explicit value to setversion_partto instead of incrementing it
commit_and_tag
python
def commit_and_tag(config: Config, config_file: Optional[Path], configured_files: List[ConfiguredFile], ctx: MutableMapping, dry_run: bool = False) -> NoneCommit and tag the changes if a tool is configured.
Parameters
config: The configurationconfig_file: The configuration file to include in the commit if it existsconfigured_files: A list of files to commitctx: The context used to render the tag and tag messagedry_run: True if the operation should be a dry run