Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to documentation #227

Merged
merged 6 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The default configuration only allows bumping the major, minor, or patch version

### Add support for pre-release versions

Alter the `parse` configuration to support pre-release versions. This `parse` option uses an extended (or verbose) regular expression to extract the version parts from the current version.
Alter the `parse` configuration to support pre-release versions. This `parse` option uses an extended (or verbose) regular expression to extract the version components from the current version.

```toml title="New parse configuration"
parse = """(?x)
Expand Down
2 changes: 1 addition & 1 deletion bumpversion/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def do_bump(
Bump the version_part to the next value or set the version to new_version.

Args:
version_part: The version part to bump
version_part: The name of the version component to bump
new_version: The explicit version to set
config: The configuration to use
config_file: The configuration file to update
Expand Down
4 changes: 2 additions & 2 deletions bumpversion/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def bump(
config = get_configuration(found_config_file, **overrides)
if args:
if args[0] not in config.parts.keys():
raise click.BadArgumentUsage(f"Unknown version part: {args[0]}")
raise click.BadArgumentUsage(f"Unknown version component: {args[0]}")
version_part = args[0]
files = args[1:]
else:
Expand Down Expand Up @@ -335,7 +335,7 @@ def bump(
required=False,
envvar="BUMPVERSION_INCREMENT",
type=str,
help="Increment the version part and add `new_version` to the configuration.",
help="Increment the version component and add `new_version` to the configuration.",
)
def show(args: List[str], config_file: Optional[str], format_: str, increment: Optional[str]) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion bumpversion/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_configuration(config_file: Union[str, Path, None] = None, **overrides: A
parsed_config = read_config_file(config_file) if config_file else {}
config_dict = set_config_defaults(parsed_config, **overrides)

# Set any missing version parts
# Set any missing version components
config_dict["parts"] = get_all_part_configs(config_dict)

# Set any missing file configuration
Expand Down
4 changes: 2 additions & 2 deletions bumpversion/config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def get_all_file_configs(config_dict: dict) -> List[FileChange]:
"""Make sure all version parts are included."""
"""Make sure all version components are included."""
defaults = {
"parse": config_dict["parse"],
"serialize": config_dict["serialize"],
Expand All @@ -31,7 +31,7 @@ def get_all_file_configs(config_dict: dict) -> List[FileChange]:


def get_all_part_configs(config_dict: dict) -> Dict[str, VersionComponentSpec]:
"""Make sure all version parts are included."""
"""Make sure all version components are included."""
try:
parsing_groups = list(re.compile(config_dict["parse"]).groupindex.keys())
except re.error as e:
Expand Down
2 changes: 1 addition & 1 deletion bumpversion/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _contains_change_pattern(
return True

# The `search` pattern did not match, but the original supplied
# version number (representing the same version part values) might
# version number (representing the same version component values) might
# match instead. This is probably the case if environment variables are used.

# check whether `search` isn't customized
Expand Down
Binary file added docs/assets/explanations.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/how-to.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/reference.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/tutorial.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/explanation/index.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Explanation
- *.md
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version parts
# Version components

- The version string is the rendering of some or all version parts.
- While the version string may be rendered differently in various places, the value for all parts is maintained in Bump My Version's configuration.
Expand Down
2 changes: 1 addition & 1 deletion docs/gen_doc_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@

mkdocs_gen_files.set_edit_path(full_doc_path, path)

with mkdocs_gen_files.open("reference/api/SUMMARY.md", "w") as nav_file:
with mkdocs_gen_files.open("reference/api/nav.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
2 changes: 1 addition & 1 deletion docs/howtos/avoid-incorrect-replacements.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Avoiding incorrect replacements
# Avoid incorrect replacements

In files that have multiple version strings, Bump My Version may find the wrong string and replace it. Given this `requirements.txt` for `MyProject`:

Expand Down
8 changes: 6 additions & 2 deletions docs/howtos/calver.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ For this example, we will use the following format: `YYYY.MM.DD.patch`. It will
- `2022.2.1` for the first patch of February 1, 2022
- `2022.2.1.1` for the second patch of February 1, 2022


## Initial configuration

```toml title=".bumpversion.toml"
Expand All @@ -31,7 +30,12 @@ You can look up the regular expressions for the CalVer format in the [CalVer ref

## Expected behavior

You can find out more about the logic behind the CalVer incrementing in the [CalVer reference](../reference/calver_reference.md#calver-incrementing-logic).
- CalVer version components are marked as `always_increment` by default.
- When bumping a version, you specify which component to increment. It is called the target component.
- When bumping a version, the components marked as `always_increment` are incremented first.
- If an `always_increment` component's value changed, its dependent components are marked for reset to their default values.
- If the target component is in the set of components marked for reset, the target component is reset to its default value.
- If the target component is not in the set of components marked for reset, the target component is incremented and its dependent components are reset to their default values.

### Bumping the release resets the patch part

Expand Down
6 changes: 0 additions & 6 deletions docs/howtos/index.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/howtos/nav.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- *.md
85 changes: 78 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,81 @@ title: Bump My Version

# Bump My Version

{%
include-markdown
"../README.md"
start="<!--start-->"
end="<!--end-->"
rewrite-relative-urls=false
%}
Bump My Version's purpose is to:

- Work as a part of an automated build system
- Manage project versioning through the project's development life cycle
- Incrementing version numbers
- Serializing version numbers
- Parsing version numbers
- Support SemVer, CalVer, and other versioning schemes
- Modify project files as part of the project's development life cycle
- Work with the project's source control system
- Committing changes
- Tagging releases
- Reading version numbers from tags

## Installation

You can download and install the latest version of this software from the Python package index (PyPI) as follows:

```console
pip install --upgrade bump-my-version
```
<!--
## Jump to section

::: grid wide-gap

::: card-container

::: card-media

![Tutorials](assets/tutorial.jpg)

::: card-content

[Tutorials](tutorials/getting-started.md)
{ .card-content-title }

Follow along with our guides to learn how to use Bump My Version.

::: card-container

::: card-media

![Reference](assets/reference.jpg)

::: card-content

[Reference](reference/)
{ .card-content-title }

Consult the reference for specifics about the Bump My Version's configuration and commands.

::: card-container

::: card-media

![How-To's](assets/how-to.jpg)

::: card-content

[How-To's](howtos/index.md)
{ .card-content-title }

Need to get something done? Check out our how-to guides.

::: card-container

::: card-media

![Explanations](assets/explanations.jpg)

::: card-content

[Explanations](explanation/index.md)
{ .card-content-title }

Want to understand the library better? Read our explanations behind the design.
-->
18 changes: 6 additions & 12 deletions docs/reference/calver_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## Calendar versioning codes

The following table lists the available format codes for calendar versioning (CalVer) schemes. The codes can be used to define the version format in the `calver_format` configuration options. Formatting codes, surrounded by `{ }` can be combined to create a custom version format. For example, the format `YYYY.MM.DD` can be defined as `"{YYYY}.{MM}.{DD}"`.
The following table lists the available format codes for calendar versioning (CalVer) schemes. The codes can be used to
define the version format in the `calver_format` configuration options. Formatting codes, surrounded by `{ }` can be
combined to create a custom version format. For example, the format `YYYY.MM.DD` can be defined as `"{YYYY}.{MM}.{DD}"`.

| Code | Example(s) | Comment |
|--------|---------------------|-----------------------------------------------|
Expand Down Expand Up @@ -32,7 +34,6 @@ The following table lists the available format codes for calendar versioning (Ca
calver_format = "{YYYY}.{MM}.{DD}"
```


## Parsing CalVer versions

Using the following chart, we can set up the version parsing:
Expand Down Expand Up @@ -68,7 +69,9 @@ Using the following chart, we can set up the version parsing:

`(?:jan|fév|mar|avr|mai|jui|jui|aoû|sep|oct|nov|déc)` for French

You can use these regular expressions to parse CalVer versions in your project. For example, the following `parse` configuration can be used to parse a version string in the format `YYYY.MM.DD` as the `release` part of the version string:
You can use these regular expressions to parse CalVer versions in your project. For example, the following `parse`
configuration can be used to parse a version string in the format `YYYY.MM.DD` as the `release` part of the version
string:

```toml
[tool.bumpversion]
Expand All @@ -80,12 +83,3 @@ parse = """(?x) # Verbose mode
)
"""
```

## CalVer incrementing logic

- CalVer version components are marked as `always_increment` by default.
- When bumping a version, you specify which component to increment. It is called the target component.
- When bumping a version, the components marked as `always_increment` are incremented first.
- If an `always_increment` component's value changed, its dependent components are marked for reset to their default values.
- If the target component is in the set of components marked for reset, the target component is reset to its default value.
- If the target component is not in the set of components marked for reset, the target component is incremented and its dependent components are reset to their default values.
Loading
Loading