diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f48b94ce..8c5aa362 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: hooks: - id: mypy args: [--no-strict-optional, --ignore-missing-imports] - additional_dependencies: ["pydantic", "toml", "types-all"] + additional_dependencies: ["pydantic<2.0", "toml", "types-all"] - repo: https://github.com/terrencepreilly/darglint rev: v1.8.1 hooks: diff --git a/bumpversion/cli.py b/bumpversion/cli.py index 411c8ce7..fdbf6d75 100644 --- a/bumpversion/cli.py +++ b/bumpversion/cli.py @@ -9,9 +9,10 @@ from bumpversion.aliases import AliasedGroup from bumpversion.bump import do_bump from bumpversion.config import find_config_file, get_configuration +from bumpversion.files import modify_files, resolve_file_config from bumpversion.logging import setup_logging from bumpversion.show import do_show, log_list -from bumpversion.utils import get_overrides +from bumpversion.utils import get_context, get_overrides logger = logging.getLogger(__name__) @@ -290,3 +291,156 @@ def show(args: List[str], config_file: Optional[str], format_: str, increment: O do_show("all", config=config, format_=format_, increment=increment) else: do_show(*args, config=config, format_=format_, increment=increment) + + +@cli.command() +@click.argument("files", nargs=-1, type=str) +@click.option( + "--config-file", + metavar="FILE", + required=False, + envvar="BUMPVERSION_CONFIG_FILE", + type=click.Path(exists=True), + help="Config file to read most of the variables from.", +) +@click.option( + "-v", + "--verbose", + count=True, + required=False, + envvar="BUMPVERSION_VERBOSE", + help="Print verbose logging to stderr. Can specify several times for more verbosity.", +) +@click.option( + "--allow-dirty/--no-allow-dirty", + default=None, + required=False, + envvar="BUMPVERSION_ALLOW_DIRTY", + help="Don't abort if working directory is dirty, or explicitly abort if dirty.", +) +@click.option( + "--current-version", + metavar="VERSION", + required=False, + envvar="BUMPVERSION_CURRENT_VERSION", + help="Version that needs to be updated", +) +@click.option( + "--new-version", + metavar="VERSION", + required=False, + envvar="BUMPVERSION_NEW_VERSION", + help="New version that should be in the files. If not specified, it will be None.", +) +@click.option( + "--parse", + metavar="REGEX", + required=False, + envvar="BUMPVERSION_PARSE", + help="Regex parsing the version string", +) +@click.option( + "--serialize", + metavar="FORMAT", + multiple=True, + required=False, + envvar="BUMPVERSION_SERIALIZE", + help="How to format what is parsed back to a version", +) +@click.option( + "--search", + metavar="SEARCH", + required=False, + envvar="BUMPVERSION_SEARCH", + help="Template for complete string to search", +) +@click.option( + "--replace", + metavar="REPLACE", + required=False, + envvar="BUMPVERSION_REPLACE", + help="Template for complete string to replace", +) +@click.option( + "--no-configured-files", + is_flag=True, + envvar="BUMPVERSION_NO_CONFIGURED_FILES", + help=( + "Only replace the version in files specified on the command line, " + "ignoring the files from the configuration file." + ), +) +@click.option( + "--dry-run", + "-n", + is_flag=True, + envvar="BUMPVERSION_DRY_RUN", + help="Don't write any files, just pretend.", +) +def replace( + files: list, + config_file: Optional[str], + verbose: int, + allow_dirty: Optional[bool], + current_version: Optional[str], + new_version: Optional[str], + parse: Optional[str], + serialize: Optional[List[str]], + search: Optional[str], + replace: Optional[str], + no_configured_files: bool, + dry_run: bool, +) -> None: + """ + Replace the version in files. + + FILES are additional file(s) to modify. + If you want to rewrite only files specified on the command line, use with the + `--no-configured-files` option. + """ + setup_logging(verbose) + + logger.info("Starting BumpVersion %s", __version__) + + overrides = get_overrides( + allow_dirty=allow_dirty, + current_version=current_version, + new_version=new_version, + parse=parse, + serialize=serialize or None, + search=search, + replace=replace, + commit=False, + tag=False, + sign_tags=False, + tag_name=None, + tag_message=None, + message=None, + commit_args=None, + ) + + found_config_file = find_config_file(config_file) + config = get_configuration(found_config_file, **overrides) + + config.allow_dirty = allow_dirty if allow_dirty is not None else config.allow_dirty + if not config.allow_dirty and config.scm_info.tool: + config.scm_info.tool.assert_nondirty() + + if no_configured_files: + config.files = [] + + if files: + config.add_files(files) + + version = config.version_config.parse(config.current_version) + + if new_version: + next_version = config.version_config.parse(new_version) + else: + next_version = None + + ctx = get_context(config, version, next_version) + + configured_files = resolve_file_config(config.files, config.version_config) + + modify_files(configured_files, version, next_version, ctx, dry_run) diff --git a/docsrc/api.rst b/docsrc/api.rst deleted file mode 100644 index 1377dfc2..00000000 --- a/docsrc/api.rst +++ /dev/null @@ -1,9 +0,0 @@ -API Reference -============= - -.. currentmodule:: bump_version - -.. autosummary:: - :toctree: _autosummary - :nosignatures: - :recursive: diff --git a/docsrc/conf.py b/docsrc/conf.py index 2d7e3c02..5f4c25d1 100644 --- a/docsrc/conf.py +++ b/docsrc/conf.py @@ -21,7 +21,8 @@ extensions = [ "myst_parser", - "sphinx.ext.autodoc", + "autodoc2", + # "sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.autosummary", "sphinx.ext.intersphinx", @@ -36,6 +37,11 @@ autosectionlabel_prefix_document = True autosectionlabel_maxdepth = 2 +autodoc2_packages = ["../bumpversion"] +autodoc2_render_plugin = "myst" +autodoc2_output_dir = "reference" +autodoc2_index_template = None + autodoc_default_flags = [ # Make sure that any autodoc declarations show the right members "members", diff --git a/docsrc/explanation/index.md b/docsrc/explanation/index.md new file mode 100644 index 00000000..b1c54c3a --- /dev/null +++ b/docsrc/explanation/index.md @@ -0,0 +1,4 @@ +# Explanation + +```{toctree} +``` diff --git a/docsrc/howtos/index.md b/docsrc/howtos/index.md new file mode 100644 index 00000000..3753fa65 --- /dev/null +++ b/docsrc/howtos/index.md @@ -0,0 +1,6 @@ +# How-To Guides + + + +```{toctree} +``` diff --git a/docsrc/index.md b/docsrc/index.md index 5582a61d..676e119c 100644 --- a/docsrc/index.md +++ b/docsrc/index.md @@ -1,4 +1,4 @@ -# Bump My Version's documentation +# Bump My Version ```{toctree} --- @@ -7,12 +7,10 @@ caption: Contents --- Introduction usage -configuration -version-parts -formatting-context -search-and-replace -cli -api +tutorials/index +howtos/index +reference/index +explanation/index contributing changelog ``` diff --git a/docsrc/reference/bumpversion/bumpversion.__main__.md b/docsrc/reference/bumpversion/bumpversion.__main__.md new file mode 100644 index 00000000..a504d450 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.__main__.md @@ -0,0 +1,8 @@ +# {py:mod}`bumpversion.__main__` + +```{py:module} bumpversion.__main__ +``` + +```{autodoc2-docstring} bumpversion.__main__ +:allowtitles: +``` diff --git a/docsrc/reference/bumpversion/bumpversion.aliases.md b/docsrc/reference/bumpversion/bumpversion.aliases.md new file mode 100644 index 00000000..97cec39b --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.aliases.md @@ -0,0 +1,56 @@ +# {py:mod}`bumpversion.aliases` + +```{py:module} bumpversion.aliases +``` + +```{autodoc2-docstring} bumpversion.aliases +:allowtitles: +``` + +## Module Contents + +### Classes + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`AliasedGroup ` + - ```{autodoc2-docstring} bumpversion.aliases.AliasedGroup + :summary: + ``` +```` + +### API + +`````{py:class} AliasedGroup(name: typing.Optional[str] = None, commands: typing.Optional[typing.Union[typing.Dict[str, click.core.Command], typing.Sequence[click.core.Command]]] = None, **attrs: typing.Any) +:canonical: bumpversion.aliases.AliasedGroup + +Bases: {py:obj}`rich_click.rich_group.RichGroup` + +```{autodoc2-docstring} bumpversion.aliases.AliasedGroup +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.aliases.AliasedGroup.__init__ +``` + +````{py:method} get_command(ctx: click.Context, cmd_name: str) -> typing.Optional[rich_click.Command] +:canonical: bumpversion.aliases.AliasedGroup.get_command + +```{autodoc2-docstring} bumpversion.aliases.AliasedGroup.get_command +``` + +```` + +````{py:method} resolve_command(ctx: click.Context, args: typing.List[str]) -> tuple +:canonical: bumpversion.aliases.AliasedGroup.resolve_command + +```{autodoc2-docstring} bumpversion.aliases.AliasedGroup.resolve_command +``` + +```` + +````` diff --git a/docsrc/reference/bumpversion/bumpversion.autocast.md b/docsrc/reference/bumpversion/bumpversion.autocast.md new file mode 100644 index 00000000..f08afbbe --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.autocast.md @@ -0,0 +1,64 @@ +# {py:mod}`bumpversion.autocast` + +```{py:module} bumpversion.autocast +``` + +```{autodoc2-docstring} bumpversion.autocast +:allowtitles: +``` + +## Module Contents + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`boolify ` + - ```{autodoc2-docstring} bumpversion.autocast.boolify + :summary: + ``` +* - {py:obj}`noneify ` + - ```{autodoc2-docstring} bumpversion.autocast.noneify + :summary: + ``` +* - {py:obj}`listify ` + - ```{autodoc2-docstring} bumpversion.autocast.listify + :summary: + ``` +* - {py:obj}`autocast_value ` + - ```{autodoc2-docstring} bumpversion.autocast.autocast_value + :summary: + ``` +```` + +### API + +````{py:function} boolify(s: str) -> bool +:canonical: bumpversion.autocast.boolify + +```{autodoc2-docstring} bumpversion.autocast.boolify +``` +```` + +````{py:function} noneify(s: str) -> None +:canonical: bumpversion.autocast.noneify + +```{autodoc2-docstring} bumpversion.autocast.noneify +``` +```` + +````{py:function} listify(s: str) -> list +:canonical: bumpversion.autocast.listify + +```{autodoc2-docstring} bumpversion.autocast.listify +``` +```` + +````{py:function} autocast_value(var: typing.Any) -> typing.Any +:canonical: bumpversion.autocast.autocast_value + +```{autodoc2-docstring} bumpversion.autocast.autocast_value +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.bump.md b/docsrc/reference/bumpversion/bumpversion.bump.md new file mode 100644 index 00000000..b42e31c7 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.bump.md @@ -0,0 +1,75 @@ +# {py:mod}`bumpversion.bump` + +```{py:module} bumpversion.bump +``` + +```{autodoc2-docstring} bumpversion.bump +:allowtitles: +``` + +## Module Contents + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`get_next_version ` + - ```{autodoc2-docstring} bumpversion.bump.get_next_version + :summary: + ``` +* - {py:obj}`do_bump ` + - ```{autodoc2-docstring} bumpversion.bump.do_bump + :summary: + ``` +* - {py:obj}`commit_and_tag ` + - ```{autodoc2-docstring} bumpversion.bump.commit_and_tag + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`logger ` + - ```{autodoc2-docstring} bumpversion.bump.logger + :summary: + ``` +```` + +### API + +````{py:data} logger +:canonical: bumpversion.bump.logger +:value: > + None + +```{autodoc2-docstring} bumpversion.bump.logger +``` + +```` + +````{py:function} get_next_version(current_version: bumpversion.version_part.Version, config: bumpversion.config.Config, version_part: typing.Optional[str], new_version: typing.Optional[str]) -> bumpversion.version_part.Version +:canonical: bumpversion.bump.get_next_version + +```{autodoc2-docstring} bumpversion.bump.get_next_version +``` +```` + +````{py:function} do_bump(version_part: typing.Optional[str], new_version: typing.Optional[str], config: bumpversion.config.Config, config_file: typing.Optional[pathlib.Path] = None, dry_run: bool = False) -> None +:canonical: bumpversion.bump.do_bump + +```{autodoc2-docstring} bumpversion.bump.do_bump +``` +```` + +````{py:function} commit_and_tag(config: bumpversion.config.Config, config_file: typing.Optional[pathlib.Path], configured_files: typing.List[bumpversion.files.ConfiguredFile], ctx: typing.ChainMap, dry_run: bool = False) -> None +:canonical: bumpversion.bump.commit_and_tag + +```{autodoc2-docstring} bumpversion.bump.commit_and_tag +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.cli.md b/docsrc/reference/bumpversion/bumpversion.cli.md new file mode 100644 index 00000000..6719d7f9 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.cli.md @@ -0,0 +1,86 @@ +# {py:mod}`bumpversion.cli` + +```{py:module} bumpversion.cli +``` + +```{autodoc2-docstring} bumpversion.cli +:allowtitles: +``` + +## Module Contents + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`cli ` + - ```{autodoc2-docstring} bumpversion.cli.cli + :summary: + ``` +* - {py:obj}`bump ` + - ```{autodoc2-docstring} bumpversion.cli.bump + :summary: + ``` +* - {py:obj}`show ` + - ```{autodoc2-docstring} bumpversion.cli.show + :summary: + ``` +* - {py:obj}`replace ` + - ```{autodoc2-docstring} bumpversion.cli.replace + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`logger ` + - ```{autodoc2-docstring} bumpversion.cli.logger + :summary: + ``` +```` + +### API + +````{py:data} logger +:canonical: bumpversion.cli.logger +:value: > + None + +```{autodoc2-docstring} bumpversion.cli.logger +``` + +```` + +````{py:function} cli(ctx: click.core.Context) -> None +:canonical: bumpversion.cli.cli + +```{autodoc2-docstring} bumpversion.cli.cli +``` +```` + +````{py:function} bump(args: list, config_file: typing.Optional[str], verbose: int, allow_dirty: typing.Optional[bool], current_version: typing.Optional[str], new_version: typing.Optional[str], parse: typing.Optional[str], serialize: typing.Optional[typing.List[str]], search: typing.Optional[str], replace: typing.Optional[str], no_configured_files: bool, dry_run: bool, commit: typing.Optional[bool], tag: typing.Optional[bool], sign_tags: typing.Optional[bool], tag_name: typing.Optional[str], tag_message: typing.Optional[str], message: typing.Optional[str], commit_args: typing.Optional[str], show_list: bool) -> None +:canonical: bumpversion.cli.bump + +```{autodoc2-docstring} bumpversion.cli.bump +``` +```` + +````{py:function} show(args: typing.List[str], config_file: typing.Optional[str], format_: str, increment: typing.Optional[str]) -> None +:canonical: bumpversion.cli.show + +```{autodoc2-docstring} bumpversion.cli.show +``` +```` + +````{py:function} replace(files: list, config_file: typing.Optional[str], verbose: int, allow_dirty: typing.Optional[bool], current_version: typing.Optional[str], new_version: typing.Optional[str], parse: typing.Optional[str], serialize: typing.Optional[typing.List[str]], search: typing.Optional[str], replace: typing.Optional[str], no_configured_files: bool, dry_run: bool) -> None +:canonical: bumpversion.cli.replace + +```{autodoc2-docstring} bumpversion.cli.replace +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.config.md b/docsrc/reference/bumpversion/bumpversion.config.md new file mode 100644 index 00000000..75f8c67d --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.config.md @@ -0,0 +1,529 @@ +# {py:mod}`bumpversion.config` + +```{py:module} bumpversion.config +``` + +```{autodoc2-docstring} bumpversion.config +:allowtitles: +``` + +## Module Contents + +### Classes + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`VersionPartConfig ` + - ```{autodoc2-docstring} bumpversion.config.VersionPartConfig + :summary: + ``` +* - {py:obj}`FileConfig ` + - ```{autodoc2-docstring} bumpversion.config.FileConfig + :summary: + ``` +* - {py:obj}`Config ` + - ```{autodoc2-docstring} bumpversion.config.Config + :summary: + ``` +```` + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`get_configuration ` + - ```{autodoc2-docstring} bumpversion.config.get_configuration + :summary: + ``` +* - {py:obj}`get_all_part_configs ` + - ```{autodoc2-docstring} bumpversion.config.get_all_part_configs + :summary: + ``` +* - {py:obj}`check_current_version ` + - ```{autodoc2-docstring} bumpversion.config.check_current_version + :summary: + ``` +* - {py:obj}`find_config_file ` + - ```{autodoc2-docstring} bumpversion.config.find_config_file + :summary: + ``` +* - {py:obj}`read_config_file ` + - ```{autodoc2-docstring} bumpversion.config.read_config_file + :summary: + ``` +* - {py:obj}`read_ini_file ` + - ```{autodoc2-docstring} bumpversion.config.read_ini_file + :summary: + ``` +* - {py:obj}`read_toml_file ` + - ```{autodoc2-docstring} bumpversion.config.read_toml_file + :summary: + ``` +* - {py:obj}`update_config_file ` + - ```{autodoc2-docstring} bumpversion.config.update_config_file + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`logger ` + - ```{autodoc2-docstring} bumpversion.config.logger + :summary: + ``` +* - {py:obj}`DEFAULTS ` + - ```{autodoc2-docstring} bumpversion.config.DEFAULTS + :summary: + ``` +* - {py:obj}`CONFIG_FILE_SEARCH_ORDER ` + - ```{autodoc2-docstring} bumpversion.config.CONFIG_FILE_SEARCH_ORDER + :summary: + ``` +```` + +### API + +````{py:data} logger +:canonical: bumpversion.config.logger +:value: > + None + +```{autodoc2-docstring} bumpversion.config.logger +``` + +```` + +`````{py:class} VersionPartConfig +:canonical: bumpversion.config.VersionPartConfig + +Bases: {py:obj}`pydantic.BaseModel` + +```{autodoc2-docstring} bumpversion.config.VersionPartConfig +``` + +````{py:attribute} values +:canonical: bumpversion.config.VersionPartConfig.values +:type: typing.Optional[list] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.VersionPartConfig.values +``` + +```` + +````{py:attribute} optional_value +:canonical: bumpversion.config.VersionPartConfig.optional_value +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.VersionPartConfig.optional_value +``` + +```` + +````{py:attribute} first_value +:canonical: bumpversion.config.VersionPartConfig.first_value +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.VersionPartConfig.first_value +``` + +```` + +````{py:attribute} independent +:canonical: bumpversion.config.VersionPartConfig.independent +:type: bool +:value: > + False + +```{autodoc2-docstring} bumpversion.config.VersionPartConfig.independent +``` + +```` + +````` + +`````{py:class} FileConfig +:canonical: bumpversion.config.FileConfig + +Bases: {py:obj}`pydantic.BaseModel` + +```{autodoc2-docstring} bumpversion.config.FileConfig +``` + +````{py:attribute} filename +:canonical: bumpversion.config.FileConfig.filename +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.FileConfig.filename +``` + +```` + +````{py:attribute} glob +:canonical: bumpversion.config.FileConfig.glob +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.FileConfig.glob +``` + +```` + +````{py:attribute} parse +:canonical: bumpversion.config.FileConfig.parse +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.FileConfig.parse +``` + +```` + +````{py:attribute} serialize +:canonical: bumpversion.config.FileConfig.serialize +:type: typing.Optional[typing.List[str]] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.FileConfig.serialize +``` + +```` + +````{py:attribute} search +:canonical: bumpversion.config.FileConfig.search +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.FileConfig.search +``` + +```` + +````{py:attribute} replace +:canonical: bumpversion.config.FileConfig.replace +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.FileConfig.replace +``` + +```` + +````` + +``````{py:class} Config +:canonical: bumpversion.config.Config + +Bases: {py:obj}`pydantic.BaseSettings` + +```{autodoc2-docstring} bumpversion.config.Config +``` + +````{py:attribute} current_version +:canonical: bumpversion.config.Config.current_version +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.current_version +``` + +```` + +````{py:attribute} parse +:canonical: bumpversion.config.Config.parse +:type: str +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.parse +``` + +```` + +````{py:attribute} serialize +:canonical: bumpversion.config.Config.serialize +:type: typing.List[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.serialize +``` + +```` + +````{py:attribute} search +:canonical: bumpversion.config.Config.search +:type: str +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.search +``` + +```` + +````{py:attribute} replace +:canonical: bumpversion.config.Config.replace +:type: str +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.replace +``` + +```` + +````{py:attribute} tag +:canonical: bumpversion.config.Config.tag +:type: bool +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.tag +``` + +```` + +````{py:attribute} sign_tags +:canonical: bumpversion.config.Config.sign_tags +:type: bool +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.sign_tags +``` + +```` + +````{py:attribute} tag_name +:canonical: bumpversion.config.Config.tag_name +:type: str +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.tag_name +``` + +```` + +````{py:attribute} tag_message +:canonical: bumpversion.config.Config.tag_message +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.tag_message +``` + +```` + +````{py:attribute} allow_dirty +:canonical: bumpversion.config.Config.allow_dirty +:type: bool +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.allow_dirty +``` + +```` + +````{py:attribute} commit +:canonical: bumpversion.config.Config.commit +:type: bool +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.commit +``` + +```` + +````{py:attribute} message +:canonical: bumpversion.config.Config.message +:type: str +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.message +``` + +```` + +````{py:attribute} commit_args +:canonical: bumpversion.config.Config.commit_args +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.commit_args +``` + +```` + +````{py:attribute} scm_info +:canonical: bumpversion.config.Config.scm_info +:type: typing.Optional[bumpversion.scm.SCMInfo] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.scm_info +``` + +```` + +````{py:attribute} parts +:canonical: bumpversion.config.Config.parts +:type: typing.Dict[str, bumpversion.config.VersionPartConfig] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.parts +``` + +```` + +````{py:attribute} files +:canonical: bumpversion.config.Config.files +:type: typing.List[bumpversion.config.FileConfig] +:value: > + None + +```{autodoc2-docstring} bumpversion.config.Config.files +``` + +```` + +`````{py:class} Config +:canonical: bumpversion.config.Config.Config + +```{autodoc2-docstring} bumpversion.config.Config.Config +``` + +````{py:attribute} env_prefix +:canonical: bumpversion.config.Config.Config.env_prefix +:value: > + 'bumpversion_' + +```{autodoc2-docstring} bumpversion.config.Config.Config.env_prefix +``` + +```` + +````` + +````{py:method} add_files(filename: typing.Union[str, typing.List[str]]) -> None +:canonical: bumpversion.config.Config.add_files + +```{autodoc2-docstring} bumpversion.config.Config.add_files +``` + +```` + +````{py:property} version_config +:canonical: bumpversion.config.Config.version_config +:type: bumpversion.version_part.VersionConfig + +```{autodoc2-docstring} bumpversion.config.Config.version_config +``` + +```` + +`````` + +````{py:data} DEFAULTS +:canonical: bumpversion.config.DEFAULTS +:value: > + None + +```{autodoc2-docstring} bumpversion.config.DEFAULTS +``` + +```` + +````{py:data} CONFIG_FILE_SEARCH_ORDER +:canonical: bumpversion.config.CONFIG_FILE_SEARCH_ORDER +:value: > + () + +```{autodoc2-docstring} bumpversion.config.CONFIG_FILE_SEARCH_ORDER +``` + +```` + +````{py:function} get_configuration(config_file: typing.Union[str, pathlib.Path, None] = None, **overrides) -> bumpversion.config.Config +:canonical: bumpversion.config.get_configuration + +```{autodoc2-docstring} bumpversion.config.get_configuration +``` +```` + +````{py:function} get_all_part_configs(config_dict: dict) -> typing.Dict[str, bumpversion.config.VersionPartConfig] +:canonical: bumpversion.config.get_all_part_configs + +```{autodoc2-docstring} bumpversion.config.get_all_part_configs +``` +```` + +````{py:function} check_current_version(config: bumpversion.config.Config) -> str +:canonical: bumpversion.config.check_current_version + +```{autodoc2-docstring} bumpversion.config.check_current_version +``` +```` + +````{py:function} find_config_file(explicit_file: typing.Union[str, pathlib.Path, None] = None) -> typing.Union[pathlib.Path, None] +:canonical: bumpversion.config.find_config_file + +```{autodoc2-docstring} bumpversion.config.find_config_file +``` +```` + +````{py:function} read_config_file(config_file: typing.Union[str, pathlib.Path, None] = None) -> typing.Dict[str, typing.Any] +:canonical: bumpversion.config.read_config_file + +```{autodoc2-docstring} bumpversion.config.read_config_file +``` +```` + +````{py:function} read_ini_file(file_path: pathlib.Path) -> typing.Dict[str, typing.Any] +:canonical: bumpversion.config.read_ini_file + +```{autodoc2-docstring} bumpversion.config.read_ini_file +``` +```` + +````{py:function} read_toml_file(file_path: pathlib.Path) -> typing.Dict[str, typing.Any] +:canonical: bumpversion.config.read_toml_file + +```{autodoc2-docstring} bumpversion.config.read_toml_file +``` +```` + +````{py:function} update_config_file(config_file: typing.Union[str, pathlib.Path, None], current_version: str, new_version: str, dry_run: bool = False) -> None +:canonical: bumpversion.config.update_config_file + +```{autodoc2-docstring} bumpversion.config.update_config_file +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.exceptions.md b/docsrc/reference/bumpversion/bumpversion.exceptions.md new file mode 100644 index 00000000..277c9cef --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.exceptions.md @@ -0,0 +1,156 @@ +# {py:mod}`bumpversion.exceptions` + +```{py:module} bumpversion.exceptions +``` + +```{autodoc2-docstring} bumpversion.exceptions +:allowtitles: +``` + +## Module Contents + +### API + +````{py:exception} BumpVersionError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.BumpVersionError + +Bases: {py:obj}`click.UsageError` + +```{autodoc2-docstring} bumpversion.exceptions.BumpVersionError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.BumpVersionError.__init__ +``` + +```` + +````{py:exception} FormattingError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.FormattingError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.FormattingError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.FormattingError.__init__ +``` + +```` + +````{py:exception} MissingValueError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.MissingValueError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.MissingValueError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.MissingValueError.__init__ +``` + +```` + +````{py:exception} DirtyWorkingDirectoryError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.DirtyWorkingDirectoryError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.DirtyWorkingDirectoryError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.DirtyWorkingDirectoryError.__init__ +``` + +```` + +````{py:exception} SignedTagsError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.SignedTagsError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.SignedTagsError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.SignedTagsError.__init__ +``` + +```` + +````{py:exception} VersionNotFoundError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.VersionNotFoundError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.VersionNotFoundError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.VersionNotFoundError.__init__ +``` + +```` + +````{py:exception} InvalidVersionPartError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.InvalidVersionPartError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.InvalidVersionPartError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.InvalidVersionPartError.__init__ +``` + +```` + +````{py:exception} ConfigurationError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.ConfigurationError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.ConfigurationError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.ConfigurationError.__init__ +``` + +```` + +````{py:exception} BadInputError(message: str, ctx: typing.Optional[click.Context] = None) +:canonical: bumpversion.exceptions.BadInputError + +Bases: {py:obj}`bumpversion.exceptions.BumpVersionError` + +```{autodoc2-docstring} bumpversion.exceptions.BadInputError +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.exceptions.BadInputError.__init__ +``` + +```` diff --git a/docsrc/reference/bumpversion/bumpversion.files.md b/docsrc/reference/bumpversion/bumpversion.files.md new file mode 100644 index 00000000..94b4de7b --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.files.md @@ -0,0 +1,146 @@ +# {py:mod}`bumpversion.files` + +```{py:module} bumpversion.files +``` + +```{autodoc2-docstring} bumpversion.files +:allowtitles: +``` + +## Module Contents + +### Classes + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`ConfiguredFile ` + - ```{autodoc2-docstring} bumpversion.files.ConfiguredFile + :summary: + ``` +```` + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`resolve_file_config ` + - ```{autodoc2-docstring} bumpversion.files.resolve_file_config + :summary: + ``` +* - {py:obj}`modify_files ` + - ```{autodoc2-docstring} bumpversion.files.modify_files + :summary: + ``` +* - {py:obj}`get_glob_files ` + - ```{autodoc2-docstring} bumpversion.files.get_glob_files + :summary: + ``` +* - {py:obj}`_check_files_contain_version ` + - ```{autodoc2-docstring} bumpversion.files._check_files_contain_version + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`logger ` + - ```{autodoc2-docstring} bumpversion.files.logger + :summary: + ``` +```` + +### API + +````{py:data} logger +:canonical: bumpversion.files.logger +:value: > + None + +```{autodoc2-docstring} bumpversion.files.logger +``` + +```` + +`````{py:class} ConfiguredFile(file_cfg: bumpversion.config.FileConfig, version_config: bumpversion.version_part.VersionConfig) +:canonical: bumpversion.files.ConfiguredFile + +```{autodoc2-docstring} bumpversion.files.ConfiguredFile +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.files.ConfiguredFile.__init__ +``` + +````{py:method} contains_version(version: bumpversion.version_part.Version, context: typing.MutableMapping) -> bool +:canonical: bumpversion.files.ConfiguredFile.contains_version + +```{autodoc2-docstring} bumpversion.files.ConfiguredFile.contains_version +``` + +```` + +````{py:method} contains(search: str) -> bool +:canonical: bumpversion.files.ConfiguredFile.contains + +```{autodoc2-docstring} bumpversion.files.ConfiguredFile.contains +``` + +```` + +````{py:method} replace_version(current_version: bumpversion.version_part.Version, new_version: bumpversion.version_part.Version, context: typing.MutableMapping, dry_run: bool = False) -> None +:canonical: bumpversion.files.ConfiguredFile.replace_version + +```{autodoc2-docstring} bumpversion.files.ConfiguredFile.replace_version +``` + +```` + +````{py:method} __str__() -> str +:canonical: bumpversion.files.ConfiguredFile.__str__ + +```` + +````{py:method} __repr__() -> str +:canonical: bumpversion.files.ConfiguredFile.__repr__ + +```` + +````` + +````{py:function} resolve_file_config(files: typing.List[bumpversion.config.FileConfig], version_config: bumpversion.version_part.VersionConfig) -> typing.List[bumpversion.files.ConfiguredFile] +:canonical: bumpversion.files.resolve_file_config + +```{autodoc2-docstring} bumpversion.files.resolve_file_config +``` +```` + +````{py:function} modify_files(files: typing.List[bumpversion.files.ConfiguredFile], current_version: bumpversion.version_part.Version, new_version: bumpversion.version_part.Version, context: typing.MutableMapping, dry_run: bool = False) -> None +:canonical: bumpversion.files.modify_files + +```{autodoc2-docstring} bumpversion.files.modify_files +``` +```` + +````{py:function} get_glob_files(file_cfg: bumpversion.config.FileConfig, version_config: bumpversion.version_part.VersionConfig) -> typing.List[bumpversion.files.ConfiguredFile] +:canonical: bumpversion.files.get_glob_files + +```{autodoc2-docstring} bumpversion.files.get_glob_files +``` +```` + +````{py:function} _check_files_contain_version(files: typing.List[bumpversion.files.ConfiguredFile], current_version: bumpversion.version_part.Version, context: typing.MutableMapping) -> None +:canonical: bumpversion.files._check_files_contain_version + +```{autodoc2-docstring} bumpversion.files._check_files_contain_version +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.functions.md b/docsrc/reference/bumpversion/bumpversion.functions.md new file mode 100644 index 00000000..bb0b42fa --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.functions.md @@ -0,0 +1,140 @@ +# {py:mod}`bumpversion.functions` + +```{py:module} bumpversion.functions +``` + +```{autodoc2-docstring} bumpversion.functions +:allowtitles: +``` + +## Module Contents + +### Classes + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`PartFunction ` + - ```{autodoc2-docstring} bumpversion.functions.PartFunction + :summary: + ``` +* - {py:obj}`NumericFunction ` + - ```{autodoc2-docstring} bumpversion.functions.NumericFunction + :summary: + ``` +* - {py:obj}`ValuesFunction ` + - ```{autodoc2-docstring} bumpversion.functions.ValuesFunction + :summary: + ``` +```` + +### API + +`````{py:class} PartFunction +:canonical: bumpversion.functions.PartFunction + +```{autodoc2-docstring} bumpversion.functions.PartFunction +``` + +````{py:attribute} first_value +:canonical: bumpversion.functions.PartFunction.first_value +:type: str +:value: > + None + +```{autodoc2-docstring} bumpversion.functions.PartFunction.first_value +``` + +```` + +````{py:attribute} optional_value +:canonical: bumpversion.functions.PartFunction.optional_value +:type: str +:value: > + None + +```{autodoc2-docstring} bumpversion.functions.PartFunction.optional_value +``` + +```` + +````{py:attribute} independent +:canonical: bumpversion.functions.PartFunction.independent +:type: bool +:value: > + None + +```{autodoc2-docstring} bumpversion.functions.PartFunction.independent +``` + +```` + +````{py:method} bump(value: str) -> str +:canonical: bumpversion.functions.PartFunction.bump +:abstractmethod: + +```{autodoc2-docstring} bumpversion.functions.PartFunction.bump +``` + +```` + +````` + +`````{py:class} NumericFunction(optional_value: typing.Optional[str] = None, first_value: typing.Optional[str] = None) +:canonical: bumpversion.functions.NumericFunction + +Bases: {py:obj}`bumpversion.functions.PartFunction` + +```{autodoc2-docstring} bumpversion.functions.NumericFunction +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.functions.NumericFunction.__init__ +``` + +````{py:attribute} FIRST_NUMERIC +:canonical: bumpversion.functions.NumericFunction.FIRST_NUMERIC +:value: > + None + +```{autodoc2-docstring} bumpversion.functions.NumericFunction.FIRST_NUMERIC +``` + +```` + +````{py:method} bump(value: typing.Union[str, int]) -> str +:canonical: bumpversion.functions.NumericFunction.bump + +```{autodoc2-docstring} bumpversion.functions.NumericFunction.bump +``` + +```` + +````` + +`````{py:class} ValuesFunction(values: typing.List[str], optional_value: typing.Optional[str] = None, first_value: typing.Optional[str] = None) +:canonical: bumpversion.functions.ValuesFunction + +Bases: {py:obj}`bumpversion.functions.PartFunction` + +```{autodoc2-docstring} bumpversion.functions.ValuesFunction +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.functions.ValuesFunction.__init__ +``` + +````{py:method} bump(value: str) -> str +:canonical: bumpversion.functions.ValuesFunction.bump + +```{autodoc2-docstring} bumpversion.functions.ValuesFunction.bump +``` + +```` + +````` diff --git a/docsrc/reference/bumpversion/bumpversion.logging.md b/docsrc/reference/bumpversion/bumpversion.logging.md new file mode 100644 index 00000000..1f9646e6 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.logging.md @@ -0,0 +1,67 @@ +# {py:mod}`bumpversion.logging` + +```{py:module} bumpversion.logging +``` + +```{autodoc2-docstring} bumpversion.logging +:allowtitles: +``` + +## Module Contents + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`setup_logging ` + - ```{autodoc2-docstring} bumpversion.logging.setup_logging + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`logger ` + - ```{autodoc2-docstring} bumpversion.logging.logger + :summary: + ``` +* - {py:obj}`VERBOSITY ` + - ```{autodoc2-docstring} bumpversion.logging.VERBOSITY + :summary: + ``` +```` + +### API + +````{py:data} logger +:canonical: bumpversion.logging.logger +:value: > + None + +```{autodoc2-docstring} bumpversion.logging.logger +``` + +```` + +````{py:data} VERBOSITY +:canonical: bumpversion.logging.VERBOSITY +:value: > + None + +```{autodoc2-docstring} bumpversion.logging.VERBOSITY +``` + +```` + +````{py:function} setup_logging(verbose: int = 0) -> None +:canonical: bumpversion.logging.setup_logging + +```{autodoc2-docstring} bumpversion.logging.setup_logging +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.md b/docsrc/reference/bumpversion/bumpversion.md new file mode 100644 index 00000000..37044840 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.md @@ -0,0 +1,59 @@ +# {py:mod}`bumpversion` + +```{py:module} bumpversion +``` + +```{autodoc2-docstring} bumpversion +:allowtitles: +``` + +## Submodules + +```{toctree} +:titlesonly: +:maxdepth: 1 + +bumpversion.functions +bumpversion.version_part +bumpversion.logging +bumpversion.files +bumpversion.show +bumpversion.config +bumpversion.ui +bumpversion.autocast +bumpversion.aliases +bumpversion.cli +bumpversion.utils +bumpversion.bump +bumpversion.exceptions +bumpversion.scm +bumpversion.yaml_dump +bumpversion.__main__ +``` + +## Package Contents + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`__version__ ` + - ```{autodoc2-docstring} bumpversion.__version__ + :summary: + ``` +```` + +### API + +````{py:data} __version__ +:canonical: bumpversion.__version__ +:type: str +:value: > + '0.6.0' + +```{autodoc2-docstring} bumpversion.__version__ +``` + +```` diff --git a/docsrc/reference/bumpversion/bumpversion.scm.md b/docsrc/reference/bumpversion/bumpversion.scm.md new file mode 100644 index 00000000..9d8d0492 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.scm.md @@ -0,0 +1,466 @@ +# {py:mod}`bumpversion.scm` + +```{py:module} bumpversion.scm +``` + +```{autodoc2-docstring} bumpversion.scm +:allowtitles: +``` + +## Module Contents + +### Classes + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`SCMInfo ` + - ```{autodoc2-docstring} bumpversion.scm.SCMInfo + :summary: + ``` +* - {py:obj}`SourceCodeManager ` + - ```{autodoc2-docstring} bumpversion.scm.SourceCodeManager + :summary: + ``` +* - {py:obj}`Git ` + - ```{autodoc2-docstring} bumpversion.scm.Git + :summary: + ``` +* - {py:obj}`Mercurial ` + - ```{autodoc2-docstring} bumpversion.scm.Mercurial + :summary: + ``` +```` + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`get_scm_info ` + - ```{autodoc2-docstring} bumpversion.scm.get_scm_info + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`logger ` + - ```{autodoc2-docstring} bumpversion.scm.logger + :summary: + ``` +```` + +### API + +````{py:data} logger +:canonical: bumpversion.scm.logger +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.logger +``` + +```` + +`````{py:class} SCMInfo +:canonical: bumpversion.scm.SCMInfo + +```{autodoc2-docstring} bumpversion.scm.SCMInfo +``` + +````{py:attribute} tool +:canonical: bumpversion.scm.SCMInfo.tool +:type: typing.Optional[typing.Type[SourceCodeManager]] +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.SCMInfo.tool +``` + +```` + +````{py:attribute} commit_sha +:canonical: bumpversion.scm.SCMInfo.commit_sha +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.SCMInfo.commit_sha +``` + +```` + +````{py:attribute} distance_to_latest_tag +:canonical: bumpversion.scm.SCMInfo.distance_to_latest_tag +:type: typing.Optional[int] +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.SCMInfo.distance_to_latest_tag +``` + +```` + +````{py:attribute} current_version +:canonical: bumpversion.scm.SCMInfo.current_version +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.SCMInfo.current_version +``` + +```` + +````{py:attribute} branch_name +:canonical: bumpversion.scm.SCMInfo.branch_name +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.SCMInfo.branch_name +``` + +```` + +````{py:attribute} short_branch_name +:canonical: bumpversion.scm.SCMInfo.short_branch_name +:type: typing.Optional[str] +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.SCMInfo.short_branch_name +``` + +```` + +````{py:attribute} dirty +:canonical: bumpversion.scm.SCMInfo.dirty +:type: typing.Optional[bool] +:value: > + None + +```{autodoc2-docstring} bumpversion.scm.SCMInfo.dirty +``` + +```` + +````{py:method} __str__() +:canonical: bumpversion.scm.SCMInfo.__str__ + +```` + +````{py:method} __repr__() +:canonical: bumpversion.scm.SCMInfo.__repr__ + +```` + +````` + +`````{py:class} SourceCodeManager +:canonical: bumpversion.scm.SourceCodeManager + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager +``` + +````{py:attribute} _TEST_USABLE_COMMAND +:canonical: bumpversion.scm.SourceCodeManager._TEST_USABLE_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + [] + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager._TEST_USABLE_COMMAND +``` + +```` + +````{py:attribute} _COMMIT_COMMAND +:canonical: bumpversion.scm.SourceCodeManager._COMMIT_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + [] + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager._COMMIT_COMMAND +``` + +```` + +````{py:attribute} _ALL_TAGS_COMMAND +:canonical: bumpversion.scm.SourceCodeManager._ALL_TAGS_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + [] + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager._ALL_TAGS_COMMAND +``` + +```` + +````{py:method} commit(message: str, current_version: str, new_version: str, extra_args: typing.Optional[list] = None) -> None +:canonical: bumpversion.scm.SourceCodeManager.commit +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.commit +``` + +```` + +````{py:method} is_usable() -> bool +:canonical: bumpversion.scm.SourceCodeManager.is_usable +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.is_usable +``` + +```` + +````{py:method} assert_nondirty() -> None +:canonical: bumpversion.scm.SourceCodeManager.assert_nondirty +:abstractmethod: +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.assert_nondirty +``` + +```` + +````{py:method} latest_tag_info(tag_pattern: str) -> bumpversion.scm.SCMInfo +:canonical: bumpversion.scm.SourceCodeManager.latest_tag_info +:abstractmethod: +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.latest_tag_info +``` + +```` + +````{py:method} add_path(path: typing.Union[str, pathlib.Path]) -> None +:canonical: bumpversion.scm.SourceCodeManager.add_path +:abstractmethod: +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.add_path +``` + +```` + +````{py:method} tag(name: str, sign: bool = False, message: typing.Optional[str] = None) -> None +:canonical: bumpversion.scm.SourceCodeManager.tag +:abstractmethod: +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.tag +``` + +```` + +````{py:method} get_all_tags() -> typing.List[str] +:canonical: bumpversion.scm.SourceCodeManager.get_all_tags +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.get_all_tags +``` + +```` + +````{py:method} commit_to_scm(files: typing.List[typing.Union[str, pathlib.Path]], config: bumpversion.config.Config, context: typing.MutableMapping, extra_args: typing.Optional[typing.List[str]] = None, dry_run: bool = False) -> None +:canonical: bumpversion.scm.SourceCodeManager.commit_to_scm +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.commit_to_scm +``` + +```` + +````{py:method} tag_in_scm(config: bumpversion.config.Config, context: typing.MutableMapping, dry_run: bool = False) -> None +:canonical: bumpversion.scm.SourceCodeManager.tag_in_scm +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.SourceCodeManager.tag_in_scm +``` + +```` + +````{py:method} __str__() +:canonical: bumpversion.scm.SourceCodeManager.__str__ + +```` + +````{py:method} __repr__() +:canonical: bumpversion.scm.SourceCodeManager.__repr__ + +```` + +````` + +`````{py:class} Git +:canonical: bumpversion.scm.Git + +Bases: {py:obj}`bumpversion.scm.SourceCodeManager` + +```{autodoc2-docstring} bumpversion.scm.Git +``` + +````{py:attribute} _TEST_USABLE_COMMAND +:canonical: bumpversion.scm.Git._TEST_USABLE_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + ['git', 'rev-parse', '--git-dir'] + +```{autodoc2-docstring} bumpversion.scm.Git._TEST_USABLE_COMMAND +``` + +```` + +````{py:attribute} _COMMIT_COMMAND +:canonical: bumpversion.scm.Git._COMMIT_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + ['git', 'commit', '-F'] + +```{autodoc2-docstring} bumpversion.scm.Git._COMMIT_COMMAND +``` + +```` + +````{py:attribute} _ALL_TAGS_COMMAND +:canonical: bumpversion.scm.Git._ALL_TAGS_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + ['git', 'tag', '--list'] + +```{autodoc2-docstring} bumpversion.scm.Git._ALL_TAGS_COMMAND +``` + +```` + +````{py:method} assert_nondirty() -> None +:canonical: bumpversion.scm.Git.assert_nondirty +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Git.assert_nondirty +``` + +```` + +````{py:method} latest_tag_info(tag_pattern: str) -> bumpversion.scm.SCMInfo +:canonical: bumpversion.scm.Git.latest_tag_info +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Git.latest_tag_info +``` + +```` + +````{py:method} add_path(path: typing.Union[str, pathlib.Path]) -> None +:canonical: bumpversion.scm.Git.add_path +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Git.add_path +``` + +```` + +````{py:method} tag(name: str, sign: bool = False, message: typing.Optional[str] = None) -> None +:canonical: bumpversion.scm.Git.tag +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Git.tag +``` + +```` + +````` + +`````{py:class} Mercurial +:canonical: bumpversion.scm.Mercurial + +Bases: {py:obj}`bumpversion.scm.SourceCodeManager` + +```{autodoc2-docstring} bumpversion.scm.Mercurial +``` + +````{py:attribute} _TEST_USABLE_COMMAND +:canonical: bumpversion.scm.Mercurial._TEST_USABLE_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + ['hg', 'root'] + +```{autodoc2-docstring} bumpversion.scm.Mercurial._TEST_USABLE_COMMAND +``` + +```` + +````{py:attribute} _COMMIT_COMMAND +:canonical: bumpversion.scm.Mercurial._COMMIT_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + ['hg', 'commit', '--logfile'] + +```{autodoc2-docstring} bumpversion.scm.Mercurial._COMMIT_COMMAND +``` + +```` + +````{py:attribute} _ALL_TAGS_COMMAND +:canonical: bumpversion.scm.Mercurial._ALL_TAGS_COMMAND +:type: typing.ClassVar[typing.List[str]] +:value: > + ['hg', 'log', '--rev="tag()"', '--template="{tags}\n"'] + +```{autodoc2-docstring} bumpversion.scm.Mercurial._ALL_TAGS_COMMAND +``` + +```` + +````{py:method} latest_tag_info(tag_pattern: str) -> bumpversion.scm.SCMInfo +:canonical: bumpversion.scm.Mercurial.latest_tag_info +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Mercurial.latest_tag_info +``` + +```` + +````{py:method} assert_nondirty() -> None +:canonical: bumpversion.scm.Mercurial.assert_nondirty +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Mercurial.assert_nondirty +``` + +```` + +````{py:method} add_path(path: typing.Union[str, pathlib.Path]) -> None +:canonical: bumpversion.scm.Mercurial.add_path +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Mercurial.add_path +``` + +```` + +````{py:method} tag(name: str, sign: bool = False, message: typing.Optional[str] = None) -> None +:canonical: bumpversion.scm.Mercurial.tag +:classmethod: + +```{autodoc2-docstring} bumpversion.scm.Mercurial.tag +``` + +```` + +````` + +````{py:function} get_scm_info(tag_pattern: str) -> bumpversion.scm.SCMInfo +:canonical: bumpversion.scm.get_scm_info + +```{autodoc2-docstring} bumpversion.scm.get_scm_info +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.show.md b/docsrc/reference/bumpversion/bumpversion.show.md new file mode 100644 index 00000000..cb72424b --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.show.md @@ -0,0 +1,108 @@ +# {py:mod}`bumpversion.show` + +```{py:module} bumpversion.show +``` + +```{autodoc2-docstring} bumpversion.show +:allowtitles: +``` + +## Module Contents + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`output_default ` + - ```{autodoc2-docstring} bumpversion.show.output_default + :summary: + ``` +* - {py:obj}`output_yaml ` + - ```{autodoc2-docstring} bumpversion.show.output_yaml + :summary: + ``` +* - {py:obj}`output_json ` + - ```{autodoc2-docstring} bumpversion.show.output_json + :summary: + ``` +* - {py:obj}`resolve_name ` + - ```{autodoc2-docstring} bumpversion.show.resolve_name + :summary: + ``` +* - {py:obj}`log_list ` + - ```{autodoc2-docstring} bumpversion.show.log_list + :summary: + ``` +* - {py:obj}`do_show ` + - ```{autodoc2-docstring} bumpversion.show.do_show + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`OUTPUTTERS ` + - ```{autodoc2-docstring} bumpversion.show.OUTPUTTERS + :summary: + ``` +```` + +### API + +````{py:function} output_default(value: dict) -> None +:canonical: bumpversion.show.output_default + +```{autodoc2-docstring} bumpversion.show.output_default +``` +```` + +````{py:function} output_yaml(value: dict) -> None +:canonical: bumpversion.show.output_yaml + +```{autodoc2-docstring} bumpversion.show.output_yaml +``` +```` + +````{py:function} output_json(value: dict) -> None +:canonical: bumpversion.show.output_json + +```{autodoc2-docstring} bumpversion.show.output_json +``` +```` + +````{py:data} OUTPUTTERS +:canonical: bumpversion.show.OUTPUTTERS +:value: > + None + +```{autodoc2-docstring} bumpversion.show.OUTPUTTERS +``` + +```` + +````{py:function} resolve_name(obj: typing.Any, name: str, default: typing.Any = None, err_on_missing: bool = False) -> typing.Any +:canonical: bumpversion.show.resolve_name + +```{autodoc2-docstring} bumpversion.show.resolve_name +``` +```` + +````{py:function} log_list(config: bumpversion.config.Config, version_part: typing.Optional[str], new_version: typing.Optional[str]) -> None +:canonical: bumpversion.show.log_list + +```{autodoc2-docstring} bumpversion.show.log_list +``` +```` + +````{py:function} do_show(*args, config: bumpversion.config.Config, format_: str = 'default', increment: typing.Optional[str] = None) -> None +:canonical: bumpversion.show.do_show + +```{autodoc2-docstring} bumpversion.show.do_show +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.ui.md b/docsrc/reference/bumpversion/bumpversion.ui.md new file mode 100644 index 00000000..9a9af238 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.ui.md @@ -0,0 +1,42 @@ +# {py:mod}`bumpversion.ui` + +```{py:module} bumpversion.ui +``` + +```{autodoc2-docstring} bumpversion.ui +:allowtitles: +``` + +## Module Contents + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`print_info ` + - ```{autodoc2-docstring} bumpversion.ui.print_info + :summary: + ``` +* - {py:obj}`print_error ` + - ```{autodoc2-docstring} bumpversion.ui.print_error + :summary: + ``` +```` + +### API + +````{py:function} print_info(msg: str) -> None +:canonical: bumpversion.ui.print_info + +```{autodoc2-docstring} bumpversion.ui.print_info +``` +```` + +````{py:function} print_error(msg: str) -> None +:canonical: bumpversion.ui.print_error + +```{autodoc2-docstring} bumpversion.ui.print_error +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.utils.md b/docsrc/reference/bumpversion/bumpversion.utils.md new file mode 100644 index 00000000..947afaa7 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.utils.md @@ -0,0 +1,75 @@ +# {py:mod}`bumpversion.utils` + +```{py:module} bumpversion.utils +``` + +```{autodoc2-docstring} bumpversion.utils +:allowtitles: +``` + +## Module Contents + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`key_val_string ` + - ```{autodoc2-docstring} bumpversion.utils.key_val_string + :summary: + ``` +* - {py:obj}`prefixed_environ ` + - ```{autodoc2-docstring} bumpversion.utils.prefixed_environ + :summary: + ``` +* - {py:obj}`labels_for_format ` + - ```{autodoc2-docstring} bumpversion.utils.labels_for_format + :summary: + ``` +* - {py:obj}`get_context ` + - ```{autodoc2-docstring} bumpversion.utils.get_context + :summary: + ``` +* - {py:obj}`get_overrides ` + - ```{autodoc2-docstring} bumpversion.utils.get_overrides + :summary: + ``` +```` + +### API + +````{py:function} key_val_string(d: dict) -> str +:canonical: bumpversion.utils.key_val_string + +```{autodoc2-docstring} bumpversion.utils.key_val_string +``` +```` + +````{py:function} prefixed_environ() -> dict +:canonical: bumpversion.utils.prefixed_environ + +```{autodoc2-docstring} bumpversion.utils.prefixed_environ +``` +```` + +````{py:function} labels_for_format(serialize_format: str) -> typing.List[str] +:canonical: bumpversion.utils.labels_for_format + +```{autodoc2-docstring} bumpversion.utils.labels_for_format +``` +```` + +````{py:function} get_context(config: bumpversion.config.Config, current_version: typing.Optional[bumpversion.version_part.Version] = None, new_version: typing.Optional[bumpversion.version_part.Version] = None) -> collections.ChainMap +:canonical: bumpversion.utils.get_context + +```{autodoc2-docstring} bumpversion.utils.get_context +``` +```` + +````{py:function} get_overrides(**kwargs) -> dict +:canonical: bumpversion.utils.get_overrides + +```{autodoc2-docstring} bumpversion.utils.get_overrides +``` +```` diff --git a/docsrc/reference/bumpversion/bumpversion.version_part.md b/docsrc/reference/bumpversion/bumpversion.version_part.md new file mode 100644 index 00000000..055e4749 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.version_part.md @@ -0,0 +1,245 @@ +# {py:mod}`bumpversion.version_part` + +```{py:module} bumpversion.version_part +``` + +```{autodoc2-docstring} bumpversion.version_part +:allowtitles: +``` + +## Module Contents + +### Classes + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`VersionPart ` + - ```{autodoc2-docstring} bumpversion.version_part.VersionPart + :summary: + ``` +* - {py:obj}`Version ` + - ```{autodoc2-docstring} bumpversion.version_part.Version + :summary: + ``` +* - {py:obj}`VersionConfig ` + - ```{autodoc2-docstring} bumpversion.version_part.VersionConfig + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`logger ` + - ```{autodoc2-docstring} bumpversion.version_part.logger + :summary: + ``` +```` + +### API + +````{py:data} logger +:canonical: bumpversion.version_part.logger +:value: > + None + +```{autodoc2-docstring} bumpversion.version_part.logger +``` + +```` + +`````{py:class} VersionPart(config: bumpversion.config.VersionPartConfig, value: typing.Optional[str] = None) +:canonical: bumpversion.version_part.VersionPart + +```{autodoc2-docstring} bumpversion.version_part.VersionPart +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.version_part.VersionPart.__init__ +``` + +````{py:property} value +:canonical: bumpversion.version_part.VersionPart.value +:type: str + +```{autodoc2-docstring} bumpversion.version_part.VersionPart.value +``` + +```` + +````{py:method} copy() -> bumpversion.version_part.VersionPart +:canonical: bumpversion.version_part.VersionPart.copy + +```{autodoc2-docstring} bumpversion.version_part.VersionPart.copy +``` + +```` + +````{py:method} bump() -> bumpversion.version_part.VersionPart +:canonical: bumpversion.version_part.VersionPart.bump + +```{autodoc2-docstring} bumpversion.version_part.VersionPart.bump +``` + +```` + +````{py:method} null() -> bumpversion.version_part.VersionPart +:canonical: bumpversion.version_part.VersionPart.null + +```{autodoc2-docstring} bumpversion.version_part.VersionPart.null +``` + +```` + +````{py:property} is_optional +:canonical: bumpversion.version_part.VersionPart.is_optional +:type: bool + +```{autodoc2-docstring} bumpversion.version_part.VersionPart.is_optional +``` + +```` + +````{py:property} is_independent +:canonical: bumpversion.version_part.VersionPart.is_independent +:type: bool + +```{autodoc2-docstring} bumpversion.version_part.VersionPart.is_independent +``` + +```` + +````{py:method} __format__(format_spec: str) -> str +:canonical: bumpversion.version_part.VersionPart.__format__ + +```` + +````{py:method} __repr__() -> str +:canonical: bumpversion.version_part.VersionPart.__repr__ + +```` + +````{py:method} __eq__(other: typing.Any) -> bool +:canonical: bumpversion.version_part.VersionPart.__eq__ + +```` + +````` + +`````{py:class} Version(values: typing.Dict[str, bumpversion.version_part.VersionPart], original: typing.Optional[str] = None) +:canonical: bumpversion.version_part.Version + +```{autodoc2-docstring} bumpversion.version_part.Version +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.version_part.Version.__init__ +``` + +````{py:method} __getitem__(key: str) -> bumpversion.version_part.VersionPart +:canonical: bumpversion.version_part.Version.__getitem__ + +```{autodoc2-docstring} bumpversion.version_part.Version.__getitem__ +``` + +```` + +````{py:method} __len__() -> int +:canonical: bumpversion.version_part.Version.__len__ + +```{autodoc2-docstring} bumpversion.version_part.Version.__len__ +``` + +```` + +````{py:method} __iter__() +:canonical: bumpversion.version_part.Version.__iter__ + +```{autodoc2-docstring} bumpversion.version_part.Version.__iter__ +``` + +```` + +````{py:method} __repr__() +:canonical: bumpversion.version_part.Version.__repr__ + +```` + +````{py:method} __eq__(other: typing.Any) -> bool +:canonical: bumpversion.version_part.Version.__eq__ + +```` + +````{py:method} bump(part_name: str, order: typing.List[str]) -> bumpversion.version_part.Version +:canonical: bumpversion.version_part.Version.bump + +```{autodoc2-docstring} bumpversion.version_part.Version.bump +``` + +```` + +````` + +`````{py:class} VersionConfig(parse: str, serialize: typing.List[str], search: str, replace: str, part_configs: typing.Optional[typing.Dict[str, bumpversion.config.VersionPartConfig]] = None) +:canonical: bumpversion.version_part.VersionConfig + +```{autodoc2-docstring} bumpversion.version_part.VersionConfig +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.version_part.VersionConfig.__init__ +``` + +````{py:property} order +:canonical: bumpversion.version_part.VersionConfig.order +:type: typing.List[str] + +```{autodoc2-docstring} bumpversion.version_part.VersionConfig.order +``` + +```` + +````{py:method} parse(version_string: typing.Optional[str] = None) -> typing.Optional[bumpversion.version_part.Version] +:canonical: bumpversion.version_part.VersionConfig.parse + +```{autodoc2-docstring} bumpversion.version_part.VersionConfig.parse +``` + +```` + +````{py:method} _serialize(version: bumpversion.version_part.Version, serialize_format: str, context: typing.MutableMapping, raise_if_incomplete: bool = False) -> str +:canonical: bumpversion.version_part.VersionConfig._serialize + +```{autodoc2-docstring} bumpversion.version_part.VersionConfig._serialize +``` + +```` + +````{py:method} _choose_serialize_format(version: bumpversion.version_part.Version, context: typing.MutableMapping) -> str +:canonical: bumpversion.version_part.VersionConfig._choose_serialize_format + +```{autodoc2-docstring} bumpversion.version_part.VersionConfig._choose_serialize_format +``` + +```` + +````{py:method} serialize(version: bumpversion.version_part.Version, context: typing.MutableMapping) -> str +:canonical: bumpversion.version_part.VersionConfig.serialize + +```{autodoc2-docstring} bumpversion.version_part.VersionConfig.serialize +``` + +```` + +````` diff --git a/docsrc/reference/bumpversion/bumpversion.yaml_dump.md b/docsrc/reference/bumpversion/bumpversion.yaml_dump.md new file mode 100644 index 00000000..d89eafc1 --- /dev/null +++ b/docsrc/reference/bumpversion/bumpversion.yaml_dump.md @@ -0,0 +1,216 @@ +# {py:mod}`bumpversion.yaml_dump` + +```{py:module} bumpversion.yaml_dump +``` + +```{autodoc2-docstring} bumpversion.yaml_dump +:allowtitles: +``` + +## Module Contents + +### Classes + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`YAMLDumpers ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.YAMLDumpers + :summary: + ``` +```` + +### Functions + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`dump ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.dump + :summary: + ``` +* - {py:obj}`format_str ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_str + :summary: + ``` +* - {py:obj}`format_int ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_int + :summary: + ``` +* - {py:obj}`format_float ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_float + :summary: + ``` +* - {py:obj}`format_bool ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_bool + :summary: + ``` +* - {py:obj}`format_dict ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_dict + :summary: + ``` +* - {py:obj}`format_list ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_list + :summary: + ``` +* - {py:obj}`format_none ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_none + :summary: + ``` +* - {py:obj}`format_date ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_date + :summary: + ``` +* - {py:obj}`format_datetime ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.format_datetime + :summary: + ``` +```` + +### Data + +````{list-table} +:class: autosummary longtable +:align: left + +* - {py:obj}`DumperFunc ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.DumperFunc + :summary: + ``` +* - {py:obj}`YAML_DUMPERS ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.YAML_DUMPERS + :summary: + ``` +* - {py:obj}`INDENT ` + - ```{autodoc2-docstring} bumpversion.yaml_dump.INDENT + :summary: + ``` +```` + +### API + +````{py:data} DumperFunc +:canonical: bumpversion.yaml_dump.DumperFunc +:value: > + None + +```{autodoc2-docstring} bumpversion.yaml_dump.DumperFunc +``` + +```` + +`````{py:class} YAMLDumpers(dict=None, /, **kwargs) +:canonical: bumpversion.yaml_dump.YAMLDumpers + +Bases: {py:obj}`collections.UserDict` + +```{autodoc2-docstring} bumpversion.yaml_dump.YAMLDumpers +``` + +```{rubric} Initialization +``` + +```{autodoc2-docstring} bumpversion.yaml_dump.YAMLDumpers.__init__ +``` + +````{py:method} add_dumper(data_type: type, dumper: bumpversion.yaml_dump.DumperFunc) -> None +:canonical: bumpversion.yaml_dump.YAMLDumpers.add_dumper + +```{autodoc2-docstring} bumpversion.yaml_dump.YAMLDumpers.add_dumper +``` + +```` + +````` + +````{py:data} YAML_DUMPERS +:canonical: bumpversion.yaml_dump.YAML_DUMPERS +:value: > + None + +```{autodoc2-docstring} bumpversion.yaml_dump.YAML_DUMPERS +``` + +```` + +````{py:data} INDENT +:canonical: bumpversion.yaml_dump.INDENT +:value: > + ' ' + +```{autodoc2-docstring} bumpversion.yaml_dump.INDENT +``` + +```` + +````{py:function} dump(data: typing.Any) -> str +:canonical: bumpversion.yaml_dump.dump + +```{autodoc2-docstring} bumpversion.yaml_dump.dump +``` +```` + +````{py:function} format_str(val: str) -> str +:canonical: bumpversion.yaml_dump.format_str + +```{autodoc2-docstring} bumpversion.yaml_dump.format_str +``` +```` + +````{py:function} format_int(val: int) -> str +:canonical: bumpversion.yaml_dump.format_int + +```{autodoc2-docstring} bumpversion.yaml_dump.format_int +``` +```` + +````{py:function} format_float(data: float) -> str +:canonical: bumpversion.yaml_dump.format_float + +```{autodoc2-docstring} bumpversion.yaml_dump.format_float +``` +```` + +````{py:function} format_bool(val: bool) -> str +:canonical: bumpversion.yaml_dump.format_bool + +```{autodoc2-docstring} bumpversion.yaml_dump.format_bool +``` +```` + +````{py:function} format_dict(val: dict) -> str +:canonical: bumpversion.yaml_dump.format_dict + +```{autodoc2-docstring} bumpversion.yaml_dump.format_dict +``` +```` + +````{py:function} format_list(val: list) -> str +:canonical: bumpversion.yaml_dump.format_list + +```{autodoc2-docstring} bumpversion.yaml_dump.format_list +``` +```` + +````{py:function} format_none(_: None) -> str +:canonical: bumpversion.yaml_dump.format_none + +```{autodoc2-docstring} bumpversion.yaml_dump.format_none +``` +```` + +````{py:function} format_date(val: datetime.date) -> str +:canonical: bumpversion.yaml_dump.format_date + +```{autodoc2-docstring} bumpversion.yaml_dump.format_date +``` +```` + +````{py:function} format_datetime(val: datetime.datetime) -> str +:canonical: bumpversion.yaml_dump.format_datetime + +```{autodoc2-docstring} bumpversion.yaml_dump.format_datetime +``` +```` diff --git a/docsrc/cli.rst b/docsrc/reference/cli.rst similarity index 100% rename from docsrc/cli.rst rename to docsrc/reference/cli.rst diff --git a/docsrc/configuration.md b/docsrc/reference/configuration.md similarity index 92% rename from docsrc/configuration.md rename to docsrc/reference/configuration.md index 9b4d3599..27f658fb 100644 --- a/docsrc/configuration.md +++ b/docsrc/reference/configuration.md @@ -96,7 +96,7 @@ Bump-my-version's default behavior is to abort if the working directory is dirty Whether to create a commit using git or Mercurial. -If you have pre-commit hooks, you might also want to add an option to [`commit_args`](#commit-args) to disable your pre-commit hooks. For Git use `--no-verify` and use `--config hooks.pre-commit=` for Mercurial. +If you have pre-commit hooks, you might also want to add an option to [`commit_args`](configuration.md#commit-args) to disable your pre-commit hooks. For Git use `--no-verify` and use `--config hooks.pre-commit=` for Mercurial. ### `message` @@ -110,7 +110,7 @@ If you have pre-commit hooks, you might also want to add an option to [`commit_a :environment var: `BUMPVERSION_MESSAGE` -The commit message template to use when creating a commit. This is only used when the [`commit`](#commit) option is set to `True`. +The commit message template to use when creating a commit. This is only used when the [`commit`](configuration.md#commit) option is set to `True`. This string is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). Available in the template context are: @@ -133,7 +133,7 @@ This string is templated using the [Python Format String Syntax](https://docs.py :environment var: `BUMPVERSION_COMMIT_ARGS` -Extra arguments to pass to commit command. This is only used when the [`commit`](#commit) option is set to `True`. +Extra arguments to pass to commit command. This is only used when the [`commit`](configuration.md#commit) option is set to `True`. If you have pre-commit hooks, you might also want to add an option to disable your pre-commit hooks. For Git use `--no-verify` and use `--config hooks.pre-commit=` for Mercurial. @@ -149,7 +149,7 @@ If you have pre-commit hooks, you might also want to add an option to disable yo :environment var: `BUMPVERSION_TAG` -If `True`, create a tag after committing the changes. The tag is named using the [`tag_name`](#tag-name) option. +If `True`, create a tag after committing the changes. The tag is named using the [`tag_name`](configuration.md#tag-name) option. If you are using `git`, don't forget to `git-push` with the `--tags` flag when you are done. @@ -164,7 +164,7 @@ If you are using `git`, don't forget to `git-push` with the `--tags` flag when y :environment var: `BUMPVERSION_SIGN_TAGS` -If `True`, sign the created tag, when [`tag`](#tag) is `True`. +If `True`, sign the created tag, when [`tag`](configuration.md#tag) is `True`. ### `tag_name` :required: No @@ -177,7 +177,7 @@ If `True`, sign the created tag, when [`tag`](#tag) is `True`. :environment var: `BUMPVERSION_TAG_NAME` -The name template used to render the tag, when [`tag`](#tag) is `True`. +The name template used to render the tag, when [`tag`](configuration.md#tag) is `True`. This string is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). Available in the template context are: @@ -199,7 +199,7 @@ This string is templated using the [Python Format String Syntax](https://docs.py :environment var: `BUMPVERSION_TAG_MESSAGE` -The tag message template to use when creating a tag, when [`tag`](#tag) is `True` +The tag message template to use when creating a tag, when [`tag`](configuration.md#tag) is `True` This string is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). Available in the template context are: @@ -239,7 +239,7 @@ The current version of the software package before bumping. A value for this is This is the default regular expression (using [Python regular expression syntax](https://docs.python.org/3/library/re.html#regular-expression-syntax)) for finding and parsing the version string into its components. Individual part or file configurations may override this. -The regular expression must be able to parse all strings produced by the configured [`serialize`](#serialize) value. Named matching groups ("`(?P...)`") indicate the version part the matched value belongs to. +The regular expression must be able to parse all strings produced by the configured [`serialize`](configuration.md#serialize) value. Named matching groups ("`(?P...)`") indicate the version part the matched value belongs to. ### `serialize` :required: No @@ -268,15 +268,7 @@ serialize = [ Since `0` is optional by default, Version `1.8.9` will serialize to `1.8.9`, `1.9.0` will serialize to `1.9`, and version `2.0.0` will serialize as `2`. -Each string is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). Available in the template context are: - -- Each named group from the `parse` regular expression (e.g. `major`, `minor`, and `patch`) -- `current_version` -- `new_version` -- `current_[part]` (e.g. `current_major`) -- `new_[part]` (e.g. `new_major`) -- all environment variables are exposed, prefixed with `$`, such as `$BUILD_NUMBER` -- `now` or `utcnow` to get a current timestamp. Both accept [datetime formatting](https://docs.python.org/3.11/library/datetime.html#strftime-and-strptime-behavior) (e.g. `{now:%d.%m.%Y}`). +Each string is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). The [formatting context reference](formatting-context.md) describes the available variables. ### `search` :required: No diff --git a/docsrc/formatting-context.md b/docsrc/reference/formatting-context.md similarity index 90% rename from docsrc/formatting-context.md rename to docsrc/reference/formatting-context.md index 0b1bcc38..1f7bb7dc 100644 --- a/docsrc/formatting-context.md +++ b/docsrc/reference/formatting-context.md @@ -33,6 +33,10 @@ These fields will only have values if the code is in a Git or Mercurial reposito **`dirty`** A boolean indicating if the current repository has pending changes. +**`branch_name`** The current branch name. + +**`short_branch_name`** The current branch name, converted to lowercase, with non-alphanumeric characters removed and truncated to 20 characters. For example, `feature/MY-long_branch-name` would become `featuremylongbranchn`. + ## Version fields **`current_version`** The current version serialized as a string diff --git a/docsrc/reference/index.md b/docsrc/reference/index.md new file mode 100644 index 00000000..61c12d36 --- /dev/null +++ b/docsrc/reference/index.md @@ -0,0 +1,15 @@ +# Reference + + + +```{toctree} +--- +titlesonly: true +--- +cli +configuration +formatting-context +version-parts +search-and-replace-config +bumpversion/bumpversion +``` diff --git a/docsrc/search-and-replace.md b/docsrc/reference/search-and-replace-config.md similarity index 99% rename from docsrc/search-and-replace.md rename to docsrc/reference/search-and-replace-config.md index 62ac354b..751bc19c 100644 --- a/docsrc/search-and-replace.md +++ b/docsrc/reference/search-and-replace-config.md @@ -1,4 +1,4 @@ -# Searching and replacing versions +# Searching and replace configuration Bump-my-version uses [template strings](https://docs.python.org/3/library/string.html#format-string-syntax) to search the configured files for the old or current version and replace the text with the new version. diff --git a/docsrc/version-parts.md b/docsrc/reference/version-parts.md similarity index 97% rename from docsrc/version-parts.md rename to docsrc/reference/version-parts.md index 7a90ee95..116da766 100644 --- a/docsrc/version-parts.md +++ b/docsrc/reference/version-parts.md @@ -47,9 +47,9 @@ You can configure a part using the values function by providing a list of values ```toml [tool.bumpversion.parts.release_name] values = [ - "witty-warthog", - "ridiculous-rat", - "marvelous-mantis", + "witty-warthog", + "ridiculous-rat", + "marvelous-mantis", ] ``` @@ -59,8 +59,8 @@ By default, the *first* value of a version part is considered *optional.* An opt ```toml serialize = [ - "{major}.{minor}.{patch}", - "{major}.{minor}", + "{major}.{minor}.{patch}", + "{major}.{minor}", ] ``` diff --git a/docsrc/tutorials/index.md b/docsrc/tutorials/index.md new file mode 100644 index 00000000..46166c25 --- /dev/null +++ b/docsrc/tutorials/index.md @@ -0,0 +1,7 @@ +# Tutorials + + + +```{toctree} +semantic-versioning-example +``` diff --git a/docsrc/semantic-versioning-example.md b/docsrc/tutorials/semantic-versioning-example.md similarity index 100% rename from docsrc/semantic-versioning-example.md rename to docsrc/tutorials/semantic-versioning-example.md diff --git a/docsrc/usage.md b/docsrc/usage.md index 48b16fc7..a810fdf6 100644 --- a/docsrc/usage.md +++ b/docsrc/usage.md @@ -2,14 +2,13 @@ ```{admonition} NOTE -Throughout this document, you can use `bumpversion` or `bump-my-version` interchangeably. +You can use `bumpversion` or `bump-my-version` throughout this document interchangeably. ``` - -There are two modes of operation: On the command line for single-file operation and using a configuration file (`pyproject.toml` or `.bumpversion.toml`) for more complex multi-file processes. +There are two modes of operation: On the command line for single-file operation and using a configuration file (`pyproject.toml` or `.bumpversion.toml`) for more complex multi-file processes. We recommend using a configuration file for all but the simplest of projects. ```{admonition} WARNING -The invocation of `bump-my-version` changed in version 0.6.0. It split functionality into sub-commands. It remains backward-compatible with previous versions. Previous usage is discouraged and may be removed in a 1.0 release. +The invocation of `bump-my-version` changed in version 0.6.0. It splits functionality into sub-commands. It remains backward-compatible with previous versions. Previous usage is discouraged and may be removed in a 1.0 release. ``` ## Incrementing a version @@ -17,7 +16,7 @@ The invocation of `bump-my-version` changed in version 0.6.0. It split functiona bump-my-version bump [OPTIONS] [ARGS]... ``` -The `bump` sub-command triggers a version increment. The [complete list of options](cli.rst#bumpversion-bump) is available. The `ARGS` may contain a `VERSION_PART` or `FILES` +The `bump` sub-command triggers a version increment. The [complete list of options](reference/cli.rst#bumpversion-bump) is available. The `ARGS` may contain a `VERSION_PART` or `FILES` ### `VERSION_PART` @@ -26,12 +25,12 @@ _**[optional]**_ The part of the version to increase, e.g., `minor`. -Valid values include those given in the [`--serialize`](configuration.md#serialize) / [`--parse`](configuration.md#parse) option. +Valid values include those given in the [`--serialize`](reference/configuration.md#serialize) / [`--parse`](reference/configuration.md#parse) option. -Example bumping 0.5.1 to 0.6.0: +For example, if the current version is `0.5.1` and you want to bump it to `0.6.0`: ```console -bump-my-version bump --current-version 0.5.1 minor src/VERSION +bump-my-version bump minor ``` @@ -44,16 +43,16 @@ The additional file(s) to modify. This file is added to the list of files specified in the configuration file. If you want to rewrite only files specified on the command line, use `--no-configured-files`. -Example bumping version 1.1.9 to 2.0.0 in the `setup.py` file: +For example, if the current version is `1.1.9` and you want to bump the version to `2.0.0` and also change the version in the `_version.txt` file: ```console -bump-my-version bump --current-version 1.1.9 major setup.py +bump-my-version bump major _version.txt ``` -Example bumping version 1.1.9 to 2.0.0 in _only_ the `setup.py` file: +If you want to bump the current version of `1.1.9` to `2.0.0` and _only_ change the `_version.txt` file: ```console -bump-my-version bump --current-version 1.1.9 --no-configured-files major setup.py +bump-my-version bump --no-configured-files major _version.txt ``` ## Showing configuration information @@ -96,3 +95,25 @@ $ bump-my-version show --format json current_version commit "commit": false, } ``` + +## Searching and replacing without bumping + +More complex workflows may require you to change one or more files without changing the `current_version` in the configuration file. + +The `replace` sub-command works identically to the `bump` sub-command except for the following: + +- It will not commit or tag any changes +- It will not increment the version +- It will not change the configuration file + +```{admonition} NOTE + +If you do not include the `--new-version` option, the `new_version` context variable will be `None`. +``` + +One way of providing the `--new-version` option is to use the `bumpversion show` subcommand with an environment variable: + +```console +$ export BUMPVERSION_NEW_VERSION=$(bumpversion show new_version --increment ) +$ bumpversion replace +``` diff --git a/pyproject.toml b/pyproject.toml index 065696dd..c487d08a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ keywords = ["bumpversion", "version", "release"] dynamic = ["version"] dependencies = [ "click", - "pydantic", + "pydantic<2.0.0", "rich-click", "rich", "tomlkit", diff --git a/tests/test_cli.py b/tests/test_cli.py index 010ff283..59f89ebb 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -361,3 +361,71 @@ def test_show_no_args(tmp_path: Path, fixtures_path: Path): assert result.exit_code == 0 assert result.output.strip() == expected_output.strip() + + +def test_replace(mocker, tmp_path, fixtures_path): + """The replace subcommand should replace the version in the file.""" + # Arrange + toml_path = fixtures_path / "basic_cfg.toml" + config_path = tmp_path / "pyproject.toml" + shutil.copy(toml_path, config_path) + + mocked_modify_files = mocker.patch("bumpversion.cli.modify_files") + runner: CliRunner = CliRunner() + with inside_dir(tmp_path): + result: Result = runner.invoke(cli.cli, ["replace", "--new-version", "1.1.0"]) + + if result.exit_code != 0: + print(result.output) + + assert result.exit_code == 0 + + call_args = mocked_modify_files.call_args[0] + configured_files = call_args[0] + assert len(configured_files) == 3 + actual_filenames = {f.path for f in configured_files} + assert actual_filenames == {"setup.py", "CHANGELOG.md", "bumpversion/__init__.py"} + + +def test_replace_no_newversion(mocker, tmp_path, fixtures_path): + """The replace subcommand should set new_version to None in the context.""" + # Arrange + toml_path = fixtures_path / "basic_cfg.toml" + config_path = tmp_path / "pyproject.toml" + shutil.copy(toml_path, config_path) + + mocked_modify_files = mocker.patch("bumpversion.cli.modify_files") + runner: CliRunner = CliRunner() + with inside_dir(tmp_path): + result: Result = runner.invoke(cli.cli, ["replace"]) + + if result.exit_code != 0: + print(result.output) + + assert result.exit_code == 0 + + call_args = mocked_modify_files.call_args[0] + assert call_args[2] is None + + +def test_replace_specific_files(mocker, git_repo, fixtures_path): + """The replace subcommand should set the files to only the specified files.""" + # Arrange + toml_path = fixtures_path / "basic_cfg.toml" + config_path = git_repo / "pyproject.toml" + shutil.copy(toml_path, config_path) + + mocked_modify_files = mocker.patch("bumpversion.cli.modify_files") + runner: CliRunner = CliRunner() + with inside_dir(git_repo): + result: Result = runner.invoke(cli.cli, ["replace", "--no-configured-files", "VERSION"]) + + if result.exit_code != 0: + print(result.output) + + assert result.exit_code == 0 + + call_args = mocked_modify_files.call_args[0] + configured_files = call_args[0] + assert len(configured_files) == 1 + assert configured_files[0].path == "VERSION"