Skip to content

Commit fc4d1f0

Browse files
authored
Pin CI packages to specific hashes (#51)
<!-- Provide a general summary of your changes in the Title above --> ## Description CI has been updated to pin specific hashes of CI scripts, as per the new group standard. ## Types of Changes <!-- Please select all items that apply, either now or after creating the pull request: --> - [ ] Documentation update - [ ] Bug fix - [x] New feature - [ ] Breaking change<sup>1</sup> <sup>1</sup>The change breaks (or has the potential to break) existing functionality and should be merged into the `breaking` branch ## Checklist: <!-- Please select all items that apply either now or after creating the pull request. --> - [ ] I am familiar with the [Development Guidelines](https://github.com/glotzerlab/parsnip/blob/main/doc/source/development.rst) - [ ] The changes introduced by this pull request are covered by existing or newly introduced tests. - [ ] I have updated the [changelog](https://github.com/glotzerlab/parsnip/blob/main/ChangeLog.rst) and added my name to the [credits](https://github.com/glotzerlab/parsnip/blob/main/doc/source/credits.rst).
1 parent aac37d3 commit fc4d1f0

File tree

9 files changed

+33
-85
lines changed

9 files changed

+33
-85
lines changed

.github/workflows/pypi-test-and-publish.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,17 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v4.2.2
18+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1919
with:
2020
persist-credentials: false
21-
- name: Set up Python
22-
uses: actions/setup-[email protected].0
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
2323
with:
24-
python-version: "3.x"
25-
26-
- name: Install pypa/build
27-
run: python3 -m pip install build --user
28-
- name: Build a binary wheel and a source tarball
29-
run: PYTHONWARNINGS=error python3 -m build
24+
version: "0.8.11"
25+
- name: uv build
26+
run: uv build --verbose -o dist
3027
- name: Store the distribution packages
31-
uses: actions/upload-artifact@v4.4.3
28+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3229
with:
3330
name: python-package-distributions
3431
path: dist/
@@ -45,12 +42,13 @@ jobs:
4542

4643
steps:
4744
- name: Download all the dists
48-
uses: actions/download-artifact@v4.1.8
45+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
4946
with:
5047
name: python-package-distributions
5148
path: dist/
52-
- name: Publish distribution to TestPyPI
53-
uses: pypa/gh-action-pypi-publish@release/v1
49+
- name: Publish to TestPyPI
50+
# TODO: udpate to use a pinned version rather than a single commit
51+
uses: pypa/gh-action-pypi-publish/ed01280d14b6f9a0edaa1a5494d8f7ffed709083
5452
with:
5553
repository-url: https://test.pypi.org/legacy/
5654
verbose: true
@@ -70,9 +68,11 @@ jobs:
7068

7169
steps:
7270
- name: Download all the dists
73-
uses: actions/download-artifact@v4.1.8
71+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
7472
with:
7573
name: python-package-distributions
7674
path: dist/
75+
7776
- name: Publish to PyPI
78-
uses: pypa/[email protected]
77+
# TODO: udpate to use a pinned version rather than a single commit
78+
uses: pypa/gh-action-pypi-publish/ed01280d14b6f9a0edaa1a5494d8f7ffed709083

.github/workflows/run_tests.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
run_test:
1818
runs-on: ${{ inputs.runs-on }}
1919
steps:
20-
- uses: actions/checkout@v4
21-
- uses: actions/setup-python@v5
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
21+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2222
with:
2323
python-version: ${{ inputs.python-version }}
2424
- name: Install uv
25-
uses: astral-sh/setup-uv@v4
25+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
2626
with:
27-
version: "0.6.6"
27+
version: "0.8.11"
2828

2929
- name: Install package
3030
run: |

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ci:
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v5.0.0
6+
rev: v6.0.0
77
hooks:
88
- id: end-of-file-fixer
99
exclude: tests/sample_data
@@ -16,7 +16,7 @@ repos:
1616
- id: debug-statements
1717
- id: requirements-txt-fixer
1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.9.3
19+
rev: v0.12.9
2020
hooks:
2121
- id: ruff
2222
types_or: [ python, pyi, jupyter ]

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[project]
66
name = "parsnip-cif"
77
version = "0.3.0"
8-
requires-python = ">=3.7"
8+
requires-python = ">=3.9"
99
description = "Minimal library for parsing CIF & mmCIF files in Python."
1010
readme = "README.rst"
1111
license-files = ["LICENSE"]
@@ -90,6 +90,7 @@ known-first-party = ["parsnip"]
9090

9191
[tool.ruff.lint.per-file-ignores]
9292
"tests/*" = ["D", "B018", "F811"]
93+
"tests/conftest.py" = ["N816", "N806"]
9394
"parsnip/*" = ["E741"]
9495
"__init__.py" = ["F401"] # Do not remove "unused" imports in __init__.py files
9596

test/output.txt

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

tests/test_key_reader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def test_read_key_value_pairs_random(cif_data, keys):
4747
_array_assertion_verbose(keys, parsnip_data, gemmi_data)
4848

4949

50-
def test_read_key_value_pairs_badcif(cif_data=bad_cif):
51-
parsnip_data = cif_data.file[cif_data.manual_keys]
50+
def test_read_key_value_pairs_badcif():
51+
parsnip_data = bad_cif.file[bad_cif.manual_keys]
5252
correct_data = [
5353
"1.000000(x)",
5454
"4.32343242",
@@ -60,4 +60,4 @@ def test_read_key_value_pairs_badcif(cif_data=bad_cif):
6060
r"45.6a/\s",
6161
None,
6262
]
63-
_array_assertion_verbose(cif_data.manual_keys, parsnip_data, correct_data)
63+
_array_assertion_verbose(bad_cif.manual_keys, parsnip_data, correct_data)

tests/test_patterns.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ def test_semicolon_to_string(line):
144144
ParseWarning, match="String contains single and double quotes"
145145
):
146146
fixed = _semicolon_to_string(line)
147-
assert (fixed == line) if ";" not in line else (";" not in fixed)
148-
return
149-
elif ";" not in line:
147+
assert (fixed == line) if ";" not in line else (";" not in fixed)
148+
return
149+
if ";" not in line:
150150
assert _semicolon_to_string(line) == line
151151
return
152152
fixed = _semicolon_to_string(line)

