Skip to content

Commit

Permalink
Use binary distribution (wheels) to install pymatgen in test suite (#…
Browse files Browse the repository at this point in the history
…4073)

* comment tweaks

* pin python 3.12 in CI

* try to install from sdist

* try to add test files dir

* uncomment resolution

* set lower pin for bs4 from year 2017

* remove duplicate in dep declare

* drop quotes

* remove duplicated comment

* sort optional dependencies

* TEST: test exclude a required file from sdist would lead to CI failure

* Revert "TEST: test exclude a required file from sdist would lead to CI failure"

This reverts commit 0dba028.

* perhaps install from wheels?

* skip failing test as dgl doesn't support torch 2.4.1

* revert pyproject in favor in separate PR

* fix missing @
  • Loading branch information
DanielYang59 authored Nov 13, 2024
1 parent 179cdeb commit 704c9c9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issue-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# Calculate the last day of the previous month
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
#Set an environment variable with the date range
# Set an environment variable with the date range
echo "$first_day..$last_day"
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release # makes PyPI releases
# Make PyPI releases
name: Release

on:
release:
Expand Down Expand Up @@ -26,12 +27,12 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build sdist
- name: Build source distribution
run: |
pip install build
python -m build --sdist
Expand Down Expand Up @@ -66,7 +67,7 @@ jobs:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
# For pypi trusted publishing
# For PyPI trusted publishing
id-token: write
steps:
- name: Set up Python
Expand All @@ -81,9 +82,12 @@ jobs:
merge-multiple: true
path: dist

- name: Publish to PyPi or TestPyPI
- name: Publish to PyPI or TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
repository-url: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'test-release' && 'https://test.pypi.org/legacy/' || '' }}
repository-url: >
${{ github.event_name == 'workflow_dispatch' &&
github.event.inputs.task == 'test-release' &&
'https://test.pypi.org/legacy/' || '' }}
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ jobs:
- name: Install ubuntu-only conda dependencies
if: matrix.config.os == 'ubuntu-latest'
run: |
micromamba install -n pmg -c conda-forge bader enumlib openff-toolkit packmol pygraphviz tblite --yes
micromamba install -n pmg -c conda-forge bader enumlib \
openff-toolkit packmol pygraphviz tblite --yes
- name: Install pymatgen and dependencies via uv
run: |
Expand All @@ -84,7 +85,12 @@ jobs:
# see: https://discuss.dgl.ai/t/filenotfounderror-cannot-find-dgl-c-graphbolt-library/4302
pip install torch==2.2.1
uv pip install --editable '.[${{ matrix.config.extras }}]' --resolution=${{ matrix.config.resolution }}
# Install from wheels to test the content
uv pip install build
python -m build --wheel
uv pip install dist/*.whl
uv pip install pymatgen[${{ matrix.config.extras }}] --resolution=${{ matrix.config.resolution }}
- name: Install optional Ubuntu dependencies
if: matrix.config.os == 'ubuntu-latest'
Expand All @@ -101,6 +107,8 @@ jobs:
echo "$(realpath vampire-5.0/)" >> $GITHUB_PATH
- name: pytest split ${{ matrix.split }}
env:
PMG_TEST_FILES_DIR: "${{ github.workspace }}/tests/files"
run: |
micromamba activate pmg
pytest --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests
Expand Down
2 changes: 2 additions & 0 deletions tests/transformations/test_advanced_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def test_apply_transformation(self):
for struct_trafo in alls:
assert "energy" not in struct_trafo

@pytest.mark.skip(reason="dgl don't support torch 2.4.1+, #4073")
def test_m3gnet(self):
pytest.importorskip("matgl")
enum_trans = EnumerateStructureTransformation(refine_structure=True, sort_criteria="m3gnet_relax")
Expand All @@ -200,6 +201,7 @@ def test_m3gnet(self):
# Check ordering of energy/atom
assert alls[0]["energy"] / alls[0]["num_sites"] <= alls[-1]["energy"] / alls[-1]["num_sites"]

@pytest.mark.skip(reason="dgl don't support torch 2.4.1+, #4073")
def test_callable_sort_criteria(self):
matgl = pytest.importorskip("matgl")
from matgl.ext.ase import Relaxer
Expand Down

0 comments on commit 704c9c9

Please sign in to comment.