Skip to content

Commit eb9062d

Browse files
authored
Merge branch 'master' into fix_icohp
Signed-off-by: Katharina Ueltzen <[email protected]>
2 parents b579e1c + 7b92f9a commit eb9062d

File tree

685 files changed

+49326
-141212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

685 files changed

+49326
-141212
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
set -x
4+
5+
# Use a custom bin directory for easier GitHub Actions caching
6+
BIN_DIR="${1:-$PWD/opt/bin}" && mkdir -p "$BIN_DIR"
7+
8+
# Install BoltzTraP
9+
wget --no-verbose -O BoltzTraP.tar.bz2 https://owncloud.tuwien.ac.at/index.php/s/s2d55LYlZnioa3s/download
10+
tar -jxf BoltzTraP.tar.bz2
11+
cp boltztrap-1.2.5/src/{BoltzTraP,x_trans} "$BIN_DIR"
12+
13+
# Install Vampire 5.0
14+
# TODO: Accepts self-signed cert (https://github.com/richard-evans/vampire/issues/122)
15+
wget --no-verbose --no-check-certificate https://vampire.york.ac.uk/resources/release-5/vampire-5.0-linux.tar.gz
16+
tar -zxf vampire-5.0-linux.tar.gz && mv linux vampire-5.0
17+
cp vampire-5.0/vampire-serial "$BIN_DIR"
18+
19+
# Install Voro++ and ZEO++
20+
wget --no-verbose http://www.zeoplusplus.org/zeo++-0.3.tar.gz
21+
tar -xzf zeo++-0.3.tar.gz
22+
make -C zeo++-0.3/voro++/src -s CFLAGS="-w"
23+
make -C zeo++-0.3 -s CFLAGS="-w"
24+
cp zeo++-0.3/voro++/src/voro++ "$BIN_DIR"
25+
cp zeo++-0.3/network "$BIN_DIR"
26+
27+
# Install mcsqs (from ATAT)
28+
# TODO: cannot build on MacOS
29+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
30+
wget --no-verbose https://axelvandewalle.github.io/www-avdw/atat/atat3_50.tar.gz
31+
tar -zxf atat3_50.tar.gz
32+
33+
# Replace `BINDIR` in makefile
34+
sed -i "s|^BINDIR=.*|BINDIR=$BIN_DIR|" atat/makefile
35+
36+
sudo apt install csh -y -q
37+
make -C atat && make -C atat install
38+
fi
39+
40+
# Add to path
41+
echo "$BIN_DIR" >> "$GITHUB_PATH"

.github/workflows/jekyll-gh-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828

2929
- name: Setup Pages
3030
uses: actions/configure-pages@v5
@@ -36,7 +36,7 @@ jobs:
3636
destination: ./_site
3737

3838
- name: Upload artifact
39-
uses: actions/upload-pages-artifact@v3
39+
uses: actions/upload-pages-artifact@v4
4040

4141
deploy:
4242
environment:

.github/workflows/lint.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Linting
1+
name: Lint
22

33
on:
44
push:
@@ -13,24 +13,23 @@ jobs:
1313
lint:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717

18-
- name: Set up Python
19-
uses: actions/setup-python@v5
18+
- name: Install uv with python version.
19+
uses: astral-sh/setup-uv@v6
2020
with:
21-
python-version: '3.x'
21+
python-version: "3.13"
22+
enable-cache: true
23+
cache-dependency-glob: "uv.lock"
2224

2325
- name: Install dependencies
2426
run: |
25-
pip install --upgrade ruff mypy pyright
27+
uv sync
2628
2729
- name: ruff
2830
run: |
29-
ruff check .
30-
ruff format --check .
31-
32-
- name: mypy
33-
run: mypy src
31+
uv run ruff check .
32+
uv run ruff format --check .
3433
3534
- name: pyright
36-
run: pyright
35+
run: uv run pyright src

.github/workflows/release.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Check out repo
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v5
2929

3030
- name: Install Python
31-
uses: actions/setup-python@v5
31+
uses: actions/setup-python@v6
3232
with:
33-
python-version: "3.12"
33+
python-version: "3.14"
3434

