Skip to content

Commit 20260e3

Browse files
Fix Pixi platform setup in package CI (#216)
* Fix pixi platform setup in CI * Configure CI Pixi rich platforms * Format non-Python documentation files
1 parent 1d4ea51 commit 20260e3

5 files changed

Lines changed: 76 additions & 41 deletions

File tree

.github/workflows/pypi-test.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,43 @@ jobs:
4040
- name: Init pixi project
4141
run: pixi init easydiffraction
4242

43-
- name: Set the minimum system requirements
43+
- name: Configure Pixi platforms
4444
working-directory: easydiffraction
45+
shell: bash
4546
run: |
46-
pixi project system-requirements add macos 14.0
47-
pixi project system-requirements add glibc 2.35
48-
49-
- name: Add Python 3.14 from Conda
47+
set -euo pipefail
48+
49+
case "$RUNNER_OS" in
50+
Linux)
51+
pixi_platforms='[{ name = "linux-64-glibc-2-35", platform = "linux-64", glibc = "2.35" }]'
52+
;;
53+
macOS)
54+
pixi_platforms='[{ name = "osx-arm64-macos-14-0", platform = "osx-arm64", macos = "14.0" }]'
55+
;;
56+
Windows)
57+
pixi_platforms='["win-64"]'
58+
;;
59+
*)
60+
echo "Unsupported runner OS: $RUNNER_OS"
61+
exit 1
62+
;;
63+
esac
64+
65+
PIXI_PLATFORMS="$pixi_platforms" python -c 'import os, pathlib; path = pathlib.Path("pixi.toml"); text = path.read_text(); path.write_text(text.replace(text.split("platforms = ", 1)[1].split("\n", 1)[0], os.environ["PIXI_PLATFORMS"], 1))'
66+
pixi workspace platform list
67+
68+
- name: Add Python 3.14
5069
working-directory: easydiffraction
5170
run: pixi add "python=3.14"
5271

72+
# GNU Scientific Library (required by diffpy.pdffit2)
73+
# libc++ for macOS (required by diffpy.pdffit2)
5374
- name: Add other Conda dependencies
5475
working-directory: easydiffraction
5576
run: |
5677
pixi add gsl
5778
pixi add --platform osx-arm64 libcxx
5879
59-
#- name: Add pycrysfml calculator from custom PyPI index
60-
# working-directory: easydiffraction
61-
# run: |
62-
# echo '' >> pixi.toml
63-
# echo '[pypi-dependencies]' >> pixi.toml
64-
# echo 'pycrysfml = { version = ">=0.2.1", index = "https://easyscience.github.io/pypi/" }' >> pixi.toml
65-
6680
- name: Add easydiffraction (with dev dependencies) from PyPI
6781
working-directory: easydiffraction
6882
run: pixi add --pypi "easydiffraction[dev]"

