Skip to content

Commit e20c1a2

Browse files
authored
Merge pull request #154 from MDAnalysis/update-deployment-ci
update deployment workflow
2 parents dd8d17f + 80afbd2 commit e20c1a2

File tree

4 files changed

+171
-37
lines changed

4 files changed

+171
-37
lines changed

.github/workflows/deploy.yaml

Lines changed: 161 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,180 @@ on:
88
types:
99
- published
1010

11+
concurrency:
12+
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
13+
cancel-in-progress: false
14+
15+
defaults:
16+
run:
17+
shell: bash -l {0}
18+
19+
1120
jobs:
12-
testpypi_push:
13-
environment:
14-
name: deploy
15-
url: https://test.pypi.org/p/GridDataFormats
16-
permissions:
17-
id-token: write
18-
if: |
19-
github.repository == 'MDAnalysis/GridDataFormats' &&
20-
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
21-
name: Build, upload and test pure Python wheels to TestPypi
21+
build:
22+
name: Build package
2223
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.14"
32+
33+
- name: Install build dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install build twine
37+
38+
- name: Build package (binary wheel and source distribution package)
39+
run: |
40+
python -m build
41+
42+
- name: Check package
43+
run: |
44+
twine check dist/*
2345
46+
- name: Upload dist files
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: dist-files
50+
path: dist/
51+
retention-days: 1
52+
53+
test-pytest:
54+
name: Run tests
55+
runs-on: ubuntu-latest
56+
needs: build
2457
steps:
25-
- uses: actions/checkout@v4
58+
- name: Set up Python
59+
uses: actions/setup-python@v5
60+
with:
61+
python-version: "3.14"
2662

27-
- name: testpypi_deploy
28-
uses: MDAnalysis/pypi-deployment@main
29-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
63+
- name: Download dist files
64+
uses: actions/download-artifact@v4
3065
with:
31-
test_submission: true
32-
package_name: GridDataFormats
33-
module_name: 'gridData'
66+
name: dist-files
67+
path: dist/
3468

35-
pypi_push:
69+
- name: Install package with test dependencies and tests
70+
run: |
71+
python -m pip install --upgrade pip
72+
WHEEL_FILE=$(ls dist/*.whl)
73+
pip install "$WHEEL_FILE"[test]
74+
75+
- name: Test import
76+
run: |
77+
python -c "import gridData; print(f'Package {gridData.__version__} imported successfully')"
78+
79+
- name: Run basic tests
80+
run: |
81+
pytest --verbose --pyargs gridData
82+
83+
deploy-testpypi:
84+
name: Deploy to TestPyPI
85+
runs-on: ubuntu-latest
86+
needs: [build, test-pytest]
87+
if: |
88+
github.repository == 'MDAnalysis/GridDataFormats' &&
89+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
3690
environment:
37-
name: deploy
38-
url: https://pypi.org/p/GridDataFormats
91+
name: testpypi
92+
url: https://test.pypi.org/p/GridDataFormats
3993
permissions:
40-
id-token: write
94+
id-token: write # IMPORTANT: mandatory for trusted publishing
95+
steps:
96+
- name: Download dist files
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: dist-files
100+
path: dist/
101+
102+
- name: Publish to TestPyPI
103+
uses: pypa/gh-action-pypi-publish@v1.13.0
104+
with:
105+
repository-url: https://test.pypi.org/legacy/
106+
107+
deploy-pypi:
108+
name: Deploy to PyPI
109+
runs-on: ubuntu-latest
110+
needs: [build, test-pytest]
41111
if: |
42112
github.repository == 'MDAnalysis/GridDataFormats' &&
43113
(github.event_name == 'release' && github.event.action == 'published')
44-
name: Build, upload and test pure Python wheels to PyPi
45-
runs-on: ubuntu-latest
114+
environment:
115+
name: pypi
116+
url: https://pypi.org/p/GridDataFormats
117+
permissions:
118+
id-token: write # IMPORTANT: mandatory for trusted publishing
119+
steps:
120+
- name: Download dist files
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: dist-files
124+
path: dist/
125+
126+
- name: Publish to PyPI
127+
uses: pypa/gh-action-pypi-publish@v1.13.0
46128

129+
test-deployed-testpypi:
130+
name: Test deployed package (TestPyPI)
131+
runs-on: ${{ matrix.os }}
132+
strategy:
133+
fail-fast: false
134+
matrix:
135+
os: [ubuntu-latest, macos-latest]
136+
needs: deploy-testpypi
137+
if: |
138+
github.repository == 'MDAnalysis/GridDataFormats' &&
139+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
47140
steps:
48-
- uses: actions/checkout@v4
141+
- name: Set up Python
142+
uses: actions/setup-python@v5
143+
with:
144+
python-version: "3.14"
145+
146+
- name: Install from TestPyPI
147+
run: |
148+
python -m pip install --upgrade pip
149+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ GridDataFormats[test]
49150
50-
- name: pypi_deploy
51-
uses: MDAnalysis/pypi-deployment@main
52-
if: github.event_name == 'release' && github.event.action == 'published'
151+
- name: Test import
152+
run: |
153+
python -c "import gridData; print(f'Package {gridData.__version__} imported successfully from TestPyPi')"
154+
155+
- name: Run basic tests
156+
run: |
157+
pytest --verbose --pyargs gridData
158+
159+
test-deployed-pypi:
160+
name: Test deployed package (PyPI)
161+
runs-on: ${{ matrix.os }}
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
os: [ubuntu-latest, macos-latest]
166+
needs: deploy-pypi
167+
if: |
168+
github.repository == 'MDAnalysis/GridDataFormats' &&
169+
(github.event_name == 'release' && github.event.action == 'published')
170+
steps:
171+
- name: Set up Python
172+
uses: actions/setup-python@v5
53173
with:
54-
package_name: GridDataFormats
55-
module_name: 'gridData'
174+
python-version: "3.14"
175+
176+
- name: Install from PyPI
177+
run: |
178+
python -m pip install --upgrade pip
179+
pip install GridDataFormats[test]
180+
181+
- name: Test import
182+
run: |
183+
python -c "import gridData; print(f'Package {gridData.__version__} imported successfully from PyPi')"
184+
185+
- name: Run basic tests
186+
run: |
187+
pytest --verbose --pyargs gridData

CHANGELOG

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The rules for this file:
1313
* accompany each entry with github issue/PR number (Issue #xyz)
1414

1515
-------------------------------------------------------------------------------
16-
01/16/2026 IAlibay, ollyfutur, conradolandia, orbeckst, PlethoraChutney,
16+
01/22/2026 IAlibay, ollyfutur, conradolandia, orbeckst, PlethoraChutney,
1717
Pradyumn-cloud
1818

1919
* 1.1.0
@@ -24,10 +24,11 @@ The rules for this file:
2424
(issue #143)
2525
* Python 3.13 and 3.14 are now supported (PR #140)
2626
* Support for Python 3.9 and 3.10 is now dropped as per SPEC0 (PR #140)
27+
* all tests and data files are now included in the distribution (#156)
2728

2829
Enhancements
2930

30-
* `Grid` now accepts binary operations with any operand that can be
31+
* `Grid` now accepts binary operations with any operand that can be
3132
broadcasted to the grid's shape according to `numpy` broadcasting rules
3233
(PR #142)
3334
* `Grid` now allows forcing MRC/CCP4 maps to be read as volumes even when
@@ -38,6 +39,7 @@ The rules for this file:
3839

3940
* Attempting binary operations on grids with different edges now raises an
4041
exception (PR #142)
42+
* updated metadata license identifier (#155)
4143

4244

4345
10/21/2023 IAlibay, orbeckst, lilyminium

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include README.rst INSTALL CHANGELOG COPYING COPYING.LESSER AUTHORS
2-
include setup.py
2+
33

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ build-backend = "setuptools.build_meta"
88
[project]
99
name = "GridDataFormats"
1010
description = "Reading and writing of data on regular grids in Python"
11-
license = {file = "COPYING.LESSER" }
11+
license = "LGPL-3.0-or-later"
12+
license-files = ["COPYING", "COPYING.LESSER", "AUTHORS"]
1213
authors = [
1314
{name = "Oliver Beckstein", email = "orbeckst@gmail.com"},
1415
]
@@ -19,7 +20,6 @@ classifiers = [
1920
"Development Status :: 6 - Mature",
2021
"Environment :: Console",
2122
"Intended Audience :: Science/Research",
22-
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
2323
"Operating System :: POSIX",
2424
"Operating System :: MacOS :: MacOS X",
2525
"Operating System :: Microsoft :: Windows",
@@ -60,18 +60,18 @@ documentation = "https://www.mdanalysis.org/GridDataFormats/"
6060

6161
[tool.setuptools]
6262
zip-safe = true
63-
include-package-data = true
6463

6564
[tool.setuptools.packages.find]
6665
namespaces = false
67-
include=["gridData"]
68-
exclude=["devtools", "doc", "ci", "examples"]
66+
include = ["gridData", "gridData.tests", "gridData.tests.datafiles"]
67+
exclude = ["devtools", "doc", "ci", "examples"]
6968

7069
[tool.setuptools.package-data]
7170
gridData = [
7271
"tests/datafiles/*.dx",
7372
"tests/datafiles/*.dx.gz",
7473
"tests/datafiles/*.ccp4",
74+
"tests/datafiles/*.mrc",
7575
"tests/datafiles/*.plt",
7676
"tests/datafiles/*.bz2",
7777
]

0 commit comments

Comments
 (0)