Skip to content

Commit a3efe35

Browse files
committed
chore: properly extract tag version
Signed-off-by: JP-Ellis <[email protected]>
1 parent ae218a5 commit a3efe35

File tree

8 files changed

+96
-31
lines changed

8 files changed

+96
-31
lines changed

.github/workflows/build-cli.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
runs-on: ubuntu-latest
4949

5050
steps:
51-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
51+
- name: Checkout code
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5253
with:
53-
# Fetch all tags
5454
fetch-depth: 0
5555

5656
- name: Set up uv
@@ -92,9 +92,9 @@ jobs:
9292
- os: windows-latest
9393

9494
steps:
95-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
95+
- name: Checkout code
96+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9697
with:
97-
# Fetch all tags
9898
fetch-depth: 0
9999

100100
- name: Filter targets
@@ -149,7 +149,6 @@ jobs:
149149
- name: Checkout code
150150
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
151151
with:
152-
# Fetch all tags
153152
fetch-depth: 0
154153

155154
- name: Install git cliff and typos

.github/workflows/build.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ jobs:
4949
runs-on: ubuntu-latest
5050

5151
steps:
52-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
52+
- name: Checkout code
53+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5354
with:
54-
# Fetch all tags
5555
fetch-depth: 0
5656

5757
- name: Set up uv
@@ -93,9 +93,9 @@ jobs:
9393
archs: AMD64
9494

9595
steps:
96-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
96+
- name: Checkout code
97+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9798
with:
98-
# Fetch all tags
9999
fetch-depth: 0
100100

101101
- name: Cache pip packages
@@ -167,9 +167,9 @@ jobs:
167167
# build: ""
168168

169169
steps:
170-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
170+
- name: Checkout code
171+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
171172
with:
172-
# Fetch all tags
173173
fetch-depth: 0
174174

175175
- name: Cache pip packages
@@ -227,7 +227,6 @@ jobs:
227227
- name: Checkout code
228228
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
229229
with:
230-
# Fetch all tags
231230
fetch-depth: 0
232231

233232
- name: Install git cliff and typos

.github/workflows/test.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ jobs:
8585
experimental: true
8686

8787
steps:
88-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
88+
- name: Checkout code
89+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8990
with:
91+
fetch-depth: 0
9092
submodules: true
9193

9294
- name: Set up uv
@@ -161,8 +163,10 @@ jobs:
161163
python-version: '3.9'
162164

163165
steps:
164-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
166+
- name: Checkout code
167+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
165168
with:
169+
fetch-depth: 0
166170
submodules: true
167171

168172
- name: Set up uv
@@ -202,7 +206,10 @@ jobs:
202206
PACT_BROKER_DATABASE_URL: sqlite:////tmp/pact_broker.sqlite
203207

204208
steps:
205-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
209+
- name: Checkout code
210+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
211+
with:
212+
fetch-depth: 0
206213

207214
- name: Set up uv
208215
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1
@@ -249,7 +256,10 @@ jobs:
249256
runs-on: ubuntu-latest
250257

251258
steps:
252-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
259+
- name: Checkout code
260+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
261+
with:
262+
fetch-depth: 0
253263

254264
- name: Set up uv
255265
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1
@@ -275,7 +285,10 @@ jobs:
275285
runs-on: ubuntu-latest
276286

277287
steps:
278-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
288+
- name: Checkout code
289+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
290+
with:
291+
fetch-depth: 0
279292

280293
- name: Set up uv
281294
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1
@@ -301,7 +314,10 @@ jobs:
301314
runs-on: ubuntu-latest
302315

303316
steps:
304-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
317+
- name: Checkout code
318+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
319+
with:
320+
fetch-depth: 0
305321

306322
- name: Set up uv
307323
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1
@@ -327,7 +343,10 @@ jobs:
327343
runs-on: ubuntu-latest
328344

329345
steps:
330-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
346+
- name: Checkout code
347+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
348+
with:
349+
fetch-depth: 0
331350

332351
- name: Spell Check Repo https://github.com/crate-ci/typos/commit/
333352
uses: crate-ci/typos@392b78fe18a52790c53f42456e46124f77346842 # v1.34.0
@@ -341,7 +360,10 @@ jobs:
341360
PRE_COMMIT_HOME: ${{ github.workspace }}/.pre-commit
342361

343362
steps:
344-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
363+
- name: Checkout code
364+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
365+
with:
366+
fetch-depth: 0
345367

