Skip to content

Commit ae5057d

Browse files
authored
chore(packaging): Fix computing SCM-based version @ the dists (#735)
The previously existing attempt to use `setuptools-git-version` never worked as it wasn't integrated correctly — it was added as a runtime dependency while it's meant to be a build dependency. This resulted in 0.0.0 being used all the time. This patch adds a hatchling plugin that implements the original idea in a way that actually works.
1 parent d87bf02 commit ae5057d

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

hatch.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ exclude = [
1010
packages = [
1111
'hooks/',
1212
]
13+
14+
[metadata.hooks.vcs.urls]
15+
'Source Archive' = 'https://github.com/antonbabenko/pre-commit-terraform/archive/{commit_hash}.tar.gz'
16+
'GitHub: repo' = 'https://github.com/antonbabenko/pre-commit-terraform'
17+
18+
[version]
19+
source = 'vcs'

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
[build-system]
22
requires = [
33
'hatchling',
4+
'hatch-vcs', # setuptools-scm
45
]
56
build-backend = 'hatchling.build'
67

78
[project]
89
name = 'pre-commit-terraform'
9-
version = '0.0.0'
10-
# version_format = '{tag}+{gitsha}'
1110
classifiers = [
1211
'License :: OSI Approved :: MIT License',
1312
'Programming Language :: Python :: 2',
@@ -19,17 +18,16 @@ classifiers = [
1918
'Programming Language :: Python :: Implementation :: PyPy',
2019
]
2120
description = 'Pre-commit hooks for terraform_docs_replace'
22-
dependencies = [
23-
'setuptools-git-version',
21+
dependencies = []
22+
dynamic = [
23+
'urls',
24+
'version',
2425
]
2526

2627
[[project.authors]]
2728
name = 'Contributors' # FIXME
2829
# email = 'степан@криївка.укр'
2930

30-
[project.urls]
31-
'GitHub: repo' = 'https://github.com/antonbabenko/pre-commit-terraform'
32-
3331
[project.readme]
3432
file = 'README.md'
3533
content-type = 'text/markdown'

0 commit comments

Comments
 (0)