vcs-versioning 1.0.1__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.
- vcs_versioning-1.0.1/.gitignore +57 -0
- vcs_versioning-1.0.1/CHANGELOG.md +42 -0
- vcs_versioning-1.0.1/LICENSE.txt +9 -0
- vcs_versioning-1.0.1/PKG-INFO +44 -0
- vcs_versioning-1.0.1/README.md +21 -0
- vcs_versioning-1.0.1/_own_version_of_vcs_versioning.py +85 -0
- vcs_versioning-1.0.1/changelog.d/.gitkeep +8 -0
- vcs_versioning-1.0.1/changelog.d/README.md +32 -0
- vcs_versioning-1.0.1/changelog.d/template.md +21 -0
- vcs_versioning-1.0.1/pyproject.toml +183 -0
- vcs_versioning-1.0.1/src/vcs_versioning/__init__.py +110 -0
- vcs_versioning-1.0.1/src/vcs_versioning/__main__.py +6 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_backends/__init__.py +3 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_backends/_git.py +457 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_backends/_hg.py +302 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_backends/_hg_git.py +179 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_backends/_scm_workdir.py +51 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_cli/__init__.py +224 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_cli/_args.py +107 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_cli/git_archival_full.txt +7 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_cli/git_archival_stable.txt +4 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_compat.py +91 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_config.py +313 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_discover.py +68 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_dump_version.py +156 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_entrypoints.py +99 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_fallbacks.py +42 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_file_finders/__init__.py +115 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_file_finders/_git.py +142 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_file_finders/_hg.py +76 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_get_version_impl.py +266 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_integration.py +30 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_integrator_helpers.py +113 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_log.py +137 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_modify_version.py +61 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_node_utils.py +46 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_overrides.py +285 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_pyproject_reading.py +295 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_requirement_cls.py +26 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_run_cmd.py +211 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_scm_version.py +385 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_test_utils.py +256 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_toml.py +126 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_types.py +28 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_version_cls.py +100 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_version_inference.py +52 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_version_schemes/__init__.py +123 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_version_schemes/_common.py +62 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_version_schemes/_standard.py +260 -0
- vcs_versioning-1.0.1/src/vcs_versioning/_version_schemes/_towncrier.py +212 -0
- vcs_versioning-1.0.1/src/vcs_versioning/overrides.py +719 -0
- vcs_versioning-1.0.1/src/vcs_versioning/test_api.py +152 -0
- vcs_versioning-1.0.1/testing_vcs/__init__.py +1 -0
- vcs_versioning-1.0.1/testing_vcs/conftest.py +10 -0
- vcs_versioning-1.0.1/testing_vcs/test_better_root_errors.py +184 -0
- vcs_versioning-1.0.1/testing_vcs/test_compat.py +71 -0
- vcs_versioning-1.0.1/testing_vcs/test_config.py +56 -0
- vcs_versioning-1.0.1/testing_vcs/test_expect_parse.py +173 -0
- vcs_versioning-1.0.1/testing_vcs/test_file_finders.py +282 -0
- vcs_versioning-1.0.1/testing_vcs/test_git.py +891 -0
- vcs_versioning-1.0.1/testing_vcs/test_hg_git.py +122 -0
- vcs_versioning-1.0.1/testing_vcs/test_integrator_helpers.py +552 -0
- vcs_versioning-1.0.1/testing_vcs/test_internal_log_level.py +47 -0
- vcs_versioning-1.0.1/testing_vcs/test_mercurial.py +242 -0
- vcs_versioning-1.0.1/testing_vcs/test_overrides_api.py +709 -0
- vcs_versioning-1.0.1/testing_vcs/test_overrides_env_reader.py +264 -0
- vcs_versioning-1.0.1/testing_vcs/test_regressions.py +104 -0
- vcs_versioning-1.0.1/testing_vcs/test_version.py +645 -0
- vcs_versioning-1.0.1/testing_vcs/test_version_scheme_towncrier.py +516 -0
- vcs_versioning-1.0.1/testing_vcs/test_version_schemes.py +202 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
### JetBrains template
|
|
2
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion
|
|
3
|
+
|
|
4
|
+
*.iml
|
|
5
|
+
|
|
6
|
+
## Directory-based project format:
|
|
7
|
+
.idea/
|
|
8
|
+
|
|
9
|
+
### Other editors
|
|
10
|
+
.*.swp
|
|
11
|
+
.vscode/
|
|
12
|
+
|
|
13
|
+
### Python template
|
|
14
|
+
# Byte-compiled / optimized
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.py[cod]
|
|
17
|
+
*$py.class
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Distribution / packaging
|
|
21
|
+
.env/
|
|
22
|
+
env/
|
|
23
|
+
.venv/
|
|
24
|
+
venv/
|
|
25
|
+
build/
|
|
26
|
+
dist/
|
|
27
|
+
.eggs/
|
|
28
|
+
lib/
|
|
29
|
+
lib64/
|
|
30
|
+
*.egg-info/
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-wheel-metadata
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
.pytest_cache
|
|
44
|
+
.mypy_cache/
|
|
45
|
+
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
|
|
51
|
+
# Sphinx documentation
|
|
52
|
+
docs/_build/
|
|
53
|
+
|
|
54
|
+
# MkDocs documentation
|
|
55
|
+
site/
|
|
56
|
+
|
|
57
|
+
.serena/cache/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
<!-- towncrier release notes start -->
|
|
4
|
+
|
|
5
|
+
## 1.0.1 (2026-03-09)
|
|
6
|
+
|
|
7
|
+
### Miscellaneous
|
|
8
|
+
|
|
9
|
+
- Simplify release tag creation to use a single ``createRelease`` API call instead of separate ``createTag``/``createRef``/``createRelease`` calls, avoiding dangling tag objects on partial failures. ([#release-pipeline](https://github.com/pypa/setuptools-scm/issues/release-pipeline))
|
|
10
|
+
|
|
11
|
+
## 1.0.0 (2026-02-26)
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- First stable release of vcs-versioning as a standalone package. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Deprecated
|
|
19
|
+
|
|
20
|
+
- Rename `python-simplified-semver` to `semver-pep440` and `release-branch-semver` to `semver-pep440-release-branch` to prevent confusion with actual semver (which these schemes don't produce — they produce PEP 440-compliant versions). The old names still work but emit a deprecation warning. ([#679](https://github.com/pypa/setuptools-scm/issues/679))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Add experimental integrator workflow API for composable configuration building. Allows build backends to progressively build Configuration objects from pyproject.toml, distribution metadata, and manual overrides. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
26
|
+
- Add EnvReader class for structured reading of environment variable overrides with tool prefixes and distribution-specific variants (e.g., SETUPTOOLS_SCM_PRETEND vs VCS_VERSIONING_PRETEND). ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
27
|
+
- Requires Python 3.10 or newer. Modern type annotations and language features used throughout. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
28
|
+
- Add towncrier-fragments version scheme that infers version bumps based on changelog fragment types (feature=minor, bugfix=patch, removal=major). ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
29
|
+
- Initial release of vcs-versioning as a standalone package. Core version inference logic extracted from setuptools-scm for reuse by other build backends and tools. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Miscellaneous
|
|
33
|
+
|
|
34
|
+
- Improved CLI type safety with OutputData TypedDict and better type annotations throughout CLI handling. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
35
|
+
- Modernized type annotations to Python 3.10+ syntax throughout codebase. Generated version files now use modern `tuple[int | str, ...]` syntax with `from __future__ import annotations`. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
36
|
+
- Enhanced GlobalOverrides: env_reader is now a required validated field. additional_loggers changed from string to tuple of logger instances for better type safety. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
37
|
+
- Converted _cli module into a package with improved structure. Archival templates moved to resource files. Added CliNamespace for typed arguments. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228))
|
|
38
|
+
|
|
39
|
+
## 0.1.1
|
|
40
|
+
|
|
41
|
+
Initial release of vcs-versioning as a separate package extracted from setuptools-scm.
|
|
42
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Ronny Pfannschmidt
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vcs-versioning
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: the blessed package to manage your versions by vcs metadata
|
|
5
|
+
Project-URL: Documentation, https://github.com/pypa/setuptools-scm#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/pypa/setuptools-scm/issues
|
|
7
|
+
Project-URL: Source, https://github.com/pypa/setuptools-scm
|
|
8
|
+
Author-email: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Classifier: Development Status :: 1 - Planning
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: packaging>=20
|
|
20
|
+
Requires-Dist: tomli>=1; python_version < '3.11'
|
|
21
|
+
Requires-Dist: typing-extensions; python_version < '3.11'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# vcs-versioning
|
|
25
|
+
|
|
26
|
+
[](https://pypi.org/project/vcs-versioning)
|
|
27
|
+
[](https://pypi.org/project/vcs-versioning)
|
|
28
|
+
|
|
29
|
+
-----
|
|
30
|
+
|
|
31
|
+
**Table of Contents**
|
|
32
|
+
|
|
33
|
+
- [Installation](#installation)
|
|
34
|
+
- [License](#license)
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```console
|
|
39
|
+
pip install vcs-versioning
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
`vcs-versioning` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# vcs-versioning
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/vcs-versioning)
|
|
4
|
+
[](https://pypi.org/project/vcs-versioning)
|
|
5
|
+
|
|
6
|
+
-----
|
|
7
|
+
|
|
8
|
+
**Table of Contents**
|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [License](#license)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```console
|
|
16
|
+
pip install vcs-versioning
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
`vcs-versioning` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Version helper for vcs-versioning package.
|
|
3
|
+
|
|
4
|
+
This module allows vcs-versioning to use VCS metadata for its own version,
|
|
5
|
+
with the tag prefix 'vcs-versioning-'.
|
|
6
|
+
|
|
7
|
+
Used by hatchling's code version source.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
import os
|
|
14
|
+
from collections.abc import Callable
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
from vcs_versioning import Configuration
|
|
18
|
+
from vcs_versioning import _types as _t
|
|
19
|
+
from vcs_versioning._backends import _git as git
|
|
20
|
+
from vcs_versioning._backends import _hg as hg
|
|
21
|
+
from vcs_versioning._fallbacks import fallback_version, parse_pkginfo
|
|
22
|
+
from vcs_versioning._get_version_impl import get_version
|
|
23
|
+
from vcs_versioning._version_schemes import (
|
|
24
|
+
ScmVersion,
|
|
25
|
+
get_local_node_and_date,
|
|
26
|
+
get_no_local_node,
|
|
27
|
+
guess_next_dev_version,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
log = logging.getLogger("vcs_versioning")
|
|
31
|
+
|
|
32
|
+
# Try these parsers in order for vcs-versioning's own version
|
|
33
|
+
try_parse: list[Callable[[_t.PathT, Configuration], ScmVersion | None]] = [
|
|
34
|
+
parse_pkginfo,
|
|
35
|
+
git.parse,
|
|
36
|
+
hg.parse,
|
|
37
|
+
git.parse_archival,
|
|
38
|
+
hg.parse_archival,
|
|
39
|
+
fallback_version, # Last resort: use fallback_version from config
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def parse(root: str, config: Configuration) -> ScmVersion | None:
|
|
44
|
+
for maybe_parse in try_parse:
|
|
45
|
+
try:
|
|
46
|
+
parsed = maybe_parse(root, config)
|
|
47
|
+
except OSError as e:
|
|
48
|
+
log.warning("parse with %s failed with: %s", maybe_parse, e)
|
|
49
|
+
else:
|
|
50
|
+
if parsed is not None:
|
|
51
|
+
return parsed
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _get_version() -> str:
|
|
56
|
+
"""Get version from VCS with vcs-versioning- tag prefix."""
|
|
57
|
+
# Use no-local-version if VCS_VERSIONING_NO_LOCAL is set (for CI uploads)
|
|
58
|
+
local_scheme = (
|
|
59
|
+
get_no_local_node
|
|
60
|
+
if os.environ.get("VCS_VERSIONING_NO_LOCAL")
|
|
61
|
+
else get_local_node_and_date
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Resolve repo root from this file's location so version detection works
|
|
65
|
+
# regardless of cwd (e.g. when uv build runs from workspace root).
|
|
66
|
+
_here = Path(__file__).resolve()
|
|
67
|
+
_repo_root = _here.parent.parent
|
|
68
|
+
_pyproject_path = _here.parent / "pyproject.toml"
|
|
69
|
+
|
|
70
|
+
return get_version(
|
|
71
|
+
root=str(_repo_root),
|
|
72
|
+
fallback_root=str(_here.parent),
|
|
73
|
+
relative_to=str(_pyproject_path),
|
|
74
|
+
parse=parse,
|
|
75
|
+
version_scheme=guess_next_dev_version,
|
|
76
|
+
local_scheme=local_scheme,
|
|
77
|
+
tag_regex=r"^vcs-versioning-(?P<version>v?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$",
|
|
78
|
+
scm={
|
|
79
|
+
"git": {"describe_command": git.make_describe_command("vcs-versioning-*")}
|
|
80
|
+
},
|
|
81
|
+
fallback_version="0.1.1+pre.tag",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
__version__: str = _get_version()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog Fragments
|
|
2
|
+
|
|
3
|
+
This directory contains changelog fragments that will be assembled into the CHANGELOG.md file during release.
|
|
4
|
+
|
|
5
|
+
## Fragment Types
|
|
6
|
+
|
|
7
|
+
- **feature**: New features or enhancements
|
|
8
|
+
- **bugfix**: Bug fixes
|
|
9
|
+
- **deprecation**: Deprecation warnings
|
|
10
|
+
- **removal**: Removed features (breaking changes)
|
|
11
|
+
- **doc**: Documentation improvements
|
|
12
|
+
- **misc**: Internal changes, refactoring, etc.
|
|
13
|
+
|
|
14
|
+
## Naming Convention
|
|
15
|
+
|
|
16
|
+
Fragments should be named: `{issue_number}.{type}.md`
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
- `123.feature.md` - New feature related to issue #123
|
|
20
|
+
- `456.bugfix.md` - Bug fix for issue #456
|
|
21
|
+
- `789.doc.md` - Documentation update for issue #789
|
|
22
|
+
|
|
23
|
+
## Content
|
|
24
|
+
|
|
25
|
+
Each fragment should contain a brief description of the change:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
Add support for custom version schemes via plugin system
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Do not include issue numbers in the content - they will be added automatically.
|
|
32
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{% for section, _ in sections.items() %}
|
|
2
|
+
{% set underline = underlines[0] %}{% if section %}{{section}}
|
|
3
|
+
{{ underline * section|length }}{% set underline = underlines[1] %}
|
|
4
|
+
|
|
5
|
+
{% endif %}
|
|
6
|
+
{% if sections[section] %}
|
|
7
|
+
{% for category, val in definitions.items() if category in sections[section]%}
|
|
8
|
+
|
|
9
|
+
### {{ definitions[category]['name'] }}
|
|
10
|
+
|
|
11
|
+
{% for text, values in sections[section][category].items() %}
|
|
12
|
+
- {{ text }} ({{ values|join(', ') }})
|
|
13
|
+
{% endfor %}
|
|
14
|
+
|
|
15
|
+
{% endfor %}
|
|
16
|
+
{% else %}
|
|
17
|
+
No significant changes.
|
|
18
|
+
|
|
19
|
+
{% endif %}
|
|
20
|
+
{% endfor %}
|
|
21
|
+
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "hatchling.build"
|
|
3
|
+
requires = [
|
|
4
|
+
"hatchling",
|
|
5
|
+
"packaging>=20",
|
|
6
|
+
'typing-extensions; python_version < "3.11"',
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
[project]
|
|
10
|
+
name = "vcs-versioning"
|
|
11
|
+
description = "the blessed package to manage your versions by vcs metadata"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
keywords = [
|
|
14
|
+
]
|
|
15
|
+
license = "MIT"
|
|
16
|
+
authors = [
|
|
17
|
+
{ name = "Ronny Pfannschmidt", email = "opensource@ronnypfannschmidt.de" },
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.10"
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 1 - Planning",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
]
|
|
29
|
+
dynamic = [
|
|
30
|
+
"version",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
"packaging>=20",
|
|
34
|
+
'tomli>=1; python_version < "3.11"',
|
|
35
|
+
'typing-extensions; python_version < "3.11"',
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
test = [
|
|
40
|
+
"pytest",
|
|
41
|
+
"pytest-cov",
|
|
42
|
+
"pytest-xdist",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Documentation = "https://github.com/pypa/setuptools-scm#readme"
|
|
47
|
+
Issues = "https://github.com/pypa/setuptools-scm/issues"
|
|
48
|
+
Source = "https://github.com/pypa/setuptools-scm"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
"vcs-versioning" = "vcs_versioning._cli:main"
|
|
52
|
+
|
|
53
|
+
[project.entry-points."setuptools_scm.parse_scm"]
|
|
54
|
+
".git" = "vcs_versioning._backends._git:parse"
|
|
55
|
+
".hg" = "vcs_versioning._backends._hg:parse"
|
|
56
|
+
|
|
57
|
+
[project.entry-points."setuptools_scm.parse_scm_fallback"]
|
|
58
|
+
".git_archival.txt" = "vcs_versioning._backends._git:parse_archival"
|
|
59
|
+
".hg_archival.txt" = "vcs_versioning._backends._hg:parse_archival"
|
|
60
|
+
"PKG-INFO" = "vcs_versioning._fallbacks:parse_pkginfo"
|
|
61
|
+
"pyproject.toml" = "vcs_versioning._fallbacks:fallback_version"
|
|
62
|
+
"setup.py" = "vcs_versioning._fallbacks:fallback_version"
|
|
63
|
+
|
|
64
|
+
[project.entry-points."setuptools_scm.local_scheme"]
|
|
65
|
+
dirty-tag = "vcs_versioning._version_schemes:get_local_dirty_tag"
|
|
66
|
+
no-local-version = "vcs_versioning._version_schemes:get_no_local_node"
|
|
67
|
+
node-and-date = "vcs_versioning._version_schemes:get_local_node_and_date"
|
|
68
|
+
node-and-timestamp = "vcs_versioning._version_schemes:get_local_node_and_timestamp"
|
|
69
|
+
|
|
70
|
+
[project.entry-points."setuptools_scm.version_scheme"]
|
|
71
|
+
"calver-by-date" = "vcs_versioning._version_schemes:calver_by_date"
|
|
72
|
+
"guess-next-dev" = "vcs_versioning._version_schemes:guess_next_dev_version"
|
|
73
|
+
"no-guess-dev" = "vcs_versioning._version_schemes:no_guess_dev_version"
|
|
74
|
+
"only-version" = "vcs_versioning._version_schemes:only_version"
|
|
75
|
+
"post-release" = "vcs_versioning._version_schemes:postrelease_version"
|
|
76
|
+
"python-simplified-semver" = "vcs_versioning._version_schemes._standard:_deprecated_simplified_semver_version"
|
|
77
|
+
"release-branch-semver" = "vcs_versioning._version_schemes._standard:_deprecated_release_branch_semver_version"
|
|
78
|
+
"semver-pep440" = "vcs_versioning._version_schemes:simplified_semver_version"
|
|
79
|
+
"semver-pep440-release-branch" = "vcs_versioning._version_schemes:release_branch_semver_version"
|
|
80
|
+
"towncrier-fragments" = "vcs_versioning._version_schemes._towncrier:version_from_fragments"
|
|
81
|
+
|
|
82
|
+
[tool.hatch.version]
|
|
83
|
+
source = "code"
|
|
84
|
+
path = "_own_version_of_vcs_versioning.py"
|
|
85
|
+
search-paths = ["src"]
|
|
86
|
+
|
|
87
|
+
[tool.hatch.build.targets.wheel]
|
|
88
|
+
packages = ["src/vcs_versioning"]
|
|
89
|
+
|
|
90
|
+
[tool.hatch.envs.default]
|
|
91
|
+
dependencies = [
|
|
92
|
+
"pytest",
|
|
93
|
+
"pytest-cov",
|
|
94
|
+
]
|
|
95
|
+
[tool.hatch.envs.default.scripts]
|
|
96
|
+
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=vcs_versioning --cov=tests {args}"
|
|
97
|
+
no-cov = "cov --no-cov {args}"
|
|
98
|
+
|
|
99
|
+
[[tool.hatch.envs.test.matrix]]
|
|
100
|
+
python = [ "38", "39", "310", "311", "312", "313" ]
|
|
101
|
+
|
|
102
|
+
[tool.vcs-versioning]
|
|
103
|
+
root = ".."
|
|
104
|
+
version_scheme = "towncrier-fragments"
|
|
105
|
+
tag_regex = "^vcs-versioning-(?P<version>v?\\d+(?:\\.\\d+){0,2}[^\\+]*)(?:\\+.*)?$"
|
|
106
|
+
fallback_version = "0.1.0"
|
|
107
|
+
scm.git.describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "vcs-versioning-*"]
|
|
108
|
+
|
|
109
|
+
[tool.coverage.run]
|
|
110
|
+
branch = true
|
|
111
|
+
parallel = true
|
|
112
|
+
omit = [
|
|
113
|
+
"vcs_versioning/__about__.py",
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
[tool.coverage.report]
|
|
117
|
+
exclude_lines = [
|
|
118
|
+
"no cov",
|
|
119
|
+
"if __name__ == .__main__.:",
|
|
120
|
+
"if TYPE_CHECKING:",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[tool.pytest.ini_options]
|
|
124
|
+
testpaths = ["testing_vcs"]
|
|
125
|
+
python_files = ["test_*.py"]
|
|
126
|
+
addopts = ["-ra", "--strict-markers", "-p", "vcs_versioning.test_api"]
|
|
127
|
+
markers = [
|
|
128
|
+
"issue: marks tests related to specific issues",
|
|
129
|
+
"no_init: use setup_hg(init=False) for wd fixture - hg check without worktree",
|
|
130
|
+
"skip_commit: allows to skip committing in the helpers",
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
[tool.uv]
|
|
134
|
+
default-groups = ["test"]
|
|
135
|
+
|
|
136
|
+
[tool.towncrier]
|
|
137
|
+
directory = "changelog.d"
|
|
138
|
+
filename = "CHANGELOG.md"
|
|
139
|
+
start_string = "<!-- towncrier release notes start -->\n"
|
|
140
|
+
template = "changelog.d/template.md"
|
|
141
|
+
title_format = "## {version} ({project_date})"
|
|
142
|
+
issue_format = "[#{issue}](https://github.com/pypa/setuptools-scm/issues/{issue})"
|
|
143
|
+
underlines = ["", "", ""]
|
|
144
|
+
|
|
145
|
+
[[tool.towncrier.type]]
|
|
146
|
+
directory = "major"
|
|
147
|
+
name = "Major Changes"
|
|
148
|
+
showcontent = true
|
|
149
|
+
|
|
150
|
+
[[tool.towncrier.type]]
|
|
151
|
+
directory = "breaking"
|
|
152
|
+
name = "Breaking Changes"
|
|
153
|
+
showcontent = true
|
|
154
|
+
|
|
155
|
+
[[tool.towncrier.type]]
|
|
156
|
+
directory = "removal"
|
|
157
|
+
name = "Removed"
|
|
158
|
+
showcontent = true
|
|
159
|
+
|
|
160
|
+
[[tool.towncrier.type]]
|
|
161
|
+
directory = "deprecation"
|
|
162
|
+
name = "Deprecated"
|
|
163
|
+
showcontent = true
|
|
164
|
+
|
|
165
|
+
[[tool.towncrier.type]]
|
|
166
|
+
directory = "feature"
|
|
167
|
+
name = "Added"
|
|
168
|
+
showcontent = true
|
|
169
|
+
|
|
170
|
+
[[tool.towncrier.type]]
|
|
171
|
+
directory = "bugfix"
|
|
172
|
+
name = "Fixed"
|
|
173
|
+
showcontent = true
|
|
174
|
+
|
|
175
|
+
[[tool.towncrier.type]]
|
|
176
|
+
directory = "doc"
|
|
177
|
+
name = "Documentation"
|
|
178
|
+
showcontent = true
|
|
179
|
+
|
|
180
|
+
[[tool.towncrier.type]]
|
|
181
|
+
directory = "misc"
|
|
182
|
+
name = "Miscellaneous"
|
|
183
|
+
showcontent = true
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""VCS-based versioning for Python packages
|
|
2
|
+
|
|
3
|
+
Core functionality for version management based on VCS metadata.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
# Public API exports
|
|
11
|
+
from ._config import DEFAULT_LOCAL_SCHEME, DEFAULT_VERSION_SCHEME, Configuration
|
|
12
|
+
from ._pyproject_reading import PyProjectData
|
|
13
|
+
from ._scm_version import ScmVersion
|
|
14
|
+
from ._version_cls import NonNormalizedVersion, Version
|
|
15
|
+
from ._version_inference import infer_version_string
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def build_configuration_from_pyproject(
|
|
19
|
+
pyproject_data: PyProjectData,
|
|
20
|
+
*,
|
|
21
|
+
dist_name: str | None = None,
|
|
22
|
+
**integrator_overrides: Any,
|
|
23
|
+
) -> Configuration:
|
|
24
|
+
"""Build Configuration from PyProjectData with full workflow.
|
|
25
|
+
|
|
26
|
+
EXPERIMENTAL API for integrators.
|
|
27
|
+
|
|
28
|
+
This helper orchestrates the complete configuration building workflow:
|
|
29
|
+
1. Extract config from pyproject_data.section
|
|
30
|
+
2. Determine dist_name (argument > pyproject.project_name)
|
|
31
|
+
3. Apply integrator overrides (override config file)
|
|
32
|
+
4. Apply environment TOML overrides (highest priority)
|
|
33
|
+
5. Create and validate Configuration instance
|
|
34
|
+
|
|
35
|
+
Integrators create PyProjectData themselves:
|
|
36
|
+
|
|
37
|
+
Example 1 - From file:
|
|
38
|
+
>>> from vcs_versioning import PyProjectData, build_configuration_from_pyproject
|
|
39
|
+
>>> from vcs_versioning.overrides import GlobalOverrides
|
|
40
|
+
>>>
|
|
41
|
+
>>> with GlobalOverrides.from_env("HATCH_VCS", dist_name="my-pkg"):
|
|
42
|
+
... pyproject = PyProjectData.from_file("pyproject.toml")
|
|
43
|
+
... config = build_configuration_from_pyproject(
|
|
44
|
+
... pyproject_data=pyproject,
|
|
45
|
+
... dist_name="my-pkg",
|
|
46
|
+
... )
|
|
47
|
+
|
|
48
|
+
Example 2 - Manual composition:
|
|
49
|
+
>>> from pathlib import Path
|
|
50
|
+
>>> from vcs_versioning import PyProjectData, build_configuration_from_pyproject
|
|
51
|
+
>>>
|
|
52
|
+
>>> pyproject = PyProjectData(
|
|
53
|
+
... path=Path("pyproject.toml"),
|
|
54
|
+
... tool_name="vcs-versioning",
|
|
55
|
+
... project={"name": "my-pkg"},
|
|
56
|
+
... section={"local_scheme": "no-local-version"},
|
|
57
|
+
... is_required=True,
|
|
58
|
+
... section_present=True,
|
|
59
|
+
... project_present=True,
|
|
60
|
+
... build_requires=[],
|
|
61
|
+
... )
|
|
62
|
+
>>> config = build_configuration_from_pyproject(
|
|
63
|
+
... pyproject_data=pyproject,
|
|
64
|
+
... version_scheme="semver-pep440-release-branch", # Integrator override
|
|
65
|
+
... )
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
pyproject_data: Parsed pyproject data (integrator creates this)
|
|
69
|
+
dist_name: Distribution name (overrides pyproject_data.project_name)
|
|
70
|
+
**integrator_overrides: Integrator-provided config overrides
|
|
71
|
+
(override config file, but overridden by env)
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Configured Configuration instance ready for version inference
|
|
75
|
+
|
|
76
|
+
Priority order (highest to lowest):
|
|
77
|
+
1. Environment TOML overrides (TOOL_OVERRIDES_FOR_DIST, TOOL_OVERRIDES)
|
|
78
|
+
2. Integrator **overrides arguments
|
|
79
|
+
3. pyproject_data.section configuration
|
|
80
|
+
4. Configuration defaults
|
|
81
|
+
|
|
82
|
+
This allows integrators to provide their own transformations
|
|
83
|
+
while still respecting user environment variable overrides.
|
|
84
|
+
"""
|
|
85
|
+
from ._integrator_helpers import build_configuration_from_pyproject_internal
|
|
86
|
+
|
|
87
|
+
return build_configuration_from_pyproject_internal(
|
|
88
|
+
pyproject_data=pyproject_data,
|
|
89
|
+
dist_name=dist_name,
|
|
90
|
+
**integrator_overrides,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
__all__ = [
|
|
95
|
+
"DEFAULT_LOCAL_SCHEME",
|
|
96
|
+
"DEFAULT_VERSION_SCHEME",
|
|
97
|
+
"Configuration",
|
|
98
|
+
"NonNormalizedVersion",
|
|
99
|
+
"PyProjectData",
|
|
100
|
+
"ScmVersion",
|
|
101
|
+
"Version",
|
|
102
|
+
"build_configuration_from_pyproject",
|
|
103
|
+
"infer_version_string",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
# Experimental API markers for documentation
|
|
107
|
+
__experimental__ = [
|
|
108
|
+
"PyProjectData",
|
|
109
|
+
"build_configuration_from_pyproject",
|
|
110
|
+
]
|