3535
- name: Build source distribution
3636
run: |
@@ -39,21 +39,22 @@ jobs:
3939
4040
- uses: actions/upload-artifact@v4
4141
with:
42+
name: dist-sdist
4243
path: dist/*.tar.gz
4344

4445
build_wheels:
4546
needs: test
4647
strategy:
4748
matrix:
48-
os: [ubuntu-latest, macos-latest, macos-13, windows-latest]
49-
python-version: ["310", "311", "312"]
49+
os: [ubuntu-latest, macos-latest, macos-13, windows-latest, ubuntu-24.04-arm]
50+
python-version: ["310", "311", "312", "313", "314"]
5051
runs-on: ${{ matrix.os }}
5152
steps:
5253
- name: Check out repo
53-
uses: actions/checkout@v4
54+
uses: actions/checkout@v5
5455

5556
- name: Build wheels
56-
uses: pypa/cibuildwheel@v2.16.5
57+
uses: pypa/cibuildwheel@v3.2.0
5758
env:
5859
CIBW_BUILD: cp${{ matrix.python-version }}-*
5960

@@ -74,12 +75,12 @@ jobs:
7475
id-token: write
7576
steps:
7677
- name: Set up Python
77-
uses: actions/setup-python@v5
78+
uses: actions/setup-python@v6
7879
with:
79-
python-version: "3.12"
80+
python-version: "3.14"
8081

8182
- name: Get build artifacts
82-
uses: actions/download-artifact@v4
83+
uses: actions/download-artifact@v5
8384
with:
8485
pattern: dist-*
8586
merge-multiple: true

.github/workflows/test.yml

Lines changed: 64 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
# Run the complete test suite incl. many external command line dependencies (like Openbabel)
22
# as well as the pymatgen.ext package. Coverage used to be computed based on this workflow.
3-
name: Tests
3+
name: test
44

55
on:
66
push:
77
branches: [master]
8-
paths-ignore: ["**/*.md", docs/**]
8+
paths:
9+
[
10+
"src/**/*.*",
11+
"tests/**/*.*",
12+
".github/workflows/*",
13+
"pyproject.toml",
14+
"setup.py",
15+
]
916
pull_request:
1017
branches: [master]
11-
paths-ignore: ["**/*.md", docs/**]
18+
paths:
19+
[
20+
"src/**/*.*",
21+
"tests/**/*.*",
22+
".github/workflows/*",
23+
"pyproject.toml",
24+
"setup.py",
25+
]
1226
workflow_dispatch:
1327
workflow_call: # make this workflow reusable by release.yml
1428

@@ -21,96 +35,91 @@ jobs:
2135
if: github.repository == 'materialsproject/pymatgen'
2236
defaults:
2337
run:
24-
shell: bash -l {0} # Enable conda/mamba env activation by reading bash profile
38+
shell: bash -leo pipefail {0} # Enable mamba env activation by reading bash profile
2539
strategy:
2640
fail-fast: false
2741
matrix:
28-
# Maximize CI coverage of different platforms and python versions while minimizing the
29-
# total number of jobs. We run all pytest splits with the oldest supported python
30-
# version (currently 3.10) on windows (seems most likely to surface errors) and with
31-
# newest version (currently 3.12) on ubuntu (to get complete coverage on unix).
42+
# Maximize CI coverage of different platforms and Python versions while minimizing the
43+
# total number of jobs. We run all pytest splits with the oldest supported Python
44+
# version on windows (most likely to surface errors) and with
45+
# newest version on Ubuntu (to get complete coverage).
3246
config:
3347
- os: windows-latest
34-
python: "3.10"
35-
resolution: highest
36-
extras: ci,optional
48+
python: "3.10" # Test lowest supported Python version
49+
resolution: lowest-direct
50+
extras: optional,prototypes
3751
- os: windows-latest
38-
python: "3.10"
52+
python: "3.11"
3953
resolution: highest
40-
extras: ci,optional,numpy-v1 # Test NP1 on Windows (quite buggy ATM)
41-
- os: ubuntu-latest
42-
python: "3.12"
43-
resolution: lowest-direct
44-
extras: ci,optional
54+
extras: prototypes,optional,numpy-v1 # Test NP1 on Windows (quite buggy ATM)
4555
- os: macos-latest
46-
python: "3.11"
56+
python: "3.13"
4757
resolution: lowest-direct
48-
extras: ci # test with only required dependencies installed
58+
extras: prototypes # test with only required dependencies installed
59+
- os: ubuntu-latest
60+
python: "3.14" # Test highest supported Python version
61+
resolution: highest
62+
extras: prototypes,optional
4963

5064
# pytest-split automatically distributes work load so parallel jobs finish in similar time
5165
# update durations file with `pytest --store-durations --durations-path tests/files/.pytest-split-durations`
5266
split: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
5367

5468
runs-on: ${{ matrix.config.os }}
5569
env:
56-
MPLBACKEND: Agg # non-interactive backend for matplotlib
57-
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
58-
PYTHONWARNDEFAULTENCODING: "true" # PEP 597: Enable optional EncodingWarning
70+
OPT_BIN_DIR: ${{ github.workspace }}/opt/bin # for optional Ubuntu dependencies
5971
steps:
6072
- name: Check out repo
61-
uses: actions/checkout@v4
73+
uses: actions/checkout@v5
6274

