Skip to content
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

Migrate CI from pip to uv #831

Closed
wants to merge 14 commits into from
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install .[strict,docs] --system
# ase needed to get FrechetCellFilter used by ML force fields
pip install git+https://gitlab.com/ase/ase
pip install .[strict,docs]
uv pip install --upgrade 'git+https://gitlab.com/ase/ase' --system

- name: Build
run: sphinx-build docs docs_build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install .[strict,docs] --system
# ase needed to get FrechetCellFilter used by ML force fields
pip install git+https://gitlab.com/ase/ase
pip install .[strict,docs]
uv pip install --upgrade 'git+https://gitlab.com/ase/ase' --system

- name: Build
run: sphinx-build docs docs_build
Expand Down
37 changes: 23 additions & 14 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: pip
cache-dependency-path: pyproject.toml

- uses: pre-commit/[email protected]
- name: Install dependencies
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure

test:
services:
Expand All @@ -42,6 +42,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "10.0"

- name: Install enumlib
run: |
cd ..
Expand All @@ -56,16 +61,20 @@ jobs:
sudo cp aux_src/makeStr.py /usr/local/bin/
continue-on-error: true # This is not critical to succeed.

# TODO figure out where the llvm-config bin is really located
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
LLVM_CONFIG=/home/runner/work/atomate2/atomate2/llvm/bin/llvm-config uv pip install .[strict,tests,abinit] --system --prerelease=allow
# latest ase needed to get FrechetCellFilter used by ML force fields
# TODO remove next line installing ase from main branch when FrechetCellFilter is released
uv pip install --upgrade 'git+https://gitlab.com/ase/ase' --system
uv pip install torch-runstats --system
uv pip install --no-deps nequip==0.5.6 --system

# Install pseudos for abinit tests
mkdir -p ~/.abinit/pseudos
cp -r tests/test_data/abinit/pseudos/ONCVPSP-PBE-SR-PDv0.4 ~/.abinit/pseudos
# ase needed to get FrechetCellFilter used by ML force fields
pip install git+https://gitlab.com/ase/ase
pip install .[strict,tests,abinit]
pip install torch-runstats
pip install --no-deps nequip==0.5.6

- name: Install pymatgen from master if triggered by pymatgen repo dispatch
if: github.event_name == 'repository_dispatch' && github.event.action == 'pymatgen-ci-trigger'
Expand Down Expand Up @@ -99,10 +108,10 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install .[strict,docs] --system
# ase needed to get FrechetCellFilter used by ML force fields
pip install git+https://gitlab.com/ase/ase
pip install .[strict,docs]
uv pip install --upgrade 'git+https://gitlab.com/ase/ase' --system

- name: Build
run: sphinx-build docs docs_build
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ forcefields = [
"mace-torch>=0.3.3",
"matgl>=1.1.1",
"quippy-ase>=0.9.14",
"torch<=2.2.1", # incompatibility with dgl if newer versions are used
"torch-runstats>=0.2.0", # transitive dependency for NequIP
"torch<=2.2.1", # incompatibility with dgl if newer versions are used
]
docs = [
"FireWorks==2.0.3",
Expand Down Expand Up @@ -106,7 +107,8 @@ strict = [
"python-ulid==2.7.0",
"quippy-ase==0.9.14",
"seekpath==2.1.0",
"torch==2.2.1",
"torch-runstats>=0.2.0", # transitive dependency for NequIP
"torch==2.2.1", # incompatibility with dgl if newer versions are used
"typing-extensions==4.12.2",
]

Expand Down
4 changes: 1 addition & 3 deletions tests/vasp/jobs/test_eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ def test_mp_gga_eos_relax_maker(mock_vasp, clean_dir, vasp_test_dir):

def test_mp_gga_eos_static_maker(mock_vasp, clean_dir, vasp_test_dir):
# map from job name to directory containing reference output files
ref_paths = {
"EOS MP GGA static": "Si_EOS_MP_GGA/mp-149-PBE-EOS_Static_0",
}
ref_paths = {"EOS MP GGA static": "Si_EOS_MP_GGA/mp-149-PBE-EOS_Static_0"}

# settings passed to fake_run_vasp; adjust these to check for certain INCAR settings
fake_run_vasp_kwargs = {
Expand Down
7 changes: 4 additions & 3 deletions tests/vasp/test_base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import numpy as np
import pytest
from custodian.vasp.handlers import ErrorHandler
from pymatgen.core import Lattice, Structure
from pymatgen.core import Structure

from atomate2.vasp.run import DEFAULT_HANDLERS
from atomate2.vasp.sets.base import get_magmoms
Expand All @@ -15,7 +16,7 @@ def test_get_magmoms(
) -> None:
# structure with Co that will be assigned magmoms
struct = Structure(
lattice=Lattice.cubic(3),
lattice=3 * np.eye(3),
species=["Co", "Fe"],
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
)
Expand Down Expand Up @@ -44,7 +45,7 @@ def test_get_magmoms_with_specie() -> None:
# the code that checks for `Specie.spin`.
# @jmmshn
struct = Structure(
lattice=Lattice.cubic(3),
lattice=3 * np.eye(3),
species=["Co2+", "Fe3+"],
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
)
Expand Down
9 changes: 5 additions & 4 deletions tests/vasp/test_sets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import pytest
from pymatgen.core import Lattice, Species, Structure
from pymatgen.core import Species, Structure

from atomate2.vasp.sets.core import StaticSetGenerator
from atomate2.vasp.sets.mp import MPMetaGGARelaxSetGenerator
Expand All @@ -10,7 +11,7 @@ def struct_no_magmoms() -> Structure:
"""Dummy FeO structure with expected +U corrections but no magnetic moments
defined."""
return Structure(
lattice=Lattice.cubic(3),
lattice=3 * np.eye(3),
species=("Fe", "O"),
coords=((0, 0, 0), (0.5, 0.5, 0.5)),
)
Expand All @@ -23,7 +24,7 @@ def struct_with_spin() -> Structure:
oxi = Species("O2-", spin=0.63)

return Structure(
lattice=Lattice.cubic(3),
lattice=3 * np.eye(3),
species=(iron, oxi),
coords=((0, 0, 0), (0.5, 0.5, 0.5)),
)
Expand All @@ -41,7 +42,7 @@ def struct_with_magmoms(struct_no_magmoms) -> Structure:
def struct_no_u_params() -> Structure:
"""Dummy SiO structure with no anticipated +U corrections"""
return Structure(
lattice=Lattice.cubic(3),
lattice=3 * np.eye(3),
species=("Si", "O"),
coords=((0, 0, 0), (0.5, 0.5, 0.5)),
)
Expand Down
Loading