.github/workflows/test.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,32 @@ jobs:
231231
pixi init easydiffraction_py$py_ver
232232
cd easydiffraction_py$py_ver
233233
234-
echo "Setting the minimum system requirements"
235-
pixi project system-requirements add macos 14.0
236-
pixi project system-requirements add glibc 2.35
237-
238-
echo "Adding Python $py_ver"
234+
echo "Configure Pixi platforms"
235+
case "$RUNNER_OS" in
236+
Linux)
237+
pixi_platforms='[{ name = "linux-64-glibc-2-35", platform = "linux-64", glibc = "2.35" }]'
238+
;;
239+
macOS)
240+
pixi_platforms='[{ name = "osx-arm64-macos-14-0", platform = "osx-arm64", macos = "14.0" }]'
241+
;;
242+
Windows)
243+
pixi_platforms='["win-64"]'
244+
;;
245+
*)
246+
echo "Unsupported runner OS: $RUNNER_OS"
247+
exit 1
248+
;;
249+
esac
250+
251+
PIXI_PLATFORMS="$pixi_platforms" python -c 'import os, pathlib; path = pathlib.Path("pixi.toml"); text = path.read_text(); path.write_text(text.replace(text.split("platforms = ", 1)[1].split("\n", 1)[0], os.environ["PIXI_PLATFORMS"], 1))'
252+
pixi workspace platform list
253+
254+
echo "Add Python $py_ver"
239255
pixi add "python=$py_ver"
240256
241-
echo "Adding GNU Scientific Library (required by diffpy.pdffit2)"
257+
# Add other Conda dependencies
258+
259+
echo "Add GNU Scientific Library (required by diffpy.pdffit2)"
242260
pixi add gsl
243261
244262
# diffpy.pdffit2 wheel links @rpath/libc++.1.dylib, which must be
@@ -248,14 +266,6 @@ jobs:
248266
echo "Adding libc++ for macOS (required by diffpy.pdffit2)"
249267
pixi add --platform osx-arm64 libcxx
250268
251-
# Doing this in a hacky way, as pixi does not support adding
252-
# dependencies from a custom PyPI index with a CLI command without
253-
# specifying full wheel name.
254-
#echo "Adding pycrysfml from custom PyPI index"
255-
#echo '' >> pixi.toml
256-
#echo '[pypi-dependencies]' >> pixi.toml
257-
#echo 'pycrysfml = { version = ">=0.2.1", index = "https://easyscience.github.io/pypi/" }' >> pixi.toml
258-
259269
echo "Looking for wheel in ../dist/py$py_ver/"
260270
ls -l "../dist/py$py_ver/"
261271
@@ -267,7 +277,7 @@ jobs:
267277
268278
whl_abs_path="$(python -c 'import os,sys; print(os.path.abspath(sys.argv[1]))' "${whl_path[0]}")"
269279
270-
echo "Adding easydiffraction from: $whl_abs_path"
280+
echo "Add easydiffraction from: $whl_abs_path"
271281
pixi add --pypi "easydiffraction[dev] @ ${whl_abs_path}"
272282
273283
echo "Exiting pixi project directory"

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ Please make sure you follow the EasyScience organization-wide
4242
If you are not planning to contribute code, you may want to:
4343

