Skip to content

Run CI tests on Windows and macOS #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 62 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
69f4acc
Add CI for windows and macos
janbridley Mar 12, 2025
40f0b90
Fix variable names
janbridley Mar 12, 2025
3b8d43a
Fix conflicting versions
janbridley Mar 12, 2025
cdade82
Update script to work on windows
janbridley Mar 12, 2025
2c3f857
Fix activation script
janbridley Mar 12, 2025
f85e406
Test uv run
janbridley Mar 12, 2025
27fec18
Remove uv sync
janbridley Mar 12, 2025
1b500cb
Use pure uv run
janbridley Mar 12, 2025
fd12a9b
Restore venv
janbridley Mar 12, 2025
6d30e60
Swap order of conditions
janbridley Mar 12, 2025
55d5cb1
Strip failed outputs
janbridley Mar 12, 2025
9613791
Test wildcard
janbridley Mar 12, 2025
27683d7
Fix path seperator
janbridley Mar 13, 2025
683ddcc
Swap to pip sync
janbridley Mar 13, 2025
2d2bd8a
Remove only-binary
janbridley Mar 13, 2025
13c4d4c
Test print numpy
janbridley Mar 13, 2025
741e9b3
Remove path modification
janbridley Mar 13, 2025
bacc15b
Confirm path is issue
janbridley Mar 13, 2025
43865a2
Swap to explicit ternary
janbridley Mar 13, 2025
336d5f1
Use explicit if-else
janbridley Mar 13, 2025
6f3cc06
Fix typo
janbridley Mar 13, 2025
7b322bb
Use bash on windows
janbridley Mar 13, 2025
1698a10
Remove duplicate
janbridley Mar 13, 2025
cb95714
Alternate if
janbridley Mar 13, 2025
3d6f830
Disable ubuntu
janbridley Mar 13, 2025
3ae64cf
remove bash shell on windows
janbridley Mar 13, 2025
cc4f1e9
Fix condition
janbridley Mar 13, 2025
665b331
Use seperate steps for windows
janbridley Mar 13, 2025
faa3aa7
Fix syntax
janbridley Mar 13, 2025
64f0aa3
Swap to single quotes
janbridley Mar 13, 2025
07b3228
Fix typo
janbridley Mar 13, 2025
0aa303d
Swap sync -> install
janbridley Mar 13, 2025
59ecc79
Add -r
janbridley Mar 13, 2025
1008cd0
Remove --system
janbridley Mar 13, 2025
4e0c78a
Swap to pure UV
janbridley Mar 13, 2025
7998b59
Install parnip in CI
janbridley Mar 13, 2025
33027c6
Optional dependencies
janbridley Mar 13, 2025
62a37fb
Revert deps
janbridley Mar 13, 2025
e07e8e5
Revert
janbridley Mar 13, 2025
d447aff
Debug
janbridley Mar 13, 2025
87ce677
More debug
janbridley Mar 13, 2025
f49ad39
--python
janbridley Mar 13, 2025
df682e1
Disable windows tests
janbridley Mar 13, 2025
2e9be62
Remove uv lock
janbridley Mar 13, 2025
aca5b3b
Attemp --system
janbridley Mar 13, 2025
0a01ead
uv python install
janbridley Mar 13, 2025
346848e
use setup-python
janbridley Mar 13, 2025
ae71de8
Test on windows-latest py3.13
janbridley Mar 13, 2025
e0931e7
Disable doctests on windows
janbridley Mar 13, 2025
d55f84f
Run pytest as module
janbridley Mar 13, 2025
557f4ce
Test repr
janbridley Mar 13, 2025
bc31b7e
Fix tests on windows
janbridley Mar 13, 2025
f003dbe
Strip carriage returns
janbridley Mar 13, 2025
05415ab
Centralize _arrstriip
janbridley Mar 13, 2025
5213ec1
Enable windows-3.9
janbridley Mar 13, 2025
0c761fd
Add update-uv-lockfiles.sh
janbridley Mar 13, 2025
049f13b
Update requirements files
janbridley Mar 13, 2025
9f282d4
Ban pycifrw>=5.0.0
janbridley Mar 13, 2025
ef96db4
Add missing shebang
janbridley Mar 13, 2025
b97ec9c
Separate windows CI into action
janbridley Mar 13, 2025
22d536d
Fix typo
janbridley Mar 13, 2025
d14165e
Update changelog
janbridley Mar 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/requirements-3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ cycler==0.12.1
# via matplotlib
exceptiongroup==1.2.2
# via pytest
fonttools==4.55.3
fonttools==4.56.0
# via matplotlib
gemmi==0.7.0
# via -r tests/requirements.in
iniconfig==2.0.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.0
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip (pyproject.toml)
numpy==2.2.1
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
# via
# parsnip (pyproject.toml)
# parsnip-cif (pyproject.toml)
# ase
# contourpy
# matplotlib
Expand All @@ -43,15 +43,15 @@ pycifrw==4.4.6
# via -r tests/requirements.in
pyparsing==3.2.1
# via matplotlib
pytest==8.3.4
pytest==8.3.5
# via
# -r tests/requirements.in
# pytest-doctestplus
pytest-doctestplus==1.3.0
pytest-doctestplus==1.4.0
# via -r tests/requirements.in
python-dateutil==2.9.0.post0
# via matplotlib
scipy==1.15.1
scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
Expand Down
16 changes: 8 additions & 8 deletions .github/requirements-3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ contourpy==1.3.1
# via matplotlib
cycler==0.12.1
# via matplotlib
fonttools==4.55.3
fonttools==4.56.0
# via matplotlib
gemmi==0.7.0
# via -r tests/requirements.in
iniconfig==2.0.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.0
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip (pyproject.toml)
numpy==2.2.1
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
# via
# parsnip (pyproject.toml)
# parsnip-cif (pyproject.toml)
# ase
# contourpy
# matplotlib
Expand All @@ -41,15 +41,15 @@ pycifrw==4.4.6
# via -r tests/requirements.in
pyparsing==3.2.1
# via matplotlib
pytest==8.3.4
pytest==8.3.5
# via
# -r tests/requirements.in
# pytest-doctestplus
pytest-doctestplus==1.3.0
pytest-doctestplus==1.4.0
# via -r tests/requirements.in
python-dateutil==2.9.0.post0
# via matplotlib
scipy==1.15.1
scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
16 changes: 8 additions & 8 deletions .github/requirements-3.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ contourpy==1.3.1
# via matplotlib
cycler==0.12.1
# via matplotlib
fonttools==4.55.3
fonttools==4.56.0
# via matplotlib
gemmi==0.7.0
# via -r tests/requirements.in
iniconfig==2.0.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.0
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip (pyproject.toml)
numpy==2.2.1
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
# via
# parsnip (pyproject.toml)
# parsnip-cif (pyproject.toml)
# ase
# contourpy
# matplotlib
Expand All @@ -41,15 +41,15 @@ pycifrw==4.4.6
# via -r tests/requirements.in
pyparsing==3.2.1
# via matplotlib
pytest==8.3.4
pytest==8.3.5
# via
# -r tests/requirements.in
# pytest-doctestplus
pytest-doctestplus==1.3.0
pytest-doctestplus==1.4.0
# via -r tests/requirements.in
python-dateutil==2.9.0.post0
# via matplotlib
scipy==1.15.1
scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
16 changes: 8 additions & 8 deletions .github/requirements-3.13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ contourpy==1.3.1
# via matplotlib
cycler==0.12.1
# via matplotlib
fonttools==4.55.3
fonttools==4.56.0
# via matplotlib
gemmi==0.7.0
# via -r tests/requirements.in
iniconfig==2.0.0
# via pytest
kiwisolver==1.4.8
# via matplotlib
matplotlib==3.10.0
matplotlib==3.10.1
# via ase
more-itertools==10.6.0
# via parsnip (pyproject.toml)
numpy==2.2.1
# via parsnip-cif (pyproject.toml)
numpy==2.2.3
# via
# parsnip (pyproject.toml)
# parsnip-cif (pyproject.toml)
# ase
# contourpy
# matplotlib
Expand All @@ -41,15 +41,15 @@ pycifrw==4.4.6
# via -r tests/requirements.in
pyparsing==3.2.1
# via matplotlib
pytest==8.3.4
pytest==8.3.5
# via
# -r tests/requirements.in
# pytest-doctestplus
pytest-doctestplus==1.3.0
pytest-doctestplus==1.4.0
# via -r tests/requirements.in
python-dateutil==2.9.0.post0
# via matplotlib
scipy==1.15.1
scipy==1.15.2
# via ase
six==1.17.0
# via python-dateutil
10 changes: 5 additions & 5 deletions .github/requirements-3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cycler==0.12.1
# via matplotlib
exceptiongroup==1.2.2
# via pytest
fonttools==4.55.3
fonttools==4.56.0
# via matplotlib
gemmi==0.7.0
# via -r tests/requirements.in
Expand All @@ -21,10 +21,10 @@ kiwisolver==1.4.7
matplotlib==3.9.4
# via ase
more-itertools==10.6.0
# via parsnip (pyproject.toml)
# via parsnip-cif (pyproject.toml)
numpy==2.0.2
# via
# parsnip (pyproject.toml)
# parsnip-cif (pyproject.toml)
# ase
# contourpy
# matplotlib
Expand All @@ -45,11 +45,11 @@ pycifrw==4.4.6
# via -r tests/requirements.in
pyparsing==3.2.1
# via matplotlib
pytest==8.3.4
pytest==8.3.5
# via
# -r tests/requirements.in
# pytest-doctestplus
pytest-doctestplus==1.3.0
pytest-doctestplus==1.4.0
# via -r tests/requirements.in
python-dateutil==2.9.0.post0
# via matplotlib
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ["ubuntu-latest"]
include:
- runs-on: "macos-latest"
python-version: "3.13"
- runs-on: "macos-latest"
python-version: "3.9"
# Pull in the test script from run_tests and distribute python from matrix versions
uses: ./.github/workflows/run_tests.yaml
with:
Expand All @@ -29,6 +34,22 @@ jobs:
matrix: # Code works on py3.6, but type annotations are broken
python-version: ["3.7", "3.8"]
runs-on: ["ubuntu-20.04"]
include:
- runs-on: "macos-14"
python-version: "3.8"
uses: ./.github/workflows/run_tests.yaml
with:
python-version: ${{ matrix.python-version }}
runs-on: ${{ matrix.runs-on }}
requirements-file: ".github/requirements-${{ matrix.python-version }}.txt"