tests/test_table_reader.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ def test_read_atom_sites(cif_data):
6767
if not any(
6868
s in cif_data.filename for s in ["CCDC", "PDB", "AMCSD", "zeolite", "no42"]
6969
):
70-
import sys
71-
72-
if sys.version_info < (3, 8):
73-
return
74-
7570
warnings.filterwarnings("ignore", category=UserWarning)
7671

7772
atoms = asecif.read_cif(cif_data.filename)
@@ -100,9 +95,9 @@ def test_partial_table_read(cif_data, subset):
10095

10196

10297
@pytest.mark.skip("Would be nice to pass, but we are at least as good as gemmi here.")
103-
def test_bad_cif_symop(cif_data=bad_cif):
98+
def test_bad_cif_symop():
10499
# This file is thouroughly cooked - gemmi will not even read it.
105-
parsnip_data = cif_data.file.get_from_loops(cif_data.symop_keys)
100+
parsnip_data = bad_cif.file.get_from_loops(bad_cif.symop_keys)
106101
correct_data = [
107102
["1", "x,y,z"],
108103
["2", "-x,y,-z*1/2"],
@@ -115,26 +110,3 @@ def test_bad_cif_symop(cif_data=bad_cif):
115110
]
116111

117112
np.testing.assert_array_equal(parsnip_data, correct_data)
118-
119-
120-
@pytest.mark.skip("Too corrupted to be read")
121-
def test_bad_cif_atom_sites(cif_data=bad_cif):
122-
parsnip_data = cif_data.file[cif_data.atom_site_keys]
123-
np.testing.assert_array_equal(
124-
parsnip_data[:, 0],
125-
np.array(["Aa(3)", "SL", "Oo", "O0f"]),
126-
)
127-
# "_atom_site_type_symbol"
128-
np.testing.assert_array_equal(parsnip_data[:, 1], ["Bb", "SM", "O", "O"])
129-
130-
# "_atom_site_symmetry_multiplicity"
131-
np.testing.assert_array_equal(parsnip_data[:, 2], ["1", "3", "5", "7"])
132-
133-
# "_atom_si te"
134-
np.testing.assert_array_equal(
135-
parsnip_data[:, 3], ["0.00000(1)", "0.00000", "0.19180", "0.09390"]
136-
)
137-
# "_atom_site_fract_z"
138-
np.testing.assert_array_equal(
139-
parsnip_data[:, 4], ["0.25000", "0.(28510)", "0.05170", "0.41220"]
140-
)

tests/test_unitcells.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def test_read_wyckoff_positions(cif_data):
4141

4242

4343
@all_files_mark
44-
def test_read_cell_params(cif_data, keys=box_keys):
44+
def test_read_cell_params(cif_data):
45+
keys = box_keys
4546
if "PDB_4INS_head.cif" in cif_data.filename:
4647
keys = (key[0] + key[1:].replace("_", ".", 1) for key in keys)
4748
parsnip_data = cif_data.file.read_cell_params()

0 commit comments

Comments
 (0)