Skip to content

Commit 8682314

Browse files
Merge pull request #286 from neutrinoceros/enh/pep735-support
ENH: add support for PEP 735 dependency-groups via a new workflow input `test_groups`
2 parents 2688e81 + 848e825 commit 8682314

File tree

9 files changed

+77
-22
lines changed

9 files changed

+77
-22
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
required: false
1717
default: true
1818
type: boolean
19+
test_groups:
20+
description: PEP 735 dependency groups that should be installed for testing
21+
required: false
22+
default: ''
23+
type: string
1924
test_extras:
2025
description: Any extras_requires modifier that should be used to install the package for testing
2126
required: false
@@ -154,13 +159,21 @@ jobs:
154159
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
155160
with:
156161
platforms: all
162+
- name: Parse dependency groups
163+
shell: bash
164+
run: |
165+
echo "space_sep_groups=$( python -c "print('${{ inputs.test_groups }}'.replace(',', ' '))" )" >> "$GITHUB_ENV"
157166
- name: Configure cibuildwheel
158167
shell: bash
159168
run: |
160169
if [ -n "${{ inputs.test_extras }}" ];
161170
then
162171
echo "CIBW_TEST_EXTRAS=${{ inputs.test_extras }}" >> $GITHUB_ENV
163172
fi
173+
if [ -n "${{ inputs.test_groups }}" ];
174+
then
175+
echo "CIBW_TEST_GROUPS=$space_sep_groups" >> $GITHUB_ENV
176+
fi
164177
set +e
165178
IFS='' read -r -d '' test_command <<"EOF"
166179
${{ inputs.test_command }}
@@ -233,8 +246,9 @@ jobs:
233246
with:
234247
apt: ${{ inputs.libraries }}
235248
- id: build
236-
uses: OpenAstronomy/build-python-dist@bbb0e1c5b132893999ea56d77bd4b526e0097c7d # v1.0.1
249+
uses: OpenAstronomy/build-python-dist@9a4b2bd6bda5c48ef3c12b53504ee2263ed032e3 # v1.1.0
237250
with:
251+
test_groups: ${{ inputs.test_groups }}
238252
test_extras: ${{ inputs.test_extras }}
239253
test_command: ${{ inputs.test_command }}
240254
pure_python_wheel: false

.github/workflows/publish_pure_python.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: Build and publish pure Python package
33
on:
44
workflow_call:
55
inputs:
6+
test_groups:
7+
description: PEP 735 dependency groups that should be installed for testing
8+
required: false
9+
default: ''
10+
type: string
611
test_extras:
712
description: Any extras_requires modifier that should be used to install the package for testing
813
required: false
@@ -118,8 +123,9 @@ jobs:
118123
with:
119124
apt: ${{ inputs.libraries }}
120125
- id: build
121-
uses: OpenAstronomy/build-python-dist@bbb0e1c5b132893999ea56d77bd4b526e0097c7d # v1.0.1
126+
uses: OpenAstronomy/build-python-dist@9a4b2bd6bda5c48ef3c12b53504ee2263ed032e3 # v1.1.0
122127
with:
128+
test_groups: ${{ inputs.test_groups }}
123129
test_extras: ${{ inputs.test_extras }}
124130
test_command: ${{ inputs.test_command }}
125131
python-version: ${{ inputs.python-version }}

.github/workflows/test_publish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ jobs:
1717
release_default:
1818
uses: ./.github/workflows/publish.yml
1919
with:
20-
test_extras: test
20+
test_groups: test, concurrency
21+
test_extras: recommended
2122
test_command: pytest --pyargs test_package
2223
timeout-minutes: 30
2324
release:
2425
uses: ./.github/workflows/publish.yml
2526
with:
26-
test_extras: test
27+
test_groups: test, concurrency
28+
test_extras: recommended
2729
test_command: pytest --pyargs test_package
2830
targets: |
2931
- linux
@@ -41,6 +43,7 @@ jobs:
4143
release_sdist_only:
4244
uses: ./.github/workflows/publish.yml
4345
with:
44-
test_extras: test
46+
test_groups: test, concurrency
47+
test_extras: recommended
4548
test_command: pytest --pyargs test_package
4649
targets: ''

