Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Install uv with python version.
uses: astral-sh/setup-uv@v6
with:
python-version: "3.11"
python-version: "3.13"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: |
uv sync
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
python-version: "3.14"

- name: Build source distribution
run: |
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-13, windows-latest, ubuntu-24.04-arm]
python-version: ["310", "311", "312", "313"]
python-version: ["310", "311", "312", "313", "314"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repo
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
python-version: "3.14"

- name: Get build artifacts
uses: actions/download-artifact@v5
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,26 @@ jobs:
strategy:
fail-fast: false
matrix:
# Maximize CI coverage of different platforms and python versions while minimizing the
# total number of jobs. We run all pytest splits with the oldest supported python
# version (currently 3.10) on windows (seems most likely to surface errors) and with
# newest version (currently 3.13) on ubuntu (to get complete coverage on unix).
# Maximize CI coverage of different platforms and Python versions while minimizing the
# total number of jobs. We run all pytest splits with the oldest supported Python
# version on windows (most likely to surface errors) and with
# newest version on Ubuntu (to get complete coverage).
config:
- os: windows-latest
python: "3.10"
resolution: highest
python: "3.10" # Test lowest supported Python version
resolution: lowest-direct
extras: optional,prototypes
- os: windows-latest
python: "3.11"
resolution: highest
extras: prototypes,optional,numpy-v1 # Test NP1 on Windows (quite buggy ATM)
- os: macos-latest
python: "3.12"
python: "3.13"
resolution: lowest-direct
extras: prototypes # test with only required dependencies installed
- os: ubuntu-latest
python: "3.13"
resolution: lowest-direct
python: "3.14" # Test highest supported Python version
resolution: highest
Copy link
Contributor Author

@DanielYang59 DanielYang59 Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should test highest resolution in Ubuntu (likely mostly used) as it's the default strategy, so it would be closer to what most users get:

By default, uv tries to use the latest version of each package

extras: prototypes,optional

# pytest-split automatically distributes work load so parallel jobs finish in similar time
Expand All @@ -67,7 +67,7 @@ jobs:

runs-on: ${{ matrix.config.os }}
env:
OPT_BIN_DIR: ${{ github.workspace }}/opt/bin # for optional Unix dependencies
OPT_BIN_DIR: ${{ github.workspace }}/opt/bin # for optional Ubuntu dependencies
steps:
- name: Check out repo
uses: actions/checkout@v5
Expand Down
18 changes: 5 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Physics",
Expand Down Expand Up @@ -100,7 +101,7 @@ matcalc = [
"matgl>=1.2.7; python_version<'3.13'",
]
mlp = ["matgl>=1.2.7 ; python_version<'3.13'"]
numba = ["numba>=0.55"]
numba = ["numba>=0.55; python_version<'3.14'"]
numpy-v1 = ["numpy>=1.25.0,<2"] # Test NP1 on Windows (quite buggy ATM)
optional = [
"pymatgen[abinit,ase,matcalc,mlp,tblite,zeopp]",
Expand All @@ -112,7 +113,7 @@ optional = [
"f90nml>=1.1.2",
"galore>=0.6.1",
"h5py>=3.11.0",
"hiphive>=1.3.1",
"hiphive>=1.3.1; python_version<'3.14'",
"jarvis-tools>=2020.7.14",
"phonopy>=2.33.3",
"seekpath>=2.0.1",
Expand All @@ -123,7 +124,7 @@ symmetry = ["moyopy[interface]>=0.3", "spglib>=2.5"]
# tblite only support Python 3.12+ through conda-forge
# https://github.com/tblite/tblite/issues/175
tblite = ["tblite[ase]>=0.3.0; platform_system=='Linux' and python_version<'3.12'"]
vis = ["vtk>=6.0.0"]
vis = ["vtk>=6.0.0; python_version<'3.14'"]
zeopp = ["pyzeo; platform_system != 'Windows'"] # Note: requires Voro++ and Zeo++ to be installed

[project.scripts]
Expand Down Expand Up @@ -164,10 +165,6 @@ include = ["pymatgen", "pymatgen.*"]
"pymatgen.io.lammps" = ["CoeffsDataType.yaml", "templates/*.template"]
"pymatgen.symmetry" = ["*.json", "*.sqlite", "*.yaml"]

[tool.pdm.dev-dependencies]
lint = ["mypy>=1.10.0", "pre-commit>=3.7.1", "ruff>=0.4.9"]
test = ["pytest-cov>=5.0.0", "pytest-split>=0.9.0", "pytest>=8.2.2","pytest-xdist>=3.0.0"]

[tool.cibuildwheel.linux]
archs = ["auto64"]
skip = ["*musllinux*"]
Expand Down Expand Up @@ -261,7 +258,7 @@ docstring-code-format = true
addopts = "-n auto --durations=30 --quiet -r xXs --color=yes --import-mode=importlib"
filterwarnings = [
# NOTE: the LAST matching option would be used
"ignore::UserWarning", # Ignore UserWarning
"ignore::UserWarning",
]

[tool.coverage.run]
Expand All @@ -277,12 +274,7 @@ omit = [
[tool.coverage.report]
exclude_also = [
"@deprecated",
"def __repr__",
"except ImportError:",
"if TYPE_CHECKING:",
Copy link
Contributor Author

@DanielYang59 DanielYang59 Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's now excluded by default:

A branch just for type checkers: if TYPE_CHECKING:.

Added in version 7.10.0: the ... and TYPE_CHECKING defaults.

"if self.debug:",
"if settings.DEBUG",
"pragma: no cover",
"raise NotImplementedError",
"show_plot",
]
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/io/vasp/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5828,7 +5828,7 @@ def read_data(dtype):
@property
def cder(self) -> NDArray:
"""The complex derivative of the orbitals with respect to k."""
if self.cder_real.shape[0] != self.cder_real.shape[1]: # pragma: no cover
if self.cder_real.shape[0] != self.cder_real.shape[1]:
warnings.warn(
"Not all band pairs are present in the WAVEDER file."
"If you want to get all the matrix elements set LVEL=.True. in the INCAR.",
Expand Down
39 changes: 17 additions & 22 deletions tests/io/abinit/test_netcdf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
import sys
import tarfile

import numpy as np
Expand Down Expand Up @@ -60,7 +61,6 @@ def test_read_si2(self):
for varname, float_ref in ref_float_values.items():
value = data.read_value(varname)
assert_allclose(value, float_ref)
# assert 0

# Reading non-existent variables or dims should raise
# a subclass of NetcdReaderError
Expand All @@ -83,36 +83,31 @@ def test_read_si2(self):
# xc = data.read_abinit_xcfunc()
# assert xc == "LDA"

@pytest.mark.skipif(netCDF4 is None or True, reason="Requires Netcdf4")
def test_read_fe(self):
with tarfile.open(f"{TEST_DIR}/Fe_magmoms_collinear_GSR.tar.xz", mode="r:xz") as t:
@pytest.mark.skipif(netCDF4 is None, reason="Requires NetCDF4")
@pytest.mark.xfail(
sys.platform.startswith("linux") and os.getenv("CI") and netCDF4.__version__ >= "1.6.5",
reason="Fails with netCDF4 >= 1.6.5 on Ubuntu CI",
)
@pytest.mark.parametrize(
("tarname", "expected"),
[
("Fe_magmoms_collinear_GSR.tar.xz", [-0.5069359730980665]),
("Fe_magmoms_noncollinear_GSR.tar.xz", [[0.357939487, 0.357939487, 0]]),
],
)
def test_read_fe(self, tarname, expected):
with tarfile.open(os.path.join(TEST_DIR, tarname), mode="r:xz") as t:
# TODO: remove attr check after only 3.12+
if hasattr(tarfile, "data_filter"):
t.extractall(".", filter="data")
else:
t.extractall(".") # noqa: S202

ref_magmom_collinear = [-0.5069359730980665]
path = os.path.join(".", "Fe_magmoms_collinear_GSR.nc")

# TODO: PR4128, EtsfReader would fail in Ubuntu CI with netCDF4 > 1.6.5
# Need someone with knowledge in netCDF4 to fix it
with EtsfReader(path) as data:
structure = data.read_structure()
assert structure.site_properties["magmom"] == ref_magmom_collinear

with tarfile.open(f"{TEST_DIR}/Fe_magmoms_noncollinear_GSR.tar.xz", mode="r:xz") as t:
# TODO: remove attr check after only 3.12+
if hasattr(tarfile, "data_filter"):
t.extractall(".", filter="data")
else:
t.extractall(".") # noqa: S202
ref_magmom_noncollinear = [[0.357939487, 0.357939487, 0]]
path = os.path.join(".", "Fe_magmoms_noncollinear_GSR.nc")
path = os.path.basename(tarname).replace(".tar.xz", ".nc")

with EtsfReader(path) as data:
structure = data.read_structure()
assert structure.site_properties["magmom"] == ref_magmom_noncollinear
assert structure.site_properties["magmom"] == expected


class TestAbinitHeader(MatSciTest):
Expand Down
2 changes: 1 addition & 1 deletion tests/io/vasp/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ def test_init(self):
assert procar.get_occupation(0, "d")[Spin.up] == approx(0)
assert procar.get_occupation(0, "s")[Spin.up] == approx(0.35381249999999997)
assert procar.get_occupation(0, "p")[Spin.up] == approx(1.19540625)
with pytest.raises(ValueError, match="'m' is not in list"):
with pytest.raises(ValueError, match="not in list"):
Copy link
Contributor Author

@DanielYang59 DanielYang59 Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 3.14 changed the error message:

➜  temp uv run -p 3.13 test_index.py
Traceback (most recent call last):
  File "/Users/yang/developer/temp/test_index.py", line 1, in <module>
    print(["a"].index(1))
          ~~~~~~~~~~~^^^
ValueError: 1 is not in list

➜  temp uv run -p 3.14 test_index.py
Traceback (most recent call last):
  File "/Users/yang/developer/temp/test_index.py", line 1, in <module>
    print(["a"].index(1))
          ~~~~~~~~~~~^^^
ValueError: list.index(x): x not in list

procar.get_occupation(1, "m")
assert procar.nbands == 10
assert procar.nkpoints == 10
Expand Down
42 changes: 21 additions & 21 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.