Name | uv-dynamic-versioning JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | Dynamic versioning based on VCS tags for uv/hatch project |
upload_time | 2024-09-25 10:43:24 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <4.0,>=3.9 |
license | MIT License Copyright (c) 2024 Manabu Niseki Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
hatch
uv
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# uv-dynamic-versioning
[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/).
## Installation
Update or add `build-system` and `tool.hatch.version` in your `pyproject.toml` to use `uv-dynamic-versioning`.
```toml
[build-system]
requires = ["hatchling", "uv-dynamic-versioning"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "uv-dynamic-versioning"
```
Also remove `version` in `project` and set `dynamic` (`dynamic = ["version"]`).
**Before**
```toml
[project]
name = "..."
version = "0.1.0"
```
**After**
```toml
[project]
name = "..."
dynamic = ["version"]
```
## Configuration
> [!NOTE]
>
> - Configuration is almost same to [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning). But `format-jinja`, `format-jinja-imports` are not supported.
> - The following descriptions are excerpts from [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning).
In your `pyproject.toml`, you may configure the following options:
- `[tool.uv-dynamic-versioning]`:
General options.
- `vcs` (string, default: `any`):
This is the version control system to check for a version.
One of: `any`, `git`, `mercurial`, `darcs`, `bazaar`, `subversion`, `fossil`, `pijul`.
- `metadata` (boolean, default: unset):
If true, include the commit hash in the version,
and also include a dirty flag if `dirty` is true.
If unset, metadata will only be included if you are on a commit without a version tag.
This is ignored when `format` or `format-jinja` is used.
- `tagged-metadata` (boolean, default: false):
If true, include any tagged metadata discovered as the first part of the metadata segment.
Has no effect when `metadata` is set to false.
This is ignored when `format` or `format-jinja` is used.
- `dirty` (boolean, default: false):
If true, include a dirty flag in the metadata,
indicating whether there are any uncommitted changes.
Has no effect when `metadata` is set to false.
This is ignored when `format` or `format-jinja` is used.
- `pattern` (string):
This is a regular expression which will be used to find a tag representing a version.
When this is unset, Dunamai's default pattern is used.
There must be a capture group named `base` with the main part of the version.
Optionally, it may contain another two groups named `stage` and `revision` for prereleases,
and it may contain a group named `tagged_metadata` to be used with the `tagged-metadata` option.
There may also be a group named `epoch` for the PEP 440 concept.
If the `base` group is not included,
then this will be interpreted as a named preset from the Dunamai `Pattern` class.
This includes: `default`, `default-unprefixed` (makes the `v` prefix optional).
You can check the default for your installed version of Dunamai by running this command:
```bash
poetry run python -c "import dunamai; print(dunamai.Pattern.Default.regex())"
```
Remember that backslashes must be escaped in the TOML file.
```toml
# Regular expression:
pattern = '(?P<base>\d+\.\d+\.\d+)'
# Named preset:
pattern = "default-unprefixed"
```
- `pattern-prefix` (string):
This will be inserted after the pattern's start anchor (`^`).
For example, to match tags like `some-package-v1.2.3`,
you can keep the default pattern and set the prefix to `some-package-`.
- `format` (string, default: unset):
This defines a custom output format for the version. Available substitutions:
- `{base}`
- `{stage}`
- `{revision}`
- `{distance}`
- `{commit}`
- `{dirty}`
- `{tagged_metadata}`
- `{branch}`
- `{branch_escaped}` which omits any non-letter/number characters
- `{timestamp}` of the current commit, which expands to YYYYmmddHHMMSS as UTC
Example: `v{base}+{distance}.{commit}`
- `style` (string, default: unset):
One of: `pep440`, `semver`, `pvp`.
These are preconfigured output formats.
If you set both a `style` and a `format`,
then the format will be validated against the style's rules.
If `style` is unset, the default output format will follow PEP 440,
but a custom `format` will only be validated if `style` is set explicitly.
- `latest-tag` (boolean, default: false):
If true, then only check the latest tag for a version,
rather than looking through all the tags until a suitable one is found to match the `pattern`.
- `bump` (boolean, default: false):
If true, then increment the last part of the version `base` by 1,
unless the `stage` is set,
in which case increment the `revision` by 1 or set it to a default of 2 if there was no `revision`.
Does nothing when on a commit with a version tag.
Example, if there have been 3 commits since the `v1.3.1` tag:
- PEP 440 with `bump = false`: `1.3.1.post3.dev0+28c1684`
- PEP 440 with `bump = true`: `1.3.2.dev3+28c1684`
- `tag-branch` (string, default: unset):
Branch on which to find tags, if different than the current branch.
This is only used for Git currently.
- `full-commit` (boolean, default: false):
If true, get the full commit hash instead of the short form.
This is only used for Git and Mercurial.
- `strict` (boolean, default: false):
If true, then fail instead of falling back to 0.0.0 when there are no tags.
- `ignore-untracked` (boolean, default: false):
If true, ignore untracked files when determining whether the repository is dirty.
Simple example:
```toml
[tool.uv-dynamic-versioning]
vcs = "git"
style = "semver"
```
## Alternatives
- [hatch-vcs](https://github.com/ofek/hatch-vcs)
- [versioningit](https://github.com/jwodder/versioningit)
Raw data
{
"_id": null,
"home_page": null,
"name": "uv-dynamic-versioning",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "hatch, uv",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/75/e2/a36162279305dfe3bc93f96d8a45f5d09f6b21563dd39fcc98e96694a8c2/uv_dynamic_versioning-0.2.0.tar.gz",
"platform": null,
"description": "# uv-dynamic-versioning\n\n[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/).\n\n## Installation\n\nUpdate or add `build-system` and `tool.hatch.version` in your `pyproject.toml` to use `uv-dynamic-versioning`.\n\n```toml\n[build-system]\nrequires = [\"hatchling\", \"uv-dynamic-versioning\"]\nbuild-backend = \"hatchling.build\"\n\n[tool.hatch.version]\nsource = \"uv-dynamic-versioning\"\n```\n\nAlso remove `version` in `project` and set `dynamic` (`dynamic = [\"version\"]`).\n\n**Before**\n\n```toml\n[project]\nname = \"...\"\nversion = \"0.1.0\"\n```\n\n**After**\n\n```toml\n[project]\nname = \"...\"\ndynamic = [\"version\"]\n```\n\n## Configuration\n\n> [!NOTE]\n>\n> - Configuration is almost same to [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning). But `format-jinja`, `format-jinja-imports` are not supported.\n> - The following descriptions are excerpts from [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning).\n\nIn your `pyproject.toml`, you may configure the following options:\n\n- `[tool.uv-dynamic-versioning]`:\n General options.\n\n - `vcs` (string, default: `any`):\n This is the version control system to check for a version.\n One of: `any`, `git`, `mercurial`, `darcs`, `bazaar`, `subversion`, `fossil`, `pijul`.\n - `metadata` (boolean, default: unset):\n If true, include the commit hash in the version,\n and also include a dirty flag if `dirty` is true.\n If unset, metadata will only be included if you are on a commit without a version tag.\n This is ignored when `format` or `format-jinja` is used.\n - `tagged-metadata` (boolean, default: false):\n If true, include any tagged metadata discovered as the first part of the metadata segment.\n Has no effect when `metadata` is set to false.\n This is ignored when `format` or `format-jinja` is used.\n - `dirty` (boolean, default: false):\n If true, include a dirty flag in the metadata,\n indicating whether there are any uncommitted changes.\n Has no effect when `metadata` is set to false.\n This is ignored when `format` or `format-jinja` is used.\n - `pattern` (string):\n This is a regular expression which will be used to find a tag representing a version.\n When this is unset, Dunamai's default pattern is used.\n\n There must be a capture group named `base` with the main part of the version.\n Optionally, it may contain another two groups named `stage` and `revision` for prereleases,\n and it may contain a group named `tagged_metadata` to be used with the `tagged-metadata` option.\n There may also be a group named `epoch` for the PEP 440 concept.\n\n If the `base` group is not included,\n then this will be interpreted as a named preset from the Dunamai `Pattern` class.\n This includes: `default`, `default-unprefixed` (makes the `v` prefix optional).\n\n You can check the default for your installed version of Dunamai by running this command:\n\n ```bash\n poetry run python -c \"import dunamai; print(dunamai.Pattern.Default.regex())\"\n ```\n\n Remember that backslashes must be escaped in the TOML file.\n\n ```toml\n # Regular expression:\n pattern = '(?P<base>\\d+\\.\\d+\\.\\d+)'\n # Named preset:\n pattern = \"default-unprefixed\"\n ```\n\n - `pattern-prefix` (string):\n This will be inserted after the pattern's start anchor (`^`).\n For example, to match tags like `some-package-v1.2.3`,\n you can keep the default pattern and set the prefix to `some-package-`.\n - `format` (string, default: unset):\n This defines a custom output format for the version. Available substitutions:\n\n - `{base}`\n - `{stage}`\n - `{revision}`\n - `{distance}`\n - `{commit}`\n - `{dirty}`\n - `{tagged_metadata}`\n - `{branch}`\n - `{branch_escaped}` which omits any non-letter/number characters\n - `{timestamp}` of the current commit, which expands to YYYYmmddHHMMSS as UTC\n\n Example: `v{base}+{distance}.{commit}`\n\n - `style` (string, default: unset):\n One of: `pep440`, `semver`, `pvp`.\n These are preconfigured output formats.\n If you set both a `style` and a `format`,\n then the format will be validated against the style's rules.\n If `style` is unset, the default output format will follow PEP 440,\n but a custom `format` will only be validated if `style` is set explicitly.\n - `latest-tag` (boolean, default: false):\n If true, then only check the latest tag for a version,\n rather than looking through all the tags until a suitable one is found to match the `pattern`.\n - `bump` (boolean, default: false):\n If true, then increment the last part of the version `base` by 1,\n unless the `stage` is set,\n in which case increment the `revision` by 1 or set it to a default of 2 if there was no `revision`.\n Does nothing when on a commit with a version tag.\n\n Example, if there have been 3 commits since the `v1.3.1` tag:\n\n - PEP 440 with `bump = false`: `1.3.1.post3.dev0+28c1684`\n - PEP 440 with `bump = true`: `1.3.2.dev3+28c1684`\n\n - `tag-branch` (string, default: unset):\n Branch on which to find tags, if different than the current branch.\n This is only used for Git currently.\n - `full-commit` (boolean, default: false):\n If true, get the full commit hash instead of the short form.\n This is only used for Git and Mercurial.\n - `strict` (boolean, default: false):\n If true, then fail instead of falling back to 0.0.0 when there are no tags.\n - `ignore-untracked` (boolean, default: false):\n If true, ignore untracked files when determining whether the repository is dirty.\n\nSimple example:\n\n```toml\n[tool.uv-dynamic-versioning]\nvcs = \"git\"\nstyle = \"semver\"\n```\n\n## Alternatives\n\n- [hatch-vcs](https://github.com/ofek/hatch-vcs)\n- [versioningit](https://github.com/jwodder/versioningit)\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Manabu Niseki Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Dynamic versioning based on VCS tags for uv/hatch project",
"version": "0.2.0",
"project_urls": {
"Repository": "https://github.com/ninoseki/uv-dynamic-versioning"
},
"split_keywords": [
"hatch",
" uv"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8512761d6810b2104a008c1a078ff2b5412534fcc2360614e0e6b80dc85b0239",
"md5": "94bcb8a8e74f04969e94b9c6ece4f781",
"sha256": "c1e9f12988c83f9d0b53458a3a038d4e2803b734e647fec0d6cd4679f6b9430b"
},
"downloads": -1,
"filename": "uv_dynamic_versioning-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "94bcb8a8e74f04969e94b9c6ece4f781",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 7382,
"upload_time": "2024-09-25T10:43:22",
"upload_time_iso_8601": "2024-09-25T10:43:22.790840Z",
"url": "https://files.pythonhosted.org/packages/85/12/761d6810b2104a008c1a078ff2b5412534fcc2360614e0e6b80dc85b0239/uv_dynamic_versioning-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "75e2a36162279305dfe3bc93f96d8a45f5d09f6b21563dd39fcc98e96694a8c2",
"md5": "7250e8e9d19a5cedb72c3c853b849957",
"sha256": "d6e60be0d4b2f59f81c0e65d0ab7073f7baaebfe9adc1d8dad6df0c8f86ceccb"
},
"downloads": -1,
"filename": "uv_dynamic_versioning-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7250e8e9d19a5cedb72c3c853b849957",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 27753,
"upload_time": "2024-09-25T10:43:24",
"upload_time_iso_8601": "2024-09-25T10:43:24.306842Z",
"url": "https://files.pythonhosted.org/packages/75/e2/a36162279305dfe3bc93f96d8a45f5d09f6b21563dd39fcc98e96694a8c2/uv_dynamic_versioning-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-25 10:43:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ninoseki",
"github_project": "uv-dynamic-versioning",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "uv-dynamic-versioning"
}