346368
- name: Cache pre-commit
347369
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3

.taplo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ path = "taplo://taplo.toml"
55
align_entries = true
66
indent_entries = false
77
indent_tables = true
8-
reorder_arrays = true
8+
reorder_arrays = false
99
reorder_inline_tables = true
1010
reorder_keys = true

pact-python-cli/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
src/pact_cli/__version__.py
12
src/pact_cli/bin
2-
src/pact_cli/lib
33
src/pact_cli/data
4+
src/pact_cli/lib

pact-python-cli/pyproject.toml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@
33
description = "Pact CLI bundle for Python"
44
name = "pact-python-cli"
55

6+
dynamic = ["version"]
67
license = "MIT"
78

8-
# The first three segments of the version correspond to the Pact CLI version.
9-
# The last segment is incremented if there is a need to update the Python
10-
# package without changing the Pact CLI version.
11-
#
12-
# For the latest version, see:
13-
# https://github.com/pact-foundation/pact-ruby-standalone/releases
14-
version = "2.4.26.0"
15-
169
authors = [{ name = "Joshua Ellis", email = "[email protected]" }]
1710
maintainers = [{ name = "Joshua Ellis", email = "[email protected]" }]
1811

@@ -70,6 +63,7 @@ requires-python = ">=3.9"
7063
[build-system]
7164
build-backend = "hatchling.build"
7265
requires = [
66+
"hatch-vcs",
7367
"hatchling",
7468
"packaging",
7569
"requests",
@@ -78,8 +72,29 @@ requires = [
7872

7973
[tool.hatch]
8074

75+
[tool.hatch.version]
76+
source = "vcs"
77+
tag-pattern = "^pact-python-cli/(?P<version>[vV]?\\d+(?:\\.\\d+)*)$"
78+
79+
[tool.hatch.version.raw-options]
80+
git_describe_command = [
81+
"git",
82+
"describe",
83+
"--tags",
84+
"--dirty",
85+
"--always",
86+
"--long",
87+
"--match",
88+
"pact-python-cli/*",
89+
]
90+
root = ".."
91+
version_scheme = "no-guess-dev"
92+
8193
[tool.hatch.build]
8294

95+
[tool.hatch.build.hooks.vcs]
96+
version-file = "src/pact_cli/__version__.py"
97+
8398
[tool.hatch.build.targets.sdist]
8499
include = [
85100
# Source

pact-python-cli/src/pact_cli/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,22 @@
2424

2525
from __future__ import annotations
2626

27+
__author__ = "Pact Foundation"
28+
__license__ = "MIT"
29+
__url__ = "https://github.com/pact-foundation/pact-python"
30+
2731
import os
2832
import shutil
2933
import warnings
3034
from pathlib import Path
3135

36+
from pact_cli.__version__ import (
37+
__version__ as __version__,
38+
)
39+
from pact_cli.__version__ import (
40+
__version_tuple__ as __version_tuple__,
41+
)
42+
3243
_USE_SYSTEM_BINS = os.getenv("PACT_USE_SYSTEM_BINS", "").upper() in ("TRUE", "YES")
3344
_BIN_DIR = Path(__file__).parent.resolve() / "bin"
3445

pyproject.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,22 @@ requires = [
124124
[tool.hatch]
125125

126126
[tool.hatch.version]
127-
source = "vcs"
127+
source = "vcs"
128+
tag-pattern = "^pact-python/(?P<version>[vV]?\\d+(?:\\.\\d+)*)$"
129+
130+
[tool.hatch.version.raw-options]
131+
git_describe_command = [
132+
"git",
133+
"describe",
134+
"--tags",
135+
" --dirty",
136+
"--always",
137+
"--long",
138+
"--match",
139+
"pact-python-cli/*",
140+
]
141+
root = "."
142+
version_scheme = "no-guess-dev"
128143

129144
[tool.hatch.build]
130145

@@ -176,6 +191,9 @@ requires = [
176191
]
177192
features = ["devel"]
178193
installer = "uv"
194+
# This is require to get around an incompatibility between hatch and uv
195+
# See: https://github.com/pypa/hatch/issues/1639
196+
pre-install-commands = ["uv pip install -e .[devel]"]
179197

180198
[tool.hatch.envs.default.scripts]
181199
all = ["example", "format", "lint", "test", "typecheck"]

0 commit comments

Comments
 (0)