6375
- name: Create mamba environment
6476
uses: mamba-org/setup-micromamba@main
6577
with:
6678
environment-name: pmg
79+
cache-environment: true
6780
create-args: >-
6881
python=${{ matrix.config.python }}
6982
7083
- name: Install ubuntu-only conda dependencies
7184
if: matrix.config.os == 'ubuntu-latest'
7285
run: |
7386
micromamba install -n pmg -c conda-forge bader enumlib \
74-
openff-toolkit packmol pygraphviz tblite --yes
87+
packmol pygraphviz tblite --yes
88+
# openff-toolkit # TODO: doesn't support Python 3.13 yet
7589
7690
- name: Install uv
77-
uses: astral-sh/setup-uv@v4
91+
uses: astral-sh/setup-uv@v6
7892

7993
- name: Install pymatgen and dependencies via uv
8094
run: |
81-
micromamba activate pmg
82-
# TODO1 (use uv over pip) uv install torch is flaky, track #3826
83-
# TODO2 (pin torch version): DGL library (matgl) doesn't support torch > 2.2.1,
84-
# see: https://discuss.dgl.ai/t/filenotfounderror-cannot-find-dgl-c-graphbolt-library/4302
85-
pip install torch==2.2.1
86-
8795
# Install from wheels to test the content
8896
uv build --wheel --no-build-logs
8997
WHEEL_FILE=$(ls dist/pymatgen*.whl)
90-
uv pip install $WHEEL_FILE[${{matrix.config.extras}}] --resolution=${{matrix.config.resolution}}
98+
uv pip install $WHEEL_FILE[${{matrix.config.extras}}] --group test \
99+
--resolution=${{matrix.config.resolution}}
91100
92-
- name: Install optional Ubuntu dependencies
93-
if: matrix.config.os == 'ubuntu-latest'
94-
run: |
95-
# Install BoltzTraP
96-
wget -q -O BoltzTraP.tar.bz2 https://owncloud.tuwien.ac.at/index.php/s/s2d55LYlZnioa3s/download
97-
tar -jxf BoltzTraP.tar.bz2
98-
echo "$(realpath boltztrap-1.2.5/src/)" >> $GITHUB_PATH
101+
- name: Restore cache for optional Ubuntu/MacOS dependencies
102+
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest'
103+
id: optbin-cache
104+
uses: actions/cache@v4
105+
with:
106+
path: ${{ env.OPT_BIN_DIR }}
107+
key: opt-bin-${{ runner.os }}-${{ hashFiles('.github/workflows/_install_opt_unit_deps.sh') }}
99108

100-
# Install Vampire 5.0
101-
wget -q https://vampire.york.ac.uk/resources/release-5/vampire-5.0-linux.tar.gz
102-
tar -zxf vampire-5.0-linux.tar.gz
103-
mv linux vampire-5.0
104-
echo "$(realpath vampire-5.0/)" >> $GITHUB_PATH
109+
- name: Build optional Ubuntu/MacOS dependencies (when cache misses)
110+
if: (matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest') && steps.optbin-cache.outputs.cache-hit != 'true'
111+
run: bash .github/workflows/_install_opt_unit_deps.sh "$OPT_BIN_DIR"
105112

106113
- name: pytest split ${{ matrix.split }}
107114
env:
108-
MPLBACKEND: Agg # non-interactive backend for matplotlib
115+
MPLBACKEND: Agg # non-interactive backend for matplotlib
109116
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
110117
PMG_TEST_FILES_DIR: "${{ github.workspace }}/tests/files"
118+
PYTHONWARNDEFAULTENCODING: "true" # PEP 597: Enable optional EncodingWarning
111119
run: |
112-
micromamba activate pmg
113-
pytest --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests
120+
pytest tests \
121+
-n auto --splits 10 --group ${{ matrix.split }} \
122+
--durations-path tests/files/.pytest-split-durations \
114123
115124
trigger_atomate2_ci:
116125
needs: test
@@ -129,3 +138,11 @@ jobs:
129138
-H "X-GitHub-Api-Version: 2022-11-28" \
130139
https://api.github.com/repos/materialsproject/atomate2/dispatches \
131140
-d '{"event_type": "pymatgen-ci-trigger", "client_payload": {"pymatgen_ref": "${{ github.sha }}"}}'
141+
142+
all_pass:
143+
# This step is added to indicate all the tests have passed to make it easier to do auto-merge of PRs.
144+
needs: test
145+
runs-on: ubuntu-latest
146+
steps:
147+
- name: Echo
148+
run: echo "All tests pass"

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
__pycache__/
22
.DS_Store
3-
pymatgen.egg-info
3+
*.egg-info
44
*.o
55
*.so
66
*.pyc
77
*.swp
88
*.swo
99
*.pyd
1010
*.c
11-
pymatgen/pymatgen.cfg
1211
dist
1312
_build
1413
_site
@@ -21,13 +20,12 @@ build
2120
setuptools*
2221
.ipynb_checkpoints
2322
.cache
24-
.tox
2523
.eggs/
2624
.coverage
2725
.*_cache
2826
# VS Code
2927
.vscode/*
30-
28+
*.code-workspace
3129
# Environments
3230
.env
3331
.venv

0 commit comments

Comments
 (0)