4444
- 🐞 Report a bug — see [Reporting Issues](#11-reporting-issues)
45-
- 🛡 Report a security issue — see
46-
[Security Issues](#12-security-issues)
45+
- 🛡 Report a security issue — see [Security Issues](#12-security-issues)
4746
- 💬 Ask a question or start a discussion at
4847
[Project Discussions](https://github.com/easyscience/diffraction-lib/discussions)
4948

docs/dev/adrs/accepted/iucr-cif-tag-alignment.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,10 @@ In `analysis/analysis.cif`:
276276
- Bayesian diagnostics, success/message/iterations/fitting*time,
277277
`result_kind`, `point_estimate_name`, fit-parameter posterior
278278
summaries, and the `_alias` / `_constraint` / `_joint_fit` /
279-
`\_sequential_fit*`registries — **stay under their current category names**. File-scoping to`analysis/analysis.cif`carries the disambiguation; no`\_easydiffraction\*\*`
280-
prefix is added in the default save.
279+
`\_sequential_fit*`registries — **stay under their current category
280+
names**. File-scoping to`analysis/analysis.cif`carries the
281+
disambiguation; no`\_easydiffraction\*\*` prefix is added in the
282+
default save.
281283
- The `_minimizer.*`, `_fitting_mode.*`, `_calculator.*` selectors stay
282284
under their current names for the same reason.
283285

docs/mkdocs.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,22 @@ nav:
266266
- LaB6 FCJ asymmetry: verification/pd-neut-cwl_LaB6_fcj-asymmetry.ipynb
267267
- LaB6 absorption: verification/pd-neut-cwl_LaB6_absorption.ipynb
268268
- LBCO basic pseudo-Voigt: verification/pd-neut-cwl_LBCO_basic.ipynb
269-
- LBCO preferred orientation: verification/pd-neut-cwl_LBCO_preferred-orientation.ipynb
269+
- LBCO preferred orientation:
270+
verification/pd-neut-cwl_LBCO_preferred-orientation.ipynb
270271
- PbSO4 basic pseudo-Voigt: verification/pd-neut-cwl_PbSO4_basic.ipynb
271-
- PbSO4 Berar-Baldinozzi asymmetry: verification/pd-neut-cwl_PbSO4_beba-asymmetry.ipynb
272+
- PbSO4 Berar-Baldinozzi asymmetry:
273+
verification/pd-neut-cwl_PbSO4_beba-asymmetry.ipynb
272274
- Y2O3 isotropic ADPs: verification/pd-neut-cwl_Y2O3_isotropic-adp.ipynb
273275
- Y2O3 beta ADPs: verification/pd-neut-cwl_Y2O3_beta-adp.ipynb
274276
- Powder, neutron, time-of-flight:
275277
- Fe pseudo-Voigt profile: verification/pd-neut-tof_Fe_pseudo-voigt.ipynb
276-
- NCAF Jorgensen-Von Dreele (Gaussian): verification/pd-neut-tof_NCAF_jorgensen-von-dreele.ipynb
278+
- NCAF Jorgensen-Von Dreele (Gaussian):
279+
verification/pd-neut-tof_NCAF_jorgensen-von-dreele.ipynb
277280
- Si Jorgensen profile: verification/pd-neut-tof_Si_jorgensen.ipynb
278-
- Si Jorgensen-Von Dreele profile: verification/pd-neut-tof_Si_jorgensen-von-dreele.ipynb
279-
- Si Jorgensen-Von Dreele + size/strain: verification/pd-neut-tof_Si_jorgensen-von-dreele-size-strain.ipynb
281+
- Si Jorgensen-Von Dreele profile:
282+
verification/pd-neut-tof_Si_jorgensen-von-dreele.ipynb
283+
- Si Jorgensen-Von Dreele + size/strain:
284+
verification/pd-neut-tof_Si_jorgensen-von-dreele-size-strain.ipynb
280285
- Diamond DREAM (ESS, McStas): verification/pd-neut-tof_diamond_dream.ipynb
281286
- Powder, X-ray, constant wavelength:
282287
- LiF single wavelength: verification/pd-xray-cwl_LiF_single.ipynb
@@ -287,13 +292,18 @@ nav:
287292
- Single crystal:
288293
- Pr2NiO4 basic (CWL): verification/sc-neut-cwl_Pr2NiO4_basic.ipynb
289294
- Tb2Ti2O7 basic (CWL): verification/sc-neut-cwl_Tb2Ti2O7_basic.ipynb
290-
- Tb2Ti2O7 isotropic extinction (CWL): verification/sc-neut-cwl_Tb2Ti2O7_isotropic-extinction.ipynb
291-
- Tb2Ti2O7 anisotropic ADPs (CWL): verification/sc-neut-cwl_Tb2Ti2O7_anisotropic-adp.ipynb
295+
- Tb2Ti2O7 isotropic extinction (CWL):
296+
verification/sc-neut-cwl_Tb2Ti2O7_isotropic-extinction.ipynb
297+
- Tb2Ti2O7 anisotropic ADPs (CWL):
298+
verification/sc-neut-cwl_Tb2Ti2O7_anisotropic-adp.ipynb
292299
- Taurine basic (TOF): verification/sc-neut-tof_taurine_basic.ipynb
293300
- Total scattering:
294-
- Ni gaussian-damped sinc: verification/total-neut-cwl_Ni_gaussian-damped-sinc.ipynb
295-
- Si gaussian-damped sinc: verification/total-neut-tof_Si_gaussian-damped-sinc.ipynb
296-
- NaCl gaussian-damped sinc: verification/total-xray_NaCl_gaussian-damped-sinc.ipynb
301+
- Ni gaussian-damped sinc:
302+
verification/total-neut-cwl_Ni_gaussian-damped-sinc.ipynb
303+
- Si gaussian-damped sinc:
304+
verification/total-neut-tof_Si_gaussian-damped-sinc.ipynb
305+
- NaCl gaussian-damped sinc:
306+
verification/total-xray_NaCl_gaussian-damped-sinc.ipynb
297307
- Command-Line:
298308
- Command-Line: cli/index.md
299309
- API Reference:

0 commit comments

Comments
 (0)