|
1 | 1 | # SPDX-License-Identifier: MIT
|
2 | 2 |
|
3 | 3 | [build-system]
|
4 |
| -requires = ["hatchling"] |
| 4 | +requires = ["hatchling", "versioningit>=3.3.0"] |
5 | 5 | build-backend = "hatchling.build"
|
6 | 6 |
|
7 | 7 | [project]
|
@@ -125,10 +125,47 @@ test = { cmd = "nox -Rs test --", help = "Run pytest" }
|
125 | 125 | include = [
|
126 | 126 | "disnake/",
|
127 | 127 | ]
|
| 128 | +artifacts = ["disnake/_version.py"] |
128 | 129 |
|
129 | 130 | [tool.hatch.version]
|
130 |
| -path = "disnake/__init__.py" |
131 |
| -pattern = '__version__ = "(?P<version>.+)"' |
| 131 | +source = "versioningit" |
| 132 | + |
| 133 | +[tool.versioningit.vcs] |
| 134 | +method = "git-archive" |
| 135 | +describe-subst = "$Format:%(describe:tags,match=v*)$" |
| 136 | + |
| 137 | +[tool.versioningit.format] |
| 138 | +distance = "{base_version}+{distance}.{vcs}{rev}" |
| 139 | +dirty = "{base_version}+d{build_date:%Y%m%d}" |
| 140 | +distance-dirty = "{base_version}.a{distance}+{vcs}{rev}.d{build_date:%Y%m%d}" |
| 141 | + |
| 142 | +[tool.versioningit.template-fields.version-tuple] |
| 143 | +split-on = '^(\d+)\.(\d+)\.(\d+)\.([a-zA-Z])(\d+)(?:.\d+)?' |
| 144 | + |
| 145 | + |
| 146 | +[tool.versioningit.write] |
| 147 | +file = "disnake/_version.py" |
| 148 | +template = """ |
| 149 | +# SPDX-License-Identifier: MIT |
| 150 | +
|
| 151 | +from typing import Literal, NamedTuple |
| 152 | +
|
| 153 | +__version__ = "{version}" |
| 154 | +
|
| 155 | +
|
| 156 | +class VersionInfo(NamedTuple): |
| 157 | + major: int |
| 158 | + minor: int |
| 159 | + micro: int |
| 160 | + releaselevel: Literal["alpha", "beta", "candidate", "final"] |
| 161 | + serial: int |
| 162 | +
|
| 163 | +
|
| 164 | +# fmt: off |
| 165 | +version_info: VersionInfo = VersionInfo(*{version_tuple}[:5]) |
| 166 | +# fmt: on |
| 167 | +
|
| 168 | +""" |
132 | 169 |
|
133 | 170 | [tool.ruff]
|
134 | 171 | line-length = 100
|
|
0 commit comments