plugins.aea-dev-helpers.aea_dev_helpers.bump_version
Bump the AEA version throughout the code base.
This module contains the logic originally in scripts/bump_aea_version.py.
Example usage from the CLI wrapper::
bump_aea_version --new-version 1.1.0 \\
-p open-aea-ledger-fetchai=2.0.0 \\
-p open-aea-ledger-ethereum=3.0.0
bump_aea_version --only-check
ALL_PLUGINS
This pattern captures a specifier set in the dependencies section of an AEA package configuration file, e.g.:
dependencies: ... open-aea-ledger-fetchai: version: >=2.0.0,<3.0.0
YAML_DEPENDENCY_SPECIFIER_SET_PATTERN
This pattern captures a specifier set for PyPI dependencies in JSON format.
e.g.: "open-aea-ledger-fetchai": {"version": ">=2.0.0, <3.0.0"}
check_executed
def check_executed(func: Callable) -> Callable
Check a functor has been already executed; if yes, raise error.
compute_specifier_from_version_custom
def compute_specifier_from_version_custom(version: Version) -> str
Post-process aea.helpers.compute_specifier_from_version
The output is post-process in the following way: - remove spaces between specifier sets - put upper bound before lower bound
Arguments:
version: the version
Returns:
the specifier set according to the version and semantic versioning.
get_regex_from_specifier_set
def get_regex_from_specifier_set(specifier_set: str) -> str
Get the regex for specifier sets.
This function accepts input of the form:
">={lower_bound_version}, <{upper_bound_version}"
And computes a regex pattern:
">={lower_bound_version}, *<{upper_bound_version}|<{upper_bound_version}, *>={lower_bound_version}"
i.e. not considering the order of the specifiers.
Arguments:
specifier_set: The string representation of the specifier set
Returns:
a regex pattern
PythonPackageVersionBumper Objects
class PythonPackageVersionBumper()
Utility class to bump Python package versions.
__init__
def __init__(root_dir: Path,
python_pkg_dir: Path,
new_version: Version,
files_to_pattern: PatternByPath,
specifier_set_patterns: Sequence[str],
package_name: Optional[str] = None,
ignore_dirs: Sequence[Path] = ())
Initialize the utility class.
Arguments:
root_dir: the root directory from which to look for files.python_pkg_dir: the path to the Python package to upgrade.new_version: the new version.files_to_pattern: a list of pairs.specifier_set_patterns: a list of patterns for specifier sets.package_name: the Python package name aliases (defaults to dirname of python_pkg_dir).ignore_dirs: a list of paths to ignore during the substitution.
is_executed
@property
def is_executed() -> bool
Return true if the functor has been executed; false otherwise.
Returns:
True if it has been executed, False otherwise.
result
@property
def result() -> bool
Get the result.
run
@check_executed
def run() -> bool
Main entrypoint.
update_version_for_files
def update_version_for_files() -> None
Update the version.
update_version_for_package
def update_version_for_package(new_version: str) -> str
Update version for file.
If version.py is available, parse it and check for version variable. Otherwise, try to parse setup.py. Otherwise, raise error.
Arguments:
new_version: the new version
Returns:
the current version
update_version_for_file
def update_version_for_file(
path: Path,
current_version: str,
new_version: str,
version_regex_template: Optional[str] = None) -> None
Update version for file.
Arguments:
path: the file pathcurrent_version: the regex for the current versionnew_version: the new versionversion_regex_template: the regex template to replace with the current version. Defaults to exactly the current version.
update_version_specifiers
def update_version_specifiers(old_version: Version,
new_version: Version) -> bool
Update specifier set.
Arguments:
old_version: the old version.new_version: the new version.
Returns:
True if the update has been done, False otherwise.
is_different_from_latest_tag
def is_different_from_latest_tag() -> bool
Check whether the package has changes since the latest tag.
make_aea_bumper
def make_aea_bumper(new_aea_version: Version) -> PythonPackageVersionBumper
Build the AEA Python package version bumper.
make_plugin_bumper
def make_plugin_bumper(plugin_dir: Path,
new_version: Version) -> PythonPackageVersionBumper
Build the plugin Python package version bumper.
process_plugins
def process_plugins(new_versions: Dict[str, Version]) -> bool
Process plugins.
parse_plugin_versions
def parse_plugin_versions(key_value_strings: List[str]) -> Dict[str, Version]
Parse plugin versions.
only_check_bump_needed
def only_check_bump_needed() -> int
Check whether a version bump is needed for AEA and plugins.
Returns:
the return code
bump
def bump(new_version: Optional[str], plugin_new_version: List[str],
no_fingerprints: bool) -> int
Bump versions.
Arguments:
new_version: the new AEA version string (or None to skip AEA bump).plugin_new_version: list ofplugin-name=versionstrings.no_fingerprints: if True, skip fingerprint computation.
Returns:
the return code
run_bump
def run_bump(new_version: Optional[str] = None,
plugin_new_version: Optional[List[str]] = None,
no_fingerprints: bool = False,
only_check: bool = False) -> None
Run the bump-aea-version workflow.
This is the main entry point intended to be called from a CLI wrapper.
Arguments:
new_version: the new AEA version string (or None).plugin_new_version: list ofplugin-name=versionstrings.no_fingerprints: if True, skip fingerprint computation.only_check: if True, only check whether a bump is needed.