Skip to content

Commit 68a7a3b

Browse files
authored
Stop using deprecated packages in CI (#630)
* Stop using deprecated packages in CI pep517 has been deprecated for a long time and we don't need it anymore, courtesy of importlib.metadata. * News fragment * Try a fake version to look at the output * Silence pip version warnings The default pip versions are good enought, nowadays. * Add debug output & give better name * Revert "Try a fake version to look at the output" This reverts commit 3aadb6a.
1 parent 11f9297 commit 68a7a3b

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ defaults:
1111
run:
1212
shell: bash
1313

14+
env:
15+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
16+
1417
jobs:
1518
build:
1619
name: ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}
@@ -250,18 +253,15 @@ jobs:
250253
- name: Set up Python
251254
uses: actions/setup-python@v4
252255
with:
253-
python-version: 3.11
254-
255-
- name: Install dependencies
256-
run: |
257-
python -m pip install --upgrade pip
258-
python -m pip install pep517
256+
python-version: 3.12
259257

260258
- name: Display structure of files to be pushed
261259
run: ls --recursive dist/
262260

263-
- name: Check matched tag version and branch version - on tag
264-
run: python admin/check_tag_version_match.py "${{ github.ref }}"
261+
- name: Ensure tag and package versions match.
262+
run: |
263+
python -Im pip install dist/*.whl
264+
python -I admin/check_tag_version_match.py "${{ github.ref }}"
265265
266266
- name: Publish to PyPI - on tag
267267
uses: pypa/gh-action-pypi-publish@a56da0b891b3dc519c7ee3284aff1fad93cc8598

admin/check_tag_version_match.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#
22
# Used during the release process to make sure that we release based on a
3-
# tag that has the same version as the current twisted.__version.
3+
# tag that has the same version as the current packaging metadata.
44
#
55
# Designed to be conditionally called inside GitHub Actions release job.
66
# Tags should use PEP440 version scheme.
77
#
8-
# To be called as: admin/check_tag_version_match.py refs/tags/twisted-20.3.0
8+
# To be called as: admin/check_tag_version_match.py refs/tags/20.3.0
99
#
10+
1011
import sys
1112

12-
import pep517.meta
13+
from importlib import metadata
1314

1415

1516
TAG_PREFIX = "refs/tags/"
@@ -18,7 +19,8 @@
1819
print("No tag check requested.")
1920
sys.exit(0)
2021

21-
branch_version = pep517.meta.load(".").version
22+
pkg_version = metadata.version("towncrier")
23+
print(f"Package version is {pkg_version}.")
2224
run_version = sys.argv[1]
2325

2426
if not run_version.startswith(TAG_PREFIX):
@@ -27,9 +29,9 @@
2729

2830
run_version = run_version[len(TAG_PREFIX) :] # noqa: E203
2931

30-
if run_version != branch_version:
31-
print(f"Branch is at '{branch_version}' while tag is '{run_version}'")
32+
if run_version != pkg_version:
33+
print(f"Package is at '{pkg_version}' while tag is '{run_version}'")
3234
exit(1)
3335

34-
print(f"All good. Branch and tag versions match for '{branch_version}'.")
36+
print(f"All good. Package and tag versions match for '{pkg_version}'.")
3537
sys.exit(0)

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[build-system]
2-
requires = [
3-
"hatchling",
4-
]
2+
requires = ["hatchling"]
53
build-backend = "hatchling.build"
64

75

src/towncrier/newsfragments/630.misc.rst

Whitespace-only changes.

0 commit comments

Comments
 (0)