simple-git-versioning 0.2.6__tar.gz → 0.2.14__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.
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/PKG-INFO +59 -31
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/README.md +48 -26
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/pyproject.toml +29 -17
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/simple_git_versioning.egg-info/PKG-INFO +59 -31
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/simple_git_versioning.egg-info/SOURCES.txt +1 -12
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/simple_git_versioning.egg-info/entry_points.txt +3 -0
- simple_git_versioning-0.2.14/simple_git_versioning.egg-info/requires.txt +14 -0
- simple_git_versioning-0.2.14/versioning/hatchling.py +39 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/versioning/setuptools.py +1 -2
- simple-git-versioning-0.2.6/.gitignore +0 -16
- simple-git-versioning-0.2.6/.gitlab-ci.yml +0 -125
- simple-git-versioning-0.2.6/.pre-commit-config.yaml +0 -32
- simple-git-versioning-0.2.6/LICENSE +0 -21
- simple-git-versioning-0.2.6/pdm.lock +0 -1682
- simple-git-versioning-0.2.6/simple_git_versioning.egg-info/requires.txt +0 -6
- simple-git-versioning-0.2.6/tests/__init__.py +0 -15
- simple-git-versioning-0.2.6/tests/unit/__init__.py +0 -248
- simple-git-versioning-0.2.6/tests/unit/test_cli.py +0 -28
- simple-git-versioning-0.2.6/tests/unit/test_pep440.py +0 -380
- simple-git-versioning-0.2.6/tests/unit/test_project.py +0 -424
- simple-git-versioning-0.2.6/tests/unit/test_semver2.py +0 -114
- simple-git-versioning-0.2.6/tests/unit/test_version.py +0 -111
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/setup.cfg +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/simple_git_versioning.egg-info/dependency_links.txt +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/simple_git_versioning.egg-info/top_level.txt +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/versioning/__init__.py +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/versioning/pep440.py +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/versioning/poetry.py +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/versioning/project.py +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/versioning/semver2.py +0 -0
- {simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/versioning/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: simple-git-versioning
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Thinly scoped and opinionated tool that computes a version number from git tags and trailers
|
|
5
5
|
Author-email: Quentin Bouget <ypsah@devyard.org>
|
|
6
6
|
License: MIT
|
|
@@ -18,13 +18,19 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Framework :: Hatch
|
|
21
24
|
Requires-Python: <4,>=3.8.1
|
|
22
25
|
Description-Content-Type: text/markdown
|
|
23
|
-
License-File: LICENSE
|
|
24
|
-
Requires-Dist: sh<3,>=2
|
|
25
26
|
Requires-Dist: icontract
|
|
27
|
+
Requires-Dist: sh<3,>=2
|
|
26
28
|
Requires-Dist: typing-extensions; python_version < "3.11"
|
|
27
|
-
|
|
29
|
+
Provides-Extra: setuptools
|
|
30
|
+
Requires-Dist: setuptools; extra == "setuptools"
|
|
31
|
+
Requires-Dist: toml; python_version < "3.11" and extra == "setuptools"
|
|
32
|
+
Provides-Extra: hatchling
|
|
33
|
+
Requires-Dist: hatchling; extra == "hatchling"
|
|
28
34
|
|
|
29
35
|
Opinionated version numbering CLIs, and library
|
|
30
36
|
|
|
@@ -110,40 +116,39 @@ except PackageNotFoundError:
|
|
|
110
116
|
__version__ = str(project.release(pre=("dev", 0))
|
|
111
117
|
```
|
|
112
118
|
|
|
113
|
-
## `
|
|
114
|
-
|
|
115
|
-
If you use `poetry` as a build frontend and backend for your project, you can
|
|
116
|
-
configure `simple-git-versioning` to derive a version automatically as follows:
|
|
117
|
-
|
|
118
|
-
Install `simple-git-versioning` alongside `poetry`:
|
|
119
|
+
## `setuptools`
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
```
|
|
121
|
+
If you use `setuptools` as a build backend for your project, you can configure
|
|
122
|
+
`simple-git-versioning` to derive a version automatically as follows:
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
In your `pyproject.toml`:
|
|
125
|
+
- declare `version` as a dynamic metadata field;
|
|
126
|
+
- add `simple-git-versioning` to your project's `build-system.requires`;
|
|
127
|
+
- enable the `setuptools` integration in your `pyproject.toml`, and pick the
|
|
128
|
+
versioning scheme you wish to apply.
|
|
126
129
|
|
|
127
130
|
```toml
|
|
128
|
-
[
|
|
129
|
-
...
|
|
131
|
+
[project]
|
|
132
|
+
name = ...
|
|
133
|
+
dynamic = ["version"]
|
|
134
|
+
|
|
135
|
+
[build-system]
|
|
136
|
+
requires = ["setuptools>=63", "simple-git-versioning"]
|
|
137
|
+
build-backend = "setuptools.build_meta"
|
|
130
138
|
|
|
131
139
|
[tool.simple-git-versioning]
|
|
132
|
-
|
|
140
|
+
setuptools = "pep440" # or "semver2"
|
|
133
141
|
```
|
|
134
142
|
|
|
135
|
-
|
|
136
|
-
> you will have to keep a placeholder there (e.g. `version: "0.0.0"`).
|
|
137
|
-
|
|
138
|
-
## `setuptools`
|
|
143
|
+
## `hatchling`
|
|
139
144
|
|
|
140
|
-
If you use `
|
|
145
|
+
If you use `hatchling` as a build backend for your project, you can configure
|
|
141
146
|
`simple-git-versioning` to derive a version automatically as follows:
|
|
142
147
|
|
|
143
148
|
In your `pyproject.toml`:
|
|
144
149
|
- declare `version` as a dynamic metadata field;
|
|
145
150
|
- add `simple-git-versioning` to your project's `build-system.requires`;
|
|
146
|
-
- enable the `
|
|
151
|
+
- enable the `hatchling` integration in your `pyproject.toml`, and pick the
|
|
147
152
|
versioning scheme you wish to apply.
|
|
148
153
|
|
|
149
154
|
```toml
|
|
@@ -152,13 +157,36 @@ name = ...
|
|
|
152
157
|
dynamic = ["version"]
|
|
153
158
|
|
|
154
159
|
[build-system]
|
|
155
|
-
requires = ["
|
|
156
|
-
build-backend = "
|
|
160
|
+
requires = ["hatchling", "simple-git-versioning"]
|
|
161
|
+
build-backend = "hatchling.build"
|
|
162
|
+
|
|
163
|
+
[tool.hatch.version]
|
|
164
|
+
source = "simple-git-versioning"
|
|
165
|
+
flavor = "pep440" # or "semver2"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## `poetry`
|
|
169
|
+
|
|
170
|
+
If you use `poetry` as a build frontend and backend for your project, you can
|
|
171
|
+
configure `simple-git-versioning` to derive a version automatically as follows:
|
|
172
|
+
|
|
173
|
+
Install `simple-git-versioning` alongside `poetry`:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
poetry self add "simple-git-versioning>=0.2"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Enable the `poetry` integration in your `pyproject.toml`, and pick the
|
|
180
|
+
versioning scheme you wish to apply:
|
|
181
|
+
|
|
182
|
+
```toml
|
|
183
|
+
[tool.poetry]
|
|
184
|
+
...
|
|
157
185
|
|
|
158
186
|
[tool.simple-git-versioning]
|
|
159
|
-
|
|
187
|
+
poetry = "pep440" # or "semver2"
|
|
160
188
|
```
|
|
161
189
|
|
|
162
|
-
>
|
|
163
|
-
|
|
164
|
-
|
|
190
|
+
> Note that `poetry` mandates a `version` always be set in `pyproject.toml`, so
|
|
191
|
+
> you will have to keep a placeholder there (e.g. `version: "0.0.0"`).
|
|
192
|
+
|
|
@@ -82,40 +82,39 @@ except PackageNotFoundError:
|
|
|
82
82
|
__version__ = str(project.release(pre=("dev", 0))
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
## `
|
|
86
|
-
|
|
87
|
-
If you use `poetry` as a build frontend and backend for your project, you can
|
|
88
|
-
configure `simple-git-versioning` to derive a version automatically as follows:
|
|
89
|
-
|
|
90
|
-
Install `simple-git-versioning` alongside `poetry`:
|
|
85
|
+
## `setuptools`
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
```
|
|
87
|
+
If you use `setuptools` as a build backend for your project, you can configure
|
|
88
|
+
`simple-git-versioning` to derive a version automatically as follows:
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
In your `pyproject.toml`:
|
|
91
|
+
- declare `version` as a dynamic metadata field;
|
|
92
|
+
- add `simple-git-versioning` to your project's `build-system.requires`;
|
|
93
|
+
- enable the `setuptools` integration in your `pyproject.toml`, and pick the
|
|
94
|
+
versioning scheme you wish to apply.
|
|
98
95
|
|
|
99
96
|
```toml
|
|
100
|
-
[
|
|
101
|
-
...
|
|
97
|
+
[project]
|
|
98
|
+
name = ...
|
|
99
|
+
dynamic = ["version"]
|
|
100
|
+
|
|
101
|
+
[build-system]
|
|
102
|
+
requires = ["setuptools>=63", "simple-git-versioning"]
|
|
103
|
+
build-backend = "setuptools.build_meta"
|
|
102
104
|
|
|
103
105
|
[tool.simple-git-versioning]
|
|
104
|
-
|
|
106
|
+
setuptools = "pep440" # or "semver2"
|
|
105
107
|
```
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
> you will have to keep a placeholder there (e.g. `version: "0.0.0"`).
|
|
109
|
+
## `hatchling`
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
If you use `setuptools` as a build backend for your project, you can configure
|
|
111
|
+
If you use `hatchling` as a build backend for your project, you can configure
|
|
113
112
|
`simple-git-versioning` to derive a version automatically as follows:
|
|
114
113
|
|
|
115
114
|
In your `pyproject.toml`:
|
|
116
115
|
- declare `version` as a dynamic metadata field;
|
|
117
116
|
- add `simple-git-versioning` to your project's `build-system.requires`;
|
|
118
|
-
- enable the `
|
|
117
|
+
- enable the `hatchling` integration in your `pyproject.toml`, and pick the
|
|
119
118
|
versioning scheme you wish to apply.
|
|
120
119
|
|
|
121
120
|
```toml
|
|
@@ -124,13 +123,36 @@ name = ...
|
|
|
124
123
|
dynamic = ["version"]
|
|
125
124
|
|
|
126
125
|
[build-system]
|
|
127
|
-
requires = ["
|
|
128
|
-
build-backend = "
|
|
126
|
+
requires = ["hatchling", "simple-git-versioning"]
|
|
127
|
+
build-backend = "hatchling.build"
|
|
128
|
+
|
|
129
|
+
[tool.hatch.version]
|
|
130
|
+
source = "simple-git-versioning"
|
|
131
|
+
flavor = "pep440" # or "semver2"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## `poetry`
|
|
135
|
+
|
|
136
|
+
If you use `poetry` as a build frontend and backend for your project, you can
|
|
137
|
+
configure `simple-git-versioning` to derive a version automatically as follows:
|
|
138
|
+
|
|
139
|
+
Install `simple-git-versioning` alongside `poetry`:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
poetry self add "simple-git-versioning>=0.2"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Enable the `poetry` integration in your `pyproject.toml`, and pick the
|
|
146
|
+
versioning scheme you wish to apply:
|
|
147
|
+
|
|
148
|
+
```toml
|
|
149
|
+
[tool.poetry]
|
|
150
|
+
...
|
|
129
151
|
|
|
130
152
|
[tool.simple-git-versioning]
|
|
131
|
-
|
|
153
|
+
poetry = "pep440" # or "semver2"
|
|
132
154
|
```
|
|
133
155
|
|
|
134
|
-
>
|
|
135
|
-
|
|
136
|
-
|
|
156
|
+
> Note that `poetry` mandates a `version` always be set in `pyproject.toml`, so
|
|
157
|
+
> you will have to keep a placeholder there (e.g. `version: "0.0.0"`).
|
|
158
|
+
|
|
@@ -23,16 +23,36 @@ classifiers = [
|
|
|
23
23
|
"Programming Language :: Python :: 3.9",
|
|
24
24
|
"Programming Language :: Python :: 3.10",
|
|
25
25
|
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Framework :: Hatch",
|
|
26
29
|
]
|
|
27
30
|
readme = "README.md"
|
|
28
31
|
dependencies = [
|
|
29
|
-
"sh>=2,<3",
|
|
30
32
|
"icontract",
|
|
33
|
+
"sh>=2,<3",
|
|
31
34
|
"typing-extensions ; python_version < '3.11'",
|
|
32
|
-
"toml ; python_version < '3.11'",
|
|
33
35
|
]
|
|
34
36
|
dynamic = ["version"]
|
|
35
37
|
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
setuptools = ["setuptools", "toml ; python_version < '3.11'"]
|
|
40
|
+
hatchling = ["hatchling"]
|
|
41
|
+
|
|
42
|
+
[dependency-groups]
|
|
43
|
+
dev = [
|
|
44
|
+
"black",
|
|
45
|
+
"build",
|
|
46
|
+
"hypothesis",
|
|
47
|
+
"isort",
|
|
48
|
+
"poetry",
|
|
49
|
+
"pre-commit",
|
|
50
|
+
"pytest",
|
|
51
|
+
"pytest-cov",
|
|
52
|
+
"ruff",
|
|
53
|
+
"twine",
|
|
54
|
+
]
|
|
55
|
+
|
|
36
56
|
[project.urls]
|
|
37
57
|
homepage = "https://gitlab.com/ypsah/simple-git-versioning"
|
|
38
58
|
repository = "https://gitlab.com/ypsah/simple-git-versioning"
|
|
@@ -44,33 +64,25 @@ semver2 = "versioning.semver2:main"
|
|
|
44
64
|
[project.entry-points."setuptools.finalize_distribution_options"]
|
|
45
65
|
simple-git-versioning = "versioning.setuptools:finalize_distribution_options"
|
|
46
66
|
|
|
67
|
+
[project.entry-points.hatch]
|
|
68
|
+
simple-git-versioning = "versioning.hatch"
|
|
69
|
+
|
|
47
70
|
[project.entry-points."poetry.plugin"]
|
|
48
71
|
simple-git-versioning = "versioning.poetry:SimpleGitVersioning"
|
|
49
72
|
|
|
50
73
|
[build-system]
|
|
51
|
-
requires = ["setuptools>=63", "
|
|
74
|
+
requires = ["setuptools>=63", "simple-git-versioning>=0.1.22"]
|
|
52
75
|
build-backend = "setuptools.build_meta"
|
|
53
76
|
|
|
54
|
-
[tool.
|
|
55
|
-
|
|
56
|
-
"black",
|
|
57
|
-
"build",
|
|
58
|
-
"hypothesis",
|
|
59
|
-
"isort",
|
|
60
|
-
"poetry",
|
|
61
|
-
"pre-commit",
|
|
62
|
-
"pytest",
|
|
63
|
-
"pytest-cov",
|
|
64
|
-
"ruff",
|
|
65
|
-
"twine",
|
|
66
|
-
]
|
|
77
|
+
[tool.setuptools]
|
|
78
|
+
license-files = []
|
|
67
79
|
|
|
68
80
|
[tool.simple-git-versioning]
|
|
69
81
|
setuptools = "pep440"
|
|
70
82
|
|
|
71
83
|
[tool.black]
|
|
72
84
|
line-length = 120
|
|
73
|
-
target-version = ['
|
|
85
|
+
target-version = ['py310', 'py311', 'py312', 'py313']
|
|
74
86
|
# enrole in feature-preview
|
|
75
87
|
preview = true
|
|
76
88
|
|
{simple-git-versioning-0.2.6 → simple_git_versioning-0.2.14}/simple_git_versioning.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: simple-git-versioning
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Thinly scoped and opinionated tool that computes a version number from git tags and trailers
|
|
5
5
|
Author-email: Quentin Bouget <ypsah@devyard.org>
|
|
6
6
|
License: MIT
|
|
@@ -18,13 +18,19 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Framework :: Hatch
|
|
21
24
|
Requires-Python: <4,>=3.8.1
|
|
22
25
|
Description-Content-Type: text/markdown
|
|
23
|
-
License-File: LICENSE
|
|
24
|
-
Requires-Dist: sh<3,>=2
|
|
25
26
|
Requires-Dist: icontract
|
|
27
|
+
Requires-Dist: sh<3,>=2
|
|
26
28
|
Requires-Dist: typing-extensions; python_version < "3.11"
|
|
27
|
-
|
|
29
|
+
Provides-Extra: setuptools
|
|
30
|
+
Requires-Dist: setuptools; extra == "setuptools"
|
|
31
|
+
Requires-Dist: toml; python_version < "3.11" and extra == "setuptools"
|
|
32
|
+
Provides-Extra: hatchling
|
|
33
|
+
Requires-Dist: hatchling; extra == "hatchling"
|
|
28
34
|
|
|
29
35
|
Opinionated version numbering CLIs, and library
|
|
30
36
|
|
|
@@ -110,40 +116,39 @@ except PackageNotFoundError:
|
|
|
110
116
|
__version__ = str(project.release(pre=("dev", 0))
|
|
111
117
|
```
|
|
112
118
|
|
|
113
|
-
## `
|
|
114
|
-
|
|
115
|
-
If you use `poetry` as a build frontend and backend for your project, you can
|
|
116
|
-
configure `simple-git-versioning` to derive a version automatically as follows:
|
|
117
|
-
|
|
118
|
-
Install `simple-git-versioning` alongside `poetry`:
|
|
119
|
+
## `setuptools`
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
```
|
|
121
|
+
If you use `setuptools` as a build backend for your project, you can configure
|
|
122
|
+
`simple-git-versioning` to derive a version automatically as follows:
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
In your `pyproject.toml`:
|
|
125
|
+
- declare `version` as a dynamic metadata field;
|
|
126
|
+
- add `simple-git-versioning` to your project's `build-system.requires`;
|
|
127
|
+
- enable the `setuptools` integration in your `pyproject.toml`, and pick the
|
|
128
|
+
versioning scheme you wish to apply.
|
|
126
129
|
|
|
127
130
|
```toml
|
|
128
|
-
[
|
|
129
|
-
...
|
|
131
|
+
[project]
|
|
132
|
+
name = ...
|
|
133
|
+
dynamic = ["version"]
|
|
134
|
+
|
|
135
|
+
[build-system]
|
|
136
|
+
requires = ["setuptools>=63", "simple-git-versioning"]
|
|
137
|
+
build-backend = "setuptools.build_meta"
|
|
130
138
|
|
|
131
139
|
[tool.simple-git-versioning]
|
|
132
|
-
|
|
140
|
+
setuptools = "pep440" # or "semver2"
|
|
133
141
|
```
|
|
134
142
|
|
|
135
|
-
|
|
136
|
-
> you will have to keep a placeholder there (e.g. `version: "0.0.0"`).
|
|
137
|
-
|
|
138
|
-
## `setuptools`
|
|
143
|
+
## `hatchling`
|
|
139
144
|
|
|
140
|
-
If you use `
|
|
145
|
+
If you use `hatchling` as a build backend for your project, you can configure
|
|
141
146
|
`simple-git-versioning` to derive a version automatically as follows:
|
|
142
147
|
|
|
143
148
|
In your `pyproject.toml`:
|
|
144
149
|
- declare `version` as a dynamic metadata field;
|
|
145
150
|
- add `simple-git-versioning` to your project's `build-system.requires`;
|
|
146
|
-
- enable the `
|
|
151
|
+
- enable the `hatchling` integration in your `pyproject.toml`, and pick the
|
|
147
152
|
versioning scheme you wish to apply.
|
|
148
153
|
|
|
149
154
|
```toml
|
|
@@ -152,13 +157,36 @@ name = ...
|
|
|
152
157
|
dynamic = ["version"]
|
|
153
158
|
|
|
154
159
|
[build-system]
|
|
155
|
-
requires = ["
|
|
156
|
-
build-backend = "
|
|
160
|
+
requires = ["hatchling", "simple-git-versioning"]
|
|
161
|
+
build-backend = "hatchling.build"
|
|
162
|
+
|
|
163
|
+
[tool.hatch.version]
|
|
164
|
+
source = "simple-git-versioning"
|
|
165
|
+
flavor = "pep440" # or "semver2"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## `poetry`
|
|
169
|
+
|
|
170
|
+
If you use `poetry` as a build frontend and backend for your project, you can
|
|
171
|
+
configure `simple-git-versioning` to derive a version automatically as follows:
|
|
172
|
+
|
|
173
|
+
Install `simple-git-versioning` alongside `poetry`:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
poetry self add "simple-git-versioning>=0.2"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Enable the `poetry` integration in your `pyproject.toml`, and pick the
|
|
180
|
+
versioning scheme you wish to apply:
|
|
181
|
+
|
|
182
|
+
```toml
|
|
183
|
+
[tool.poetry]
|
|
184
|
+
...
|
|
157
185
|
|
|
158
186
|
[tool.simple-git-versioning]
|
|
159
|
-
|
|
187
|
+
poetry = "pep440" # or "semver2"
|
|
160
188
|
```
|
|
161
189
|
|
|
162
|
-
>
|
|
163
|
-
|
|
164
|
-
|
|
190
|
+
> Note that `poetry` mandates a `version` always be set in `pyproject.toml`, so
|
|
191
|
+
> you will have to keep a placeholder there (e.g. `version: "0.0.0"`).
|
|
192
|
+
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
.gitignore
|
|
2
|
-
.gitlab-ci.yml
|
|
3
|
-
.pre-commit-config.yaml
|
|
4
|
-
LICENSE
|
|
5
1
|
README.md
|
|
6
|
-
pdm.lock
|
|
7
2
|
pyproject.toml
|
|
8
3
|
simple_git_versioning.egg-info/PKG-INFO
|
|
9
4
|
simple_git_versioning.egg-info/SOURCES.txt
|
|
@@ -11,14 +6,8 @@ simple_git_versioning.egg-info/dependency_links.txt
|
|
|
11
6
|
simple_git_versioning.egg-info/entry_points.txt
|
|
12
7
|
simple_git_versioning.egg-info/requires.txt
|
|
13
8
|
simple_git_versioning.egg-info/top_level.txt
|
|
14
|
-
tests/__init__.py
|
|
15
|
-
tests/unit/__init__.py
|
|
16
|
-
tests/unit/test_cli.py
|
|
17
|
-
tests/unit/test_pep440.py
|
|
18
|
-
tests/unit/test_project.py
|
|
19
|
-
tests/unit/test_semver2.py
|
|
20
|
-
tests/unit/test_version.py
|
|
21
9
|
versioning/__init__.py
|
|
10
|
+
versioning/hatchling.py
|
|
22
11
|
versioning/pep440.py
|
|
23
12
|
versioning/poetry.py
|
|
24
13
|
versioning/project.py
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from hatchling.plugin import hookimpl
|
|
4
|
+
from hatchling.version.source.plugin.interface import VersionSourceInterface
|
|
5
|
+
from versioning import pep440, semver2
|
|
6
|
+
from versioning.project import NoVersion
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SimpleGitVersioningVersionSource(VersionSourceInterface): # pragma: no cover
|
|
10
|
+
PLUGIN_NAME = "simple-git-versioning"
|
|
11
|
+
|
|
12
|
+
def get_version_data(self) -> dict:
|
|
13
|
+
flavor = self.config["flavor"]
|
|
14
|
+
|
|
15
|
+
if not isinstance(flavor, str):
|
|
16
|
+
raise TypeError(f"unexpected versioning flavor: '{flavor}', expected 'pep440' or 'semver2'")
|
|
17
|
+
|
|
18
|
+
flavor = flavor.casefold()
|
|
19
|
+
if flavor == "pep440":
|
|
20
|
+
Project = pep440.Project
|
|
21
|
+
options = dict(dev=0)
|
|
22
|
+
elif flavor == "semver2":
|
|
23
|
+
Project = semver2.Project
|
|
24
|
+
options = dict()
|
|
25
|
+
else:
|
|
26
|
+
raise ValueError(
|
|
27
|
+
f"unexpected value for `tool.simple-git-versioning.setuptools`: '{flavor}', expected 'pep440' or 'semver2'"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
with Project(path=Path(self.root)) as proj:
|
|
31
|
+
try:
|
|
32
|
+
return {"version": str(proj.version())}
|
|
33
|
+
except NoVersion:
|
|
34
|
+
return {"version": str(proj.release(**options))}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@hookimpl
|
|
38
|
+
def hatch_register_version_source(): # pragma: no cover
|
|
39
|
+
return SimpleGitVersioningVersionSource
|
|
@@ -45,8 +45,7 @@ def finalize_distribution_options(distribution: Distribution) -> None: # pragma
|
|
|
45
45
|
|
|
46
46
|
if not isinstance(flavor, str):
|
|
47
47
|
raise TypeError(
|
|
48
|
-
"unexpected value for `tool.simple-git-versioning.setuptools`:"
|
|
49
|
-
f" '{pyproject['tool']['simple-git-versioning']['setuptools']}', expected 'pep440' or 'semver2'"
|
|
48
|
+
f"unexpected value for `tool.simple-git-versioning.setuptools`: '{flavor}', expected 'pep440' or 'semver2'"
|
|
50
49
|
)
|
|
51
50
|
|
|
52
51
|
flavor = flavor.casefold()
|