Skip to content

Commit b72d403

Browse files
authored
Migrate to setuptools build backend (#156)
1 parent 3e14d22 commit b72d403

File tree

8 files changed

+84
-56
lines changed

8 files changed

+84
-56
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ jobs:
8282
run: |
8383
python -m pip install --upgrade pip
8484
pip install lxml flake8 pytest coverage
85-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
8685
- name: Lint with flake8
8786
run: |
8887
# The GitHub editor is 127 chars wide
@@ -92,8 +91,8 @@ jobs:
9291
coverage run -m pytest
9392
bash <(curl -s https://codecov.io/bash)
9493
95-
package-publish:
96-
name: "Publish Package"
94+
package-build:
95+
name: "Build Package"
9796
needs: coverage-lint
9897
runs-on: ubuntu-latest
9998
steps:
@@ -104,24 +103,36 @@ jobs:
104103
python-version: 3.x
105104
- name: Build packages
106105
run: |
107-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
108-
pip install setuptools wheel
109-
python setup.py sdist bdist_wheel
106+
# Build packages
107+
echo "::group::build"
108+
pip install build
109+
python -m build
110+
echo "::endgroup::"
111+
112+
echo "::group::dist/"
113+
ls -lah dist/
114+
echo "::endgroup::"
115+
116+
echo "::group::tar.gz"
117+
tar -tzvf dist/junitparser-*.tar.gz
118+
echo "::endgroup::"
119+
120+
echo "::group::wheel"
121+
unzip -l dist/junitparser-*.whl
122+
echo "::endgroup::"
123+
124+
echo "::group::wheel metadata"
125+
unzip -p dist/junitparser-*.whl junitparser-*.dist-info/METADATA
126+
echo "::endgroup::"
110127
- name: Upload
111128
uses: actions/upload-artifact@v4
112129
with:
113130
name: Binaries
114131
path: dist/*
115-
- name: Publish to pypi
116-
if: startsWith(github.ref, 'refs/tags')
117-
uses: pypa/gh-action-pypi-publish@release/v1
118-
with:
119-
user: __token__
120-
password: ${{ secrets.pypi_password }}
121132

122133
test-whl:
123134
name: "Test whl"
124-
needs: package-publish
135+
needs: package-build
125136
uses: "./.github/workflows/test-whl.yml"
126137
with:
127138
os: '["ubuntu-24.04"]'
@@ -132,3 +143,24 @@ jobs:
132143
[
133144
{"os": "ubuntu-22.04", "python-version": "3.8"},
134145
]
146+
147+
package-publish:
148+
name: "Publish Package"
149+
needs: test-whl
150+
runs-on: ubuntu-latest
151+
steps:
152+
- uses: actions/checkout@v3
153+
- name: Download Binaries
154+
uses: actions/download-artifact@v4
155+
with:
156+
name: Binaries
157+
path: dist/
158+
- name: Inspect binaries
159+
run: |
160+
ls -lah dist/
161+
- name: Publish to pypi
162+
if: startsWith(github.ref, 'refs/tags')
163+
uses: pypa/gh-action-pypi-publish@release/v1
164+
with:
165+
user: __token__
166+
password: ${{ secrets.pypi_password }}

.github/workflows/test-os.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
run: |
4141
python -m pip install --upgrade pip
4242
pip install pytest
43-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4443
shell: bash
4544
- name: Test
4645
run: |

.github/workflows/test-whl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Run junitparser CLI
3838
run: |
3939
pip install dist/junitparser-*.whl
40-
wget https://raw.githubusercontent.com/weiwei/junitparser/003587443fd6f332e9a6bd4b027e657a76cca033/tests/data/no_fails.xml
40+
tar -xzf dist/junitparser-*.tar.gz --to-stdout --wildcards "junitparser-*/tests/data/no_fails.xml" > no_fails.xml
4141
junitparser verify no_fails.xml
4242
pip install lxml
4343
junitparser verify no_fails.xml

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include tests/data/*.xml

pyproject.toml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
11
[build-system]
2-
requires = ["setuptools >=44.0", "wheel >=0.37"]
3-
build-backend = "setuptools.build_meta:__legacy__"
2+
requires = ["setuptools >= 61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "junitparser"
7+
dynamic = ["version"]
8+
authors = [
9+
{ name="Weiwei Wang", email="gastlygem@gmail.com" },
10+
]
11+
description = "Manipulates JUnit/xUnit Result XML files"
12+
readme = "README.rst"
13+
requires-python = ">=3.6"
14+
dependencies = []
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: Apache Software License",
19+
"Topic :: Text Processing",
20+
"Programming Language :: Python :: 3",
21+
]
22+
license = {text = "Apache-2.0"}
23+
keywords = ["junit", "xunit", "xml", "parser"]
24+
25+
[project.urls]
26+
Homepage = "https://github.com/weiwei/junitparser"
27+
Issues = "https://github.com/weiwei/junitparser/issues"
28+
Documentation = "https://junitparser.readthedocs.io/"
29+
30+
[project.scripts]
31+
junitparser = "junitparser.cli:main"
32+
33+
[tool.setuptools]
34+
packages = ["junitparser"]
35+
license-files = ["LICENSE"]
36+
37+
[tool.setuptools.dynamic]
38+
version = {attr = "junitparser.version"}

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)