conda_recipe_manager.ops.version_bumper#

Description:

Provides library tooling to perform recipe version updates or recipe "bumps". Most of the work found here originates from the crm bump-recipe command line interface.

Classes

VersionBumper(recipe_path[, options])

Library class that simplifies the process of upgrading a recipe file to a new version.

VersionBumperOption(value)

Set of flags that dictate how the VersionBumper class operates.

class conda_recipe_manager.ops.version_bumper.VersionBumper(recipe_path: Path | str, options: VersionBumperOption | None = None)[source]#

Bases: object

Library class that simplifies the process of upgrading a recipe file to a new version. This class handles file I/O and will commit changes directly to a target recipe file. It also handles acquiring and managing remote source artifacts specified in the /source section of the target recipe file.

This work was all originally found in the crm bump-recipe command and has been refactored into its own library module for easier consumption by other automated systems.

commit_changes() None[source]#

Saves the current recipe state to the target recipe file OR prints the contents of the file to STDOUT when the VersionBumperOption.DRY_RUN_MODE option is enabled.

get_recipe_reader() RecipeReaderDeps[source]#

Exposes the underlying recipe parser instance for read-only access to a recipe file. This can help bootstrap the factory functions found the conda_recipe_manager.fetcher.artifact_fetcher module

NOTE: Read-only capabilities are enforced by type-checkers (like mypy) only.

Returns:

A read-only recipe parser instance.

update_build_num(build_num: int | None) None[source]#

Attempts to update the build number in a recipe file.

Parameters:

build_num -- Build number to set. When set to None, this auto-increments the current build number. Otherwise, this value must be a >= 0.

Raises:
update_http_urls(futures_tbl: dict[Future[tuple[BaseArtifactFetcher, str | None]], str]) None[source]#

Updates any outdated URLs found in the recipe file. Should be used in conjunction with from_recipe_fetch_corrected(), which attempts to flag outdated URLs and find their replacement URLs.

NOTE: Most of the URLs updated are tied to changes made by PyPI over the years, including a significant change

to the package naming conventions made in 2024.

NOTE: This function will block on network I/O.

Parameters:

futures_tbl -- Table of future fetchers, generated by one of the factory functions found in the conda_recipe_manager.fetcher.artifact_fetcher module.

Raises:
update_sha256(futures_tbl: dict[Future[tuple[BaseArtifactFetcher, str | None]], str]) None[source]#

Attempts to update the SHA-256 hash(s) in the /source section of a recipe file, if applicable. Note that this is only required for build artifacts that are hosted as compressed software archives.

NOTE: This function will block on network I/O. NOTE: For this to make any meaningful changes, the version field will need to be updated first.

Parameters:

futures_tbl -- Table of future fetchers, generated by one of the factory functions found in the conda_recipe_manager.fetcher.artifact_fetcher module.

Raises:
update_version(target_version: str) None[source]#

Attempts to update the /package/version field and/or the commonly used version JINJA variable.

Parameters:

target_version -- Target version string to set the recipe file to. Must be non-empty and this must be different than the current version string.

Raises:
class conda_recipe_manager.ops.version_bumper.VersionBumperOption(value)[source]#

Bases: Flag

Set of flags that dictate how the VersionBumper class operates.

COMMIT_ON_FAILURE = 1#
DRY_RUN_MODE = 2#
NONE = 0#
OMIT_TRAILING_NEW_LINE = 4#