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