bumpversion-slim 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. bumpversion_slim-0.1.0/.coverage +0 -0
  2. bumpversion_slim-0.1.0/.github/pull_request_template.md +26 -0
  3. bumpversion_slim-0.1.0/.github/workflows/publish.yml +28 -0
  4. bumpversion_slim-0.1.0/.github/workflows/publish_docs.yml +26 -0
  5. bumpversion_slim-0.1.0/.github/workflows/style.yml +35 -0
  6. bumpversion_slim-0.1.0/.github/workflows/tests.yml +70 -0
  7. bumpversion_slim-0.1.0/.gitignore +10 -0
  8. bumpversion_slim-0.1.0/.pre-commit-config.yaml +43 -0
  9. bumpversion_slim-0.1.0/.python-version +1 -0
  10. bumpversion_slim-0.1.0/CHANGELOG.md +19 -0
  11. bumpversion_slim-0.1.0/PKG-INFO +38 -0
  12. bumpversion_slim-0.1.0/README.md +0 -0
  13. bumpversion_slim-0.1.0/docs/configuration.md +170 -0
  14. bumpversion_slim-0.1.0/docs/favicon.svg +28 -0
  15. bumpversion_slim-0.1.0/docs/hooks.md +92 -0
  16. bumpversion_slim-0.1.0/docs/index.md +37 -0
  17. bumpversion_slim-0.1.0/docs/usage.md +53 -0
  18. bumpversion_slim-0.1.0/pyproject.toml +180 -0
  19. bumpversion_slim-0.1.0/src/bumpversion_slim/__init__.py +0 -0
  20. bumpversion_slim-0.1.0/src/bumpversion_slim/bump.py +92 -0
  21. bumpversion_slim-0.1.0/src/bumpversion_slim/cli.py +141 -0
  22. bumpversion_slim-0.1.0/src/bumpversion_slim/config.py +89 -0
  23. bumpversion_slim-0.1.0/src/bumpversion_slim/context.py +79 -0
  24. bumpversion_slim-0.1.0/src/bumpversion_slim/errors.py +10 -0
  25. bumpversion_slim-0.1.0/src/bumpversion_slim/git.py +111 -0
  26. bumpversion_slim-0.1.0/src/bumpversion_slim/py.typed +0 -0
  27. bumpversion_slim-0.1.0/tasks.py +49 -0
  28. bumpversion_slim-0.1.0/tests/__init__.py +0 -0
  29. bumpversion_slim-0.1.0/tests/conftest.py +53 -0
  30. bumpversion_slim-0.1.0/tests/test_bump.py +211 -0
  31. bumpversion_slim-0.1.0/tests/test_cli.py +257 -0
  32. bumpversion_slim-0.1.0/tests/test_config.py +140 -0
  33. bumpversion_slim-0.1.0/tests/test_context.py +83 -0
  34. bumpversion_slim-0.1.0/tests/test_git.py +305 -0
  35. bumpversion_slim-0.1.0/uv.lock +693 -0
Binary file
@@ -0,0 +1,26 @@
1
+ # Set a conventional commit style topic
2
+
3
+ ```
4
+ <type>[(optional scope)][!]: <description>
5
+ ```
6
+
7
+ feat: what new feature was added
8
+ feat!: what breaking change was made
9
+ feat(scope): change to scope
10
+
11
+ # Replace this description with additional information to be included in merge commit
12
+
13
+ [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
14
+
15
+ ```
16
+ [optional body]
17
+
18
+ [optional footer(s)]
19
+ ```
20
+
21
+ ```
22
+ More details about the change.
23
+
24
+ BREAKING CHANGE:
25
+ Refs: #{issue}
26
+ ```
@@ -0,0 +1,28 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Set up Python 3.9
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.9.x"
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v2
21
+
22
+ - name: Publish
23
+ env:
24
+ TWINE_USERNAME: __token__
25
+ TWINE_PASSWORD: ${{ secrets.PYPI_PUBLISH_TOKEN }}
26
+ run: |
27
+ uv build
28
+ uvx twine upload dist/*
@@ -0,0 +1,26 @@
1
+ name: publish_docs
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: write
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: 3.11.x
18
+ - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
19
+ - uses: actions/cache@v4
20
+ with:
21
+ key: mkdocs-material-${{ env.cache_id }}
22
+ path: .cache
23
+ restore-keys: |
24
+ mkdocs-material-
25
+ - run: pip install mkdocs-material
26
+ - run: mkdocs gh-deploy --force
@@ -0,0 +1,35 @@
1
+ name: Style
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ # Push will only build on branches that match this name
7
+ # Pull requests will override this, so pushes to pull requests will still build
8
+ - main
9
+ pull_request:
10
+ branches:
11
+ - main
12
+
13
+ jobs:
14
+ check-style:
15
+
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Set up Python 3.10
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.10.x"
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v2
28
+
29
+ - name: Install dependencies
30
+ run: |
31
+ uv sync --all-extras
32
+
33
+ - name: Lint with astral
34
+ run: |
35
+ uv run prek run --all-files
@@ -0,0 +1,70 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ # Push will only build on branches that match this name
7
+ # Pull requests will override this, so pushes to pull requests will still build
8
+ - main
9
+ pull_request:
10
+ branches:
11
+ - main
12
+
13
+ jobs:
14
+
15
+ test-coverage:
16
+
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Python 3.10
22
+ uses: actions/setup-python@v3
23
+ with:
24
+ python-version: "3.10.x"
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v2
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --all-extras
31
+
32
+ - name: Generate coverage report
33
+ run: |
34
+ uv run pytest --cov-report=xml --cov-config=pyproject.toml -vvv
35
+
36
+ - name: Upload coverage to Codecov
37
+ uses: codecov/codecov-action@v1
38
+ with:
39
+ token: ${{ secrets.CODECOV_TOKEN }}
40
+ slug: NRWLDev/bumpversion-slim
41
+ file: ./coverage.xml
42
+ flags: unittests
43
+ name: codecov-umbrella
44
+ yml: ./codecov.yml
45
+ fail_ci_if_error: false
46
+
47
+ test-python-versions:
48
+
49
+ runs-on: ${{ matrix.os }}
50
+ strategy:
51
+ matrix:
52
+ os: [ubuntu-latest, macos-latest, windows-latest]
53
+ version: ["3.10.x", "3.11.x", "3.12.x", "3.13.x", "3.14.x"]
54
+
55
+ steps:
56
+ - uses: actions/checkout@v3
57
+ - name: Set up Python ${{ matrix.version }}
58
+ uses: actions/setup-python@v3
59
+ with:
60
+ python-version: ${{ matrix.version }}
61
+
62
+ - name: Install uv
63
+ uses: astral-sh/setup-uv@v2
64
+
65
+ - name: Install dependencies
66
+ run: uv sync --all-extras
67
+
68
+ - name: Test with pytest
69
+ run: |
70
+ uv run pytest
@@ -0,0 +1,10 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
@@ -0,0 +1,43 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ exclude: tests/test_cli.py
7
+ - id: check-added-large-files
8
+ - id: check-ast
9
+ - id: check-json
10
+ - id: check-toml
11
+ - id: fix-byte-order-marker
12
+ - id: end-of-file-fixer
13
+
14
+ - repo: https://github.com/crate-ci/typos
15
+ rev: v1
16
+ hooks:
17
+ - id: typos
18
+ args: [--force-exclude]
19
+
20
+ - repo: https://github.com/astral-sh/ruff-pre-commit
21
+ rev: v0.15.5
22
+ hooks:
23
+ - id: ruff-format
24
+ args: [--preview, -s]
25
+ - id: ruff
26
+ args: [--fix]
27
+
28
+ - repo: local
29
+ hooks:
30
+ - id: ty
31
+ name: ty check
32
+ entry: ty check .
33
+ language: system
34
+ pass_filenames: false
35
+ always_run: true
36
+
37
+ - repo: https://github.com/Lucas-C/pre-commit-hooks
38
+ rev: v1.5.6
39
+ hooks:
40
+ - id: remove-crlf
41
+ exclude: docs
42
+ - id: remove-tabs
43
+ exclude: docs
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (released 2026-03-07)
4
+
5
+ ### Documentation
6
+
7
+ - Update overview page.[[c3680e0](https://github.com/NRWLDev/bumpversion-slim/commit/c3680e0e072ffdf254fe8d326199d452460ea3ec)]
8
+ - Add documentation around usage and configuration.[[f7000fb](https://github.com/NRWLDev/bumpversion-slim/commit/f7000fb134461e1fd86da754a1e9144bb636892a)]
9
+
10
+ ### Miscellaneous
11
+
12
+ - Add invoke tasks for installation, test and release management.[[955308e](https://github.com/NRWLDev/bumpversion-slim/commit/955308e9ab8699a1fb5c8f3f8e15605be018c31a)]
13
+ - Update tests to include config parameter in Context object.[[aba27d9](https://github.com/NRWLDev/bumpversion-slim/commit/aba27d918677cc477051c66134f42e263244faf3)]
14
+ - Add github action pipelines[[eff830a](https://github.com/NRWLDev/bumpversion-slim/commit/eff830a6130de32ebb870db91f69af9c504304b5)]
15
+ - Add initial test suite.[[5a32e46](https://github.com/NRWLDev/bumpversion-slim/commit/5a32e46df90de8c37b0684ac9f1063ec6e8a538a)]
16
+ - Add git-cliff, prek and bumpversion configuration.[[d93f8b4](https://github.com/NRWLDev/bumpversion-slim/commit/d93f8b4b2a8d0a79daacfff851b863a259a6b4e7)]
17
+ - Extracted version bumping pieces from changelog-gen library.[[220c89f](https://github.com/NRWLDev/bumpversion-slim/commit/220c89f4ddcdb11e33eee85024eccbaaa5399b12)]
18
+
19
+ <!-- generated by git-cliff -->
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: bumpversion-slim
3
+ Version: 0.1.0
4
+ Summary: A lightweight tool to bump package versions
5
+ Author-email: Daniel Edgecombe <daniel@nrwl.co>
6
+ License-Expression: Apache-2.0
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Build Tools
21
+ Classifier: Topic :: Software Development :: Version Control
22
+ Classifier: Topic :: System :: Software Distribution
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: gitpython>=3.1.46
25
+ Requires-Dist: rtoml>=0.13.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: git-cliff>=2.12.0; extra == 'dev'
28
+ Requires-Dist: prek>=0.3.4; extra == 'dev'
29
+ Requires-Dist: ruff>=0.14.10; extra == 'dev'
30
+ Requires-Dist: ty>=0.0.17; extra == 'dev'
31
+ Provides-Extra: test
32
+ Requires-Dist: freezegun>=1.2.1; extra == 'test'
33
+ Requires-Dist: path<17,>=16; extra == 'test'
34
+ Requires-Dist: pytest-cov>=7.0.0; extra == 'test'
35
+ Requires-Dist: pytest-git<1.8,>=1.7.0; extra == 'test'
36
+ Requires-Dist: pytest-httpx>=0.36.0; extra == 'test'
37
+ Requires-Dist: pytest-random-order>=1.2.0; extra == 'test'
38
+ Requires-Dist: pytest>=9.0.0; extra == 'test'
File without changes
@@ -0,0 +1,170 @@
1
+ # Configuration
2
+
3
+ General configuration is grouped in the `[tool.bumpversion]` section of pyproject.toml.
4
+
5
+ ## Simple configuration
6
+
7
+ ```toml
8
+ [tool.bumpversion]
9
+ current_version = "1.2.3"
10
+ allowed_branches = [
11
+ "main",
12
+ ]
13
+
14
+ [[tool.bumpversion.files]]
15
+ filename = "README.md"
16
+ ```
17
+
18
+ ### `commit`
19
+ _**[optional]**_<br />
20
+ **default**: True
21
+
22
+ Commit version replacement changes to the configured files.
23
+
24
+ Also available as `--commit/--no-commit` (e.g. `bumpversion 1.2.3 --commit`)
25
+
26
+ ### `tag`
27
+ _**[optional]**_<br />
28
+ **default**: True
29
+
30
+ Tag the committed changes with the new version.
31
+
32
+ Also available as `--tag/--no-tag` (e.g. `bumpversion 1.2.3 --tag`)
33
+
34
+ ### `allow_dirty`
35
+ _**[optional]**_<br />
36
+ **default**: False
37
+
38
+ Don't abort if the current branch contains uncommitted changes
39
+
40
+ Also available as `--allow-dirty` (e.g. `bumpversion 1.2.3 --allow-dirty`)
41
+
42
+ ### `allow_missing`
43
+ _**[optional]**_<br />
44
+ **default**: False
45
+
46
+ Don't abort if the local and remote branches are out of sync.
47
+
48
+ Also available as `--allow-missing` (e.g. `bumpversion 1.2.3 --allow-missing`)
49
+
50
+ ### `version_string`
51
+ _**[optional]**_<br />
52
+ **default**: `v{new_version}`
53
+
54
+ Format for the version tag, this will be passed into commit messages.
55
+
56
+ Example:
57
+
58
+ ```toml
59
+ [tool.bumpversion]
60
+ version_string = "{new_version}"
61
+ ```
62
+
63
+ ### `commit_extra`
64
+ _**[optional]**_<br />
65
+ **default**: None
66
+
67
+ Additional file(s) to commit even if `bumpversion` has not modified them
68
+ itself. Useful if another tool has modified a file in a previous pipeline
69
+ step.
70
+
71
+ Example:
72
+
73
+ ```toml
74
+ [tool.bumpversion]
75
+ commit_extra = [
76
+ "CHANGELOG.md",
77
+ ]
78
+ ```
79
+
80
+ ### `allowed_branches`
81
+ _**[optional]**_<br />
82
+ **default**: None
83
+
84
+ Prevent version being bumped if the current branch is not in the
85
+ supplied list. By default all branches are allowed.
86
+
87
+ Example:
88
+
89
+ ```toml
90
+ [tool.bumpversion]
91
+ allowed_branches = [
92
+ "main",
93
+ "develop",
94
+ ]
95
+ ```
96
+
97
+ ### `hooks`
98
+ _**[optional]**_<br />
99
+ **default**: None
100
+
101
+ Run additional hooks when generating a release, this allows regenerating
102
+ automated documentation during release process, for example.
103
+
104
+ Example:
105
+
106
+ ```toml
107
+ [tool.bumpversion]
108
+ hooks = [
109
+ "path.to.module:hook_function",
110
+ ]
111
+ ```
112
+
113
+ ### `custom`
114
+ _**[optional]**_<br />
115
+ **default**: None
116
+
117
+ Arbitrary configuration that can be used in hooks.
118
+
119
+ Example:
120
+
121
+ ```toml
122
+ [tool.bumpversion.custom]
123
+ key = "value"
124
+ a_list = ["key", "key2"]
125
+ ```
126
+
127
+ ## Versioning
128
+
129
+ Versioning configuration is very similar to
130
+ [bump-my-version](https://github.com/callowayproject/bump-my-version?tab=readme-ov-file#semantic-versioning-example),
131
+ but with a few simplifications.
132
+
133
+ The default configuration will support the typical semver use case of `X.Y.Z`
134
+ version strings.
135
+
136
+ ### `current_version`
137
+ _**[optional]**_<br />
138
+ **default**: None
139
+
140
+ The minimum required configuration to manage versions is the current version,
141
+ which can be moved directly from `[tool.bumpversion]`
142
+
143
+ ```toml
144
+ [tool.bumpversion]
145
+ current_version = "1.2.3"
146
+ ```
147
+
148
+ ### `files`
149
+ _**[optional]**_<br />
150
+ **default**: None
151
+
152
+ If multiple files have the current version string in them, they can be
153
+ configured for replacement.
154
+
155
+ Where the version string can safely be replaced with the default pattern
156
+ `{version}`, use:
157
+
158
+ ```
159
+ [[tool.bumpversion.files]]
160
+ filename = "README.md"
161
+ ```
162
+
163
+ For files that might contain other version strings that could match and
164
+ shouldn't be updated, a search/replace pattern can be configured.
165
+
166
+ ```
167
+ [[tool.bumpversion.files]]
168
+ filename = "pyproject.toml"
169
+ pattern = 'version = "{version}"'
170
+ ```
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
3
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg"
5
+ width="1200.000000pt" height="867.000000pt" viewBox="0 0 1200.000000 867.000000"
6
+ preserveAspectRatio="xMidYMid meet">
7
+
8
+ <g transform="translate(0.000000,867.000000) scale(0.100000,-0.100000)"
9
+ fill="#000000" stroke="none">
10
+ <path d="M5217 8013 c-3 -5 -507 -1396 -1120 -3093 -614 -1697 -1210 -3347
11
+ -1326 -3668 -116 -321 -211 -587 -211 -593 0 -5 1297 -9 3440 -9 2746 0 3440
12
+ 3 3439 13 0 6 -597 1664 -1327 3682 l-1328 3670 -781 3 c-430 1 -784 -1 -786
13
+ -5z m2620 -3788 c114 -34 185 -127 185 -244 0 -54 -15 -98 -150 -435 l-149
14
+ -375 57 -35 c69 -43 152 -130 185 -195 59 -118 60 -127 60 -616 0 -438 -1
15
+ -451 -21 -495 -12 -25 -36 -60 -55 -78 -68 -69 -50 -66 -519 -72 l-425 -5 2
16
+ -37 c5 -77 69 -159 153 -197 42 -19 65 -21 328 -21 320 0 297 7 265 -85 -10
17
+ -31 -34 -67 -63 -96 -84 -84 -11 -79 -1211 -79 -663 0 -1095 4 -1160 10 -357
18
+ 37 -675 185 -927 433 -224 220 -350 445 -430 767 l-26 105 -3 623 -4 622 38 0
19
+ c218 -2 428 -197 465 -433 12 -77 12 -77 43 -77 98 0 241 -66 325 -150 84 -85
20
+ 150 -227 150 -327 l0 -33 -256 0 -257 0 7 -61 c29 -255 250 -449 511 -449 163
21
+ 0 316 72 499 233 37 32 156 157 266 277 309 338 436 438 621 490 63 17 104 20
22
+ 279 20 l205 0 384 480 c396 497 418 520 504 540 49 12 69 11 124 -5z"/>
23
+ <path d="M7456 3590 c-163 -203 -296 -372 -296 -375 0 -3 68 -4 152 -3 l152 3
24
+ 148 369 c81 203 146 371 144 373 -2 2 -137 -163 -300 -367z"/>
25
+ <path d="M6824 2176 c-49 -22 -74 -61 -74 -118 0 -43 5 -55 33 -83 43 -43 79
26
+ -52 131 -34 107 37 115 184 13 232 -42 20 -62 21 -103 3z"/>
27
+ </g>
28
+ </svg>
@@ -0,0 +1,92 @@
1
+ # Hooks
2
+
3
+ During the version bump process, some internal hooks to bumping version files
4
+ are run, during this step custom hooks can be run as well if there are other
5
+ steps you need to run as part of a release. A good example of this could be
6
+ regenerating automated docstring documentation.
7
+
8
+ The hook function format is relatively simple, it takes in the current context,
9
+ as well as the new version string, and must return a list of the
10
+ files, if any, that were modified. The new version is provided to allow
11
+ using the values as parameters if required. The context object provides
12
+ messaging ability as well as access to the current config object.
13
+
14
+ ```python
15
+ from bumpversion_slim.context import Context
16
+
17
+ def my_hook(context: Context, new: str) -> list[str]:
18
+ # Perform desired operation
19
+
20
+ context.error("Display something to the user.")
21
+ return ["/path/to/file1", "/path/to/file2"]
22
+ ```
23
+ See
24
+ [hooks](https://nrwldev.github.io/bumpversion-slim/configuration/#hooks)
25
+ for details on configuring custom hooks.
26
+
27
+
28
+ ## Context
29
+
30
+ The context object provides access to the current configuration
31
+ `context.config` as well as to convenience methods for outputting information,
32
+ based on current verbosity settings.
33
+
34
+ * error: Always display
35
+ * warning: Display for -v verbosity or higher
36
+ * info: Display for -vv verbosity or higher
37
+ * debug: Display for -vvv verbosity or higher
38
+
39
+ The above methods accept a % format string, and `*args`. i.e.
40
+ `context.error("Hello, %s", "world")`. To access the current version, extract
41
+ it from `context.config.current_version`.
42
+
43
+ ### Configuration
44
+
45
+ Custom configuration can be accessed with `context.config.custom`. This is a
46
+ dictionary containing all values defined in `[tool.bumpversion.custom]`. See
47
+ [custom](https://nrwldev.github.io/bumpversion/configuration/#custom) for
48
+ details on providing custom configuration.
49
+
50
+ ## Example
51
+
52
+ Here is a full example used in another project to generate `.md` files from
53
+ docstrings (using pdoc3 library), this will output a `module_name/` directory
54
+ in the local `docs/` directory containing all modules and submodule `.md`
55
+ files.
56
+
57
+
58
+ ```python
59
+ import re
60
+ from pathlib import Path
61
+
62
+ import pdoc
63
+ from bumpversion_slim.context import Context
64
+
65
+
66
+ def hook(context: Context, _new: str) -> list[str]:
67
+ output_dir = Path("./docs")
68
+ modules = ["module_name"]
69
+ pcontext = pdoc.Context()
70
+
71
+ modules = [pdoc.Module(mod, context=pcontext) for mod in modules]
72
+ pdoc.link_inheritance(pcontext)
73
+
74
+ def recursive_mds(mod: pdoc.Module) -> pdoc.Module:
75
+ yield mod
76
+ for submod in mod.submodules():
77
+ yield from recursive_mds(submod)
78
+
79
+ paths = []
80
+
81
+ for mod in modules:
82
+ for module in recursive_mds(mod):
83
+ path = re.sub(r"\.html$", ".md", module.url())
84
+ out = output_dir / path
85
+ out.parent.mkdir(exist_ok=True, parents=True)
86
+ with out.open("w") as f:
87
+ f.write(module.text())
88
+ context.info("Generated documentation for %s module", module.name)
89
+ paths.append(str(out))
90
+
91
+ return paths
92
+ ```
@@ -0,0 +1,37 @@
1
+ # Overview
2
+
3
+ This tool is intended as a very light version of
4
+ [bump-my-version](https://github.com/callowayproject/bump-my-version). It does
5
+ not provide semantic version generation, instead relying on the version
6
+ specifically being supplied. This is due to this projects intention of
7
+ augmenting [git-cliff](), which provides changelog generation from conventional
8
+ commits as well as semantic versioning, but does not provide file update
9
+ functionality or commit/tag support.
10
+
11
+ A basic pyproject.toml configuration can be as simple as:
12
+
13
+ ```toml
14
+ [tool.bumpversion]
15
+ current_version = "0.0.0"
16
+ commit_extra = ["CHANGELOG.md"]
17
+ ```
18
+
19
+ ## Bumping the version
20
+
21
+ Run `bumpversion VERSION_STRING` to update configured files with the new
22
+ version string, commit and tag the release.
23
+
24
+ If using in conjunction with `git-cliff` you can output the latest version
25
+ string from the cli, and provide it to `bumpversion-slim`.
26
+
27
+ ```console
28
+ > git-cliff --config pyproject.toml --bump -o CHANGELOG.md
29
+ > VERSION=$(git-cliff --bumped-version)
30
+ > bumpversion $VERSION
31
+ ```
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install bumpversion-slim
37
+ ```
@@ -0,0 +1,53 @@
1
+ # Usage
2
+
3
+ ## Getting started
4
+
5
+ This tool is intended as a very light version of
6
+ [bump-my-version](https://github.com/callowayproject/bump-my-version). It does
7
+ not provide semantic version generation, instead relying on the version
8
+ specifically being supplied. This is due to this projects intention of
9
+ augmenting [git-cliff](), which provides changelog generation from conventional
10
+ commits as well as semantic versioning, but does not provide file update
11
+ functionality or commit/tag support.
12
+
13
+ A basic pyproject.toml configuration can be as simple as:
14
+
15
+ ```toml
16
+ [tool.bumpversion]
17
+ current_version = "0.0.0"
18
+ commit_extra = ["CHANGELOG.md"]
19
+ ```
20
+
21
+ ## Bumping the version
22
+
23
+ Run `bumpversion VERSION_STRING` to update configured files with the new
24
+ version string, commit and tag the release.
25
+
26
+ If using in conjunction with `git-cliff` you can output the latest version
27
+ string from the cli, and provide it to `bumpversion-slim`.
28
+
29
+ ```console
30
+ > git-cliff --config pyproject.toml --bump -o CHANGELOG.md
31
+ > VERSION=$(git-cliff --bumped-version)
32
+ > bumpversion $VERSION
33
+ ```
34
+
35
+ ### CLI options and toggles
36
+
37
+ These options allow customising on a per run basis.
38
+
39
+ * `--dry-run` extract changes and preview the proposed changelog and version
40
+ without committing or tagging any changes.
41
+ * `-v[vv]` increase the output verbosity, handy if an error occurs or behaviour
42
+ does not appear to match expectations.
43
+
44
+ The following toggles allow overriding configuration per run.
45
+
46
+ * `--allow-dirty/--no-allow-dirty` toggle configuration for allowing/rejecting git dirty status.
47
+ * `--allow-missing/--no-allow-missing` toggle configuration for allowing/rejecting missing commits in local/remote.
48
+ * `--reject-empty/--no-reject-empty` toggle configuration for updating configured files.
49
+ * `--commit/--no-commit` toggle configuration for committing changes.
50
+ * `--tag/--no-tag` toggle configuration for tagging release changes.
51
+
52
+ See [Configuration](/bumpversion/configuration) for additional configuration and cli flags that are available.
53
+ and how to customize them.