.github/workflows/test_publish_pure_python.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
release:
1818
uses: ./.github/workflows/publish_pure_python.yml
1919
with:
20-
test_extras: test
20+
test_groups: test, concurrency
21+
test_extras: recommended
2122
test_command: pytest --pyargs test_package
2223
timeout-minutes: 5
2324

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ jobs:
4141
publish:
4242
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@v1
4343
with:
44-
test_extras: test
44+
test_groups: test
45+
test_extras: recommended
4546
test_command: pytest --pyargs test_package
4647
targets: |
4748
- linux
@@ -60,7 +61,8 @@ jobs:
6061
publish:
6162
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
6263
with:
63-
test_extras: test
64+
test_groups: test
65+
test_extras: recommended
6466
test_command: pytest --pyargs test_package
6567
secrets:
6668
pypi_token: ${{ secrets.pypi_token }}

docs/source/publish.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ platform-dependent wheels.
1010
publish:
1111
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@v1
1212
with:
13-
test_extras: test
13+
test_groups: test, concurrency
14+
test_extras: recommended
1415
test_command: pytest --pyargs test_package
1516
targets: |
1617
- linux
@@ -78,6 +79,11 @@ sdist-runs-on
7879
Choose an alternative image for the runner to use for building and
7980
testing the source distribution. By default, this is ``ubuntu-latest``.
8081

82+
test_groups
83+
^^^^^^^^^^^
84+
85+
Comma-separated, PEP 735 dependency groups that should be installed for testing.
86+
8187
test_extras
8288
^^^^^^^^^^^
8389

docs/source/publish_pure_python.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ source distribution are build, tested and published instead.
1111
publish:
1212
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
1313
with:
14-
test_extras: test
14+
test_groups: test, concurrency
15+
test_extras: recommended
1516
test_command: pytest --pyargs test_package
1617
secrets:
1718
pypi_token: ${{ secrets.pypi_token }}
@@ -26,6 +27,11 @@ Choose an alternative image for the runner to use for building and
2627
testing the source distribution and wheel. By default, this is
2728
``ubuntu-latest``.
2829

30+
test_groups
31+
^^^^^^^^^^^
32+
33+
Comma-separated, PEP 735 dependency groups that should be installed for testing.
34+
2935
test_extras
3036
^^^^^^^^^^^
3137

pyproject.toml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
3-
build-backend = 'setuptools.build_meta'
2+
requires = ["setuptools>=61.2"]
3+
build-backend = "setuptools.build_meta"
44

55
[tool.cibuildwheel.linux]
66
environment-pass = ["GITHUB_WORKFLOW"]
77

8+
[project]
9+
name = "test-package"
10+
dynamic = ["version"]
11+
12+
[project.optional-dependencies]
13+
recommended = [
14+
"boto3",
15+
"urllib3",
16+
]
17+
18+
[dependency-groups]
19+
concurrency = [
20+
{include-group = "test"},
21+
"pytest-repeat>=0.9.3",
22+
"pytest-run-parallel>=0.4.4",
23+
]
24+
test = [
25+
"hypothesis>=6.113.0",
26+
"pytest>=8.3.5",
27+
]
28+
29+
[tool.setuptools]
30+
include-package-data = false
31+
32+
[tool.setuptools.packages]
33+
find = {namespaces = false}
34+
835
[tool.ruff]
936
line-length = 100

setup.cfg

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
1-
[metadata]
2-
name = test-package
3-
4-
[options]
5-
packages = find:
6-
7-
[options.extras_require]
8-
test =
9-
pytest
10-
111
[flake8]
122
max-line-length = 100

0 commit comments

Comments
 (0)