run-tests-windows:
needs: run-tests-modern-python
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.9", "3.13"]
runs-on: ["windows-latest"]
uses: ./.github/workflows/run_tests.yaml
with:
python-version: ${{ matrix.python-version }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ jobs:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ inputs.python-version }}
version: "0.5.11"
- name: Set up environment with dependencies
run: |
uv venv && . .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
version: "0.6.6"

- name: Install package
run: |
which python
python --version
uv pip install . -r ${{ inputs.requirements-file }} -v
uv pip install . -r ${{ inputs.requirements-file }} -v --reinstall --system
python -c "import parsnip; print('parsnip', parsnip.__version__)"

- name: Test with pytest
run: |
python -m pytest -v
run: python -m ${{ runner.os != 'Windows' && 'pytest' || 'pytest tests' }} -v
5 changes: 5 additions & 0 deletions .github/workflows/update-uv-lockfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

for version in 3.{9..13}; do
uv pip compile --python-version="$version" pyproject.toml tests/requirements.in > ".github/requirements-$version.txt"
done
1 change: 1 addition & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Added
- New ``additional_columns`` parameter for ``build_unit_cell`` that allows the return of
atom site labels and similar data alongside unit cell positions.
- Ensured consistent ordering of lattice positions returned from ``build_unit_cell``.
- CI testing on Windows and macOS

Fixed
~~~~~
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import os
import re
from dataclasses import dataclass

import numpy as np
Expand All @@ -14,6 +15,10 @@
data_file_path = os.path.dirname(__file__) + "/sample_data/"


def _arrstrip(arr: np.ndarray, pattern: str):
return np.vectorize(lambda x: re.sub(pattern, "", x))(arr)


@dataclass
class CifData:
filename: str
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ase
gemmi
pycifrw
pycifrw<5.0.0
pytest
pytest-doctestplus
2 changes: 1 addition & 1 deletion tests/test_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_try_cast_to_numeric(s):
def test_repr(cif_data):
import re

repr = re.sub(r"[a-z\s]*", "", cif_data.file.__repr__().split(":")[1]).split(",")
repr = re.sub(r"[a-z\s]*", "", cif_data.file.__repr__().split(" : ")[1]).split(",")
n_pairs, n_tabs = [int(i) for i in repr]
assert n_pairs == len(cif_data.file.pairs)
assert n_tabs == len(cif_data.file.loops)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_table_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
from ase.io import cif as asecif
from CifFile import CifFile as pycifRW
from conftest import bad_cif, cif_files_mark
from conftest import _arrstrip, bad_cif, cif_files_mark
from gemmi import cif
from more_itertools import flatten

Expand Down Expand Up @@ -34,7 +34,7 @@ def test_reads_all_keys(cif_data):
loop = [pycif.true_case[key] for key in loop]
parsnip_data = cif_data.file.get_from_loops(loop)
gemmi_data = _gemmi_read_table(cif_data.filename, loop)
np.testing.assert_array_equal(parsnip_data, gemmi_data)
np.testing.assert_array_equal(parsnip_data, _arrstrip(gemmi_data, r"\r"))


@cif_files_mark
Expand Down
7 changes: 1 addition & 6 deletions tests/test_unitcells.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import re
import warnings
from contextlib import nullcontext

import numpy as np
import pytest
from ase import io
from ase.build import supercells
from conftest import box_keys, cif_files_mark
from conftest import _arrstrip, box_keys, cif_files_mark
from gemmi import cif
from more_itertools import flatten

Expand All @@ -22,10 +21,6 @@ def _gemmi_read_keys(filename, keys, as_number=True):
return np.array([file_block.find_value(key) for key in keys])


def _arrstrip(arr: np.ndarray, pattern: str):
return np.vectorize(lambda x: re.sub(pattern, "", x))(arr)


@cif_files_mark # TODO: test with conversions to numeric as well
def test_read_wyckoff_positions(cif_data):
if "PDB_4INS_head.cif" in cif_data.filename:
Expand Down
Loading