uv-dynamic-versioning 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.
@@ -0,0 +1,23 @@
1
+ name: Publish package
2
+
3
+ on:
4
+ release:
5
+ types: ["created"]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: 3.11
15
+ cache: "pip"
16
+ - run: pip install -r requirements.txt
17
+ - name: build
18
+ run: uvx --from build pyproject-build
19
+ - name: publish
20
+ env:
21
+ TWINE_USERNAME: __token__
22
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
23
+ run: uvx twine upload dist/*
@@ -0,0 +1,26 @@
1
+ name: Test
2
+
3
+ on: ["pull_request", "push"]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ python-version: ["3.10", 3.11, 3.12]
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: ${{ matrix.python-version }}
16
+ cache: "pip"
17
+ - run: pip install -r requirements.txt
18
+ - uses: actions/cache@v4
19
+ with:
20
+ path: ~/.cache/uv
21
+ key: uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
22
+ - run: uv sync --frozen
23
+ - run: |
24
+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
25
+ git config --global user.name "github-actions[bot]"
26
+ - run: uv run pytest
@@ -0,0 +1,162 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
@@ -0,0 +1,36 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: check-added-large-files
6
+ - id: check-toml
7
+ - id: check-yaml
8
+ args:
9
+ - --unsafe
10
+ - id: end-of-file-fixer
11
+ - id: trailing-whitespace
12
+
13
+ - repo: https://github.com/astral-sh/uv-pre-commit
14
+ rev: 0.4.0
15
+ hooks:
16
+ - id: uv-lock
17
+
18
+ - repo: https://github.com/ninoseki/uv-sort
19
+ rev: v0.1.0
20
+ hooks:
21
+ - id: uv-sort
22
+
23
+ - repo: https://github.com/asottile/pyupgrade
24
+ rev: v3.17.0
25
+ hooks:
26
+ - id: pyupgrade
27
+ args:
28
+ - --py310-plus
29
+
30
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
31
+ rev: v0.6.3
32
+ hooks:
33
+ - id: ruff
34
+ args:
35
+ - --fix
36
+ - id: ruff-format
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Manabu Niseki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,197 @@
1
+ Metadata-Version: 2.3
2
+ Name: uv-dynamic-versioning
3
+ Version: 0.1.0
4
+ Summary: Dynamic versioning based on VCS tags for uv/hatch project
5
+ License: MIT License
6
+
7
+ Copyright (c) 2024 Manabu Niseki
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ License-File: LICENSE
27
+ Keywords: hatch,uv
28
+ Classifier: Framework :: Hatch
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Programming Language :: Python
31
+ Classifier: Programming Language :: Python :: 3.10
32
+ Classifier: Programming Language :: Python :: 3.11
33
+ Classifier: Programming Language :: Python :: 3.12
34
+ Requires-Python: >=3.10
35
+ Requires-Dist: dunamai>=1.22.0
36
+ Requires-Dist: hatchling>=1.25.0
37
+ Requires-Dist: pydantic>=2.8.2
38
+ Requires-Dist: returns>=0.23.0
39
+ Requires-Dist: tomlkit>=0.13.2
40
+ Description-Content-Type: text/markdown
41
+
42
+ # uv-dynamic-versioning
43
+
44
+ [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning) influenced dynamic versioning tool for [uv](https://github.com/astral-sh/uv)/[hatch](https://github.com/pypa/hatch), powered by [dunamai](https://github.com/mtkennerly/dunamai/).
45
+
46
+ ## Installation
47
+
48
+ Update or add `build-system` and `tool.hatch.version` in your `pyproject.toml` to use `uv-dynamic-versioning`.
49
+
50
+ ```toml
51
+ [build-system]
52
+ requires = ["hatchling", "uv-dynamic-versioning"]
53
+ build-backend = "hatchling.build"
54
+
55
+ [tool.hatch.version]
56
+ source = "uv-dynamic-versioning"
57
+ ```
58
+
59
+ Also remove `version` in `project` and set `dynamic` (`dynamic = ["version"]`).
60
+
61
+ **Before**
62
+
63
+ ```toml
64
+ [project]
65
+ name = "..."
66
+ version = "0.1.0"
67
+ ```
68
+
69
+ **After**
70
+
71
+ ```toml
72
+ [project]
73
+ name = "..."
74
+ dynamic = ["version"]
75
+ ```
76
+
77
+ ## Configuration
78
+
79
+ > [!NOTE]
80
+ >
81
+ > - Configuration is almost same to [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning). But `format-jinja`, `format-jinja-imports` are not supported.
82
+ > - The following descriptions are excerpts from [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning).
83
+
84
+ In your `pyproject.toml`, you may configure the following options:
85
+
86
+ - `[tool.uv-dynamic-versioning]`:
87
+ General options.
88
+
89
+ - `vcs` (string, default: `any`):
90
+ This is the version control system to check for a version.
91
+ One of: `any`, `git`, `mercurial`, `darcs`, `bazaar`, `subversion`, `fossil`, `pijul`.
92
+ - `metadata` (boolean, default: unset):
93
+ If true, include the commit hash in the version,
94
+ and also include a dirty flag if `dirty` is true.
95
+ If unset, metadata will only be included if you are on a commit without a version tag.
96
+ This is ignored when `format` or `format-jinja` is used.
97
+ - `tagged-metadata` (boolean, default: false):
98
+ If true, include any tagged metadata discovered as the first part of the metadata segment.
99
+ Has no effect when `metadata` is set to false.
100
+ This is ignored when `format` or `format-jinja` is used.
101
+ - `dirty` (boolean, default: false):
102
+ If true, include a dirty flag in the metadata,
103
+ indicating whether there are any uncommitted changes.
104
+ Has no effect when `metadata` is set to false.
105
+ This is ignored when `format` or `format-jinja` is used.
106
+ - `pattern` (string):
107
+ This is a regular expression which will be used to find a tag representing a version.
108
+ When this is unset, Dunamai's default pattern is used.
109
+
110
+ There must be a capture group named `base` with the main part of the version.
111
+ Optionally, it may contain another two groups named `stage` and `revision` for prereleases,
112
+ and it may contain a group named `tagged_metadata` to be used with the `tagged-metadata` option.
113
+ There may also be a group named `epoch` for the PEP 440 concept.
114
+
115
+ If the `base` group is not included,
116
+ then this will be interpreted as a named preset from the Dunamai `Pattern` class.
117
+ This includes: `default`, `default-unprefixed` (makes the `v` prefix optional).
118
+
119
+ You can check the default for your installed version of Dunamai by running this command:
120
+
121
+ ```bash
122
+ poetry run python -c "import dunamai; print(dunamai.Pattern.Default.regex())"
123
+ ```
124
+
125
+ Remember that backslashes must be escaped in the TOML file.
126
+
127
+ ```toml
128
+ # Regular expression:
129
+ pattern = '(?P<base>\d+\.\d+\.\d+)'
130
+ # Named preset:
131
+ pattern = "default-unprefixed"
132
+ ```
133
+
134
+ - `pattern-prefix` (string):
135
+ This will be inserted after the pattern's start anchor (`^`).
136
+ For example, to match tags like `some-package-v1.2.3`,
137
+ you can keep the default pattern and set the prefix to `some-package-`.
138
+ - `format` (string, default: unset):
139
+ This defines a custom output format for the version. Available substitutions:
140
+
141
+ - `{base}`
142
+ - `{stage}`
143
+ - `{revision}`
144
+ - `{distance}`
145
+ - `{commit}`
146
+ - `{dirty}`
147
+ - `{tagged_metadata}`
148
+ - `{branch}`
149
+ - `{branch_escaped}` which omits any non-letter/number characters
150
+ - `{timestamp}` of the current commit, which expands to YYYYmmddHHMMSS as UTC
151
+
152
+ Example: `v{base}+{distance}.{commit}`
153
+
154
+ - `style` (string, default: unset):
155
+ One of: `pep440`, `semver`, `pvp`.
156
+ These are preconfigured output formats.
157
+ If you set both a `style` and a `format`,
158
+ then the format will be validated against the style's rules.
159
+ If `style` is unset, the default output format will follow PEP 440,
160
+ but a custom `format` will only be validated if `style` is set explicitly.
161
+ - `latest-tag` (boolean, default: false):
162
+ If true, then only check the latest tag for a version,
163
+ rather than looking through all the tags until a suitable one is found to match the `pattern`.
164
+ - `bump` (boolean, default: false):
165
+ If true, then increment the last part of the version `base` by 1,
166
+ unless the `stage` is set,
167
+ in which case increment the `revision` by 1 or set it to a default of 2 if there was no `revision`.
168
+ Does nothing when on a commit with a version tag.
169
+
170
+ Example, if there have been 3 commits since the `v1.3.1` tag:
171
+
172
+ - PEP 440 with `bump = false`: `1.3.1.post3.dev0+28c1684`
173
+ - PEP 440 with `bump = true`: `1.3.2.dev3+28c1684`
174
+
175
+ - `tag-branch` (string, default: unset):
176
+ Branch on which to find tags, if different than the current branch.
177
+ This is only used for Git currently.
178
+ - `full-commit` (boolean, default: false):
179
+ If true, get the full commit hash instead of the short form.
180
+ This is only used for Git and Mercurial.
181
+ - `strict` (boolean, default: false):
182
+ If true, then fail instead of falling back to 0.0.0 when there are no tags.
183
+ - `ignore-untracked` (boolean, default: false):
184
+ If true, ignore untracked files when determining whether the repository is dirty.
185
+
186
+ Simple example:
187
+
188
+ ```toml
189
+ [tool.uv-dynamic-versioning]
190
+ vcs = "git"
191
+ style = "semver"
192
+ ```
193
+
194
+ ## Alternatives
195
+
196
+ - [hatch-vcs](https://github.com/ofek/hatch-vcs)
197
+ - [versioningit](https://github.com/jwodder/versioningit)
@@ -0,0 +1,156 @@
1
+ # uv-dynamic-versioning
2
+
3
+ [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning) influenced dynamic versioning tool for [uv](https://github.com/astral-sh/uv)/[hatch](https://github.com/pypa/hatch), powered by [dunamai](https://github.com/mtkennerly/dunamai/).
4
+
5
+ ## Installation
6
+
7
+ Update or add `build-system` and `tool.hatch.version` in your `pyproject.toml` to use `uv-dynamic-versioning`.
8
+
9
+ ```toml
10
+ [build-system]
11
+ requires = ["hatchling", "uv-dynamic-versioning"]
12
+ build-backend = "hatchling.build"
13
+
14
+ [tool.hatch.version]
15
+ source = "uv-dynamic-versioning"
16
+ ```
17
+
18
+ Also remove `version` in `project` and set `dynamic` (`dynamic = ["version"]`).
19
+
20
+ **Before**
21
+
22
+ ```toml
23
+ [project]
24
+ name = "..."
25
+ version = "0.1.0"
26
+ ```
27
+
28
+ **After**
29
+
30
+ ```toml
31
+ [project]
32
+ name = "..."
33
+ dynamic = ["version"]
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ > [!NOTE]
39
+ >
40
+ > - Configuration is almost same to [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning). But `format-jinja`, `format-jinja-imports` are not supported.
41
+ > - The following descriptions are excerpts from [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning).
42
+
43
+ In your `pyproject.toml`, you may configure the following options:
44
+
45
+ - `[tool.uv-dynamic-versioning]`:
46
+ General options.
47
+
48
+ - `vcs` (string, default: `any`):
49
+ This is the version control system to check for a version.
50
+ One of: `any`, `git`, `mercurial`, `darcs`, `bazaar`, `subversion`, `fossil`, `pijul`.
51
+ - `metadata` (boolean, default: unset):
52
+ If true, include the commit hash in the version,
53
+ and also include a dirty flag if `dirty` is true.
54
+ If unset, metadata will only be included if you are on a commit without a version tag.
55
+ This is ignored when `format` or `format-jinja` is used.
56
+ - `tagged-metadata` (boolean, default: false):
57
+ If true, include any tagged metadata discovered as the first part of the metadata segment.
58
+ Has no effect when `metadata` is set to false.
59
+ This is ignored when `format` or `format-jinja` is used.
60
+ - `dirty` (boolean, default: false):
61
+ If true, include a dirty flag in the metadata,
62
+ indicating whether there are any uncommitted changes.
63
+ Has no effect when `metadata` is set to false.
64
+ This is ignored when `format` or `format-jinja` is used.
65
+ - `pattern` (string):
66
+ This is a regular expression which will be used to find a tag representing a version.
67
+ When this is unset, Dunamai's default pattern is used.
68
+
69
+ There must be a capture group named `base` with the main part of the version.
70
+ Optionally, it may contain another two groups named `stage` and `revision` for prereleases,
71
+ and it may contain a group named `tagged_metadata` to be used with the `tagged-metadata` option.
72
+ There may also be a group named `epoch` for the PEP 440 concept.
73
+
74
+ If the `base` group is not included,
75
+ then this will be interpreted as a named preset from the Dunamai `Pattern` class.
76
+ This includes: `default`, `default-unprefixed` (makes the `v` prefix optional).
77
+
78
+ You can check the default for your installed version of Dunamai by running this command:
79
+
80
+ ```bash
81
+ poetry run python -c "import dunamai; print(dunamai.Pattern.Default.regex())"
82
+ ```
83
+
84
+ Remember that backslashes must be escaped in the TOML file.
85
+
86
+ ```toml
87
+ # Regular expression:
88
+ pattern = '(?P<base>\d+\.\d+\.\d+)'
89
+ # Named preset:
90
+ pattern = "default-unprefixed"
91
+ ```
92
+
93
+ - `pattern-prefix` (string):
94
+ This will be inserted after the pattern's start anchor (`^`).
95
+ For example, to match tags like `some-package-v1.2.3`,
96
+ you can keep the default pattern and set the prefix to `some-package-`.
97
+ - `format` (string, default: unset):
98
+ This defines a custom output format for the version. Available substitutions:
99
+
100
+ - `{base}`
101
+ - `{stage}`
102
+ - `{revision}`
103
+ - `{distance}`
104
+ - `{commit}`
105
+ - `{dirty}`
106
+ - `{tagged_metadata}`
107
+ - `{branch}`
108
+ - `{branch_escaped}` which omits any non-letter/number characters
109
+ - `{timestamp}` of the current commit, which expands to YYYYmmddHHMMSS as UTC
110
+
111
+ Example: `v{base}+{distance}.{commit}`
112
+
113
+ - `style` (string, default: unset):
114
+ One of: `pep440`, `semver`, `pvp`.
115
+ These are preconfigured output formats.
116
+ If you set both a `style` and a `format`,
117
+ then the format will be validated against the style's rules.
118
+ If `style` is unset, the default output format will follow PEP 440,
119
+ but a custom `format` will only be validated if `style` is set explicitly.
120
+ - `latest-tag` (boolean, default: false):
121
+ If true, then only check the latest tag for a version,
122
+ rather than looking through all the tags until a suitable one is found to match the `pattern`.
123
+ - `bump` (boolean, default: false):
124
+ If true, then increment the last part of the version `base` by 1,
125
+ unless the `stage` is set,
126
+ in which case increment the `revision` by 1 or set it to a default of 2 if there was no `revision`.
127
+ Does nothing when on a commit with a version tag.
128
+
129
+ Example, if there have been 3 commits since the `v1.3.1` tag:
130
+
131
+ - PEP 440 with `bump = false`: `1.3.1.post3.dev0+28c1684`
132
+ - PEP 440 with `bump = true`: `1.3.2.dev3+28c1684`
133
+
134
+ - `tag-branch` (string, default: unset):
135
+ Branch on which to find tags, if different than the current branch.
136
+ This is only used for Git currently.
137
+ - `full-commit` (boolean, default: false):
138
+ If true, get the full commit hash instead of the short form.
139
+ This is only used for Git and Mercurial.
140
+ - `strict` (boolean, default: false):
141
+ If true, then fail instead of falling back to 0.0.0 when there are no tags.
142
+ - `ignore-untracked` (boolean, default: false):
143
+ If true, ignore untracked files when determining whether the repository is dirty.
144
+
145
+ Simple example:
146
+
147
+ ```toml
148
+ [tool.uv-dynamic-versioning]
149
+ vcs = "git"
150
+ style = "semver"
151
+ ```
152
+
153
+ ## Alternatives
154
+
155
+ - [hatch-vcs](https://github.com/ofek/hatch-vcs)
156
+ - [versioningit](https://github.com/jwodder/versioningit)
@@ -0,0 +1,57 @@
1
+ [project]
2
+ name = "uv-dynamic-versioning"
3
+ dynamic = ["version"]
4
+ description = "Dynamic versioning based on VCS tags for uv/hatch project"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = { file = "LICENSE" }
8
+ keywords = ["uv", "hatch"]
9
+ classifiers = [
10
+ "License :: OSI Approved :: MIT License",
11
+ "Programming Language :: Python",
12
+ "Programming Language :: Python :: 3.10",
13
+ "Programming Language :: Python :: 3.11",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Framework :: Hatch",
16
+ ]
17
+ dependencies = [
18
+ "dunamai>=1.22.0",
19
+ "hatchling>=1.25.0",
20
+ "pydantic>=2.8.2",
21
+ "returns>=0.23.0",
22
+ "tomlkit>=0.13.2",
23
+ ]
24
+
25
+ [project.entry-points.hatch]
26
+ uv-dynamic-versioning = "uv_dynamic_versioning.hooks"
27
+
28
+ [build-system]
29
+ requires = ["hatchling"]
30
+ build-backend = "hatchling.build"
31
+
32
+ [tool.hatch.version]
33
+ path = "src/uv_dynamic_versioning/__init__.py"
34
+
35
+ [tool.uv]
36
+ dev-dependencies = [
37
+ "gitpython>=3.1.43",
38
+ "pre-commit>=3.8.0",
39
+ "pytest>=8.3.2",
40
+ "pytest-pretty>=1.2.0",
41
+ "pytest-randomly>=3.15.0",
42
+ ]
43
+
44
+ [tool.ruff.lint]
45
+ select = [
46
+ "B", # flake8-bugbear
47
+ "C", # flake8-comprehensions
48
+ "E", # pycodestyle errors
49
+ "F", # pyflakes
50
+ "I", # isort
51
+ "N", # pep8-naming
52
+ "RET", # flake8-return
53
+ "RUF", # Ruff-specific rules
54
+ "SIM", # flake8-simplify
55
+ "T20", # flake8-print
56
+ "W", # pycodestyle warnings
57
+ ]
@@ -0,0 +1 @@
1
+ uv==0.4.1
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,8 @@
1
+ from hatchling.plugin import hookimpl
2
+
3
+ from .version_source import DynamicVersionSource
4
+
5
+
6
+ @hookimpl
7
+ def hatch_register_version_source():
8
+ return DynamicVersionSource