Skip to content
Open
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
15 changes: 12 additions & 3 deletions .github/workflows/architecture-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,23 @@ jobs:
steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.0"
python-version: "3.13"
- run: pip install tox
enable-cache: true
activate-environment: true

- name: Set up Python and install tox
run: |
uv python install
uv tool install tox --with tox-uv

- name: run architecture tests
run: tox -e ${{ matrix.architecture-name }}-tests
env:
# Use the CPU only version of torch when building/running the code
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
# For tox to use uv..
ENV_INSTALLER: "uv pip"
Comment on lines +46 to +47
Copy link
Contributor

Choose a reason for hiding this comment

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

This is for pip in tox to use uv, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup

16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,24 @@ jobs:

steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.0"
python-version: "3.13"
- run: pip install tox
enable-cache: true
activate-environment: true

- name: Set up Python and install tox
run: |
uv python install
uv tool install tox --with tox-uv

- name: Test build integrity
run: tox -e build
env:
# Use the CPU only version of torch when building/running the code
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
# For tox to use uv..
ENV_INSTALLER: "uv pip"
17 changes: 13 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,26 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: setup Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.0"
python-version: "3.13"
- name: install dependencies
run: python -m pip install tox
enable-cache: true
activate-environment: true

- name: Set up Python and install tox
run: |
uv python install
uv tool install tox --with tox-uv

- name: build documentation
run: tox -e docs
env:
# Use the CPU-only version of torch
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
# For tox to use uv..
ENV_INSTALLER: "uv pip"

- name: put documentation in the website
run: |
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@ jobs:
steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.0"
python-version: "3.13"
- run: pip install tox
enable-cache: true
activate-environment: true

- name: Set up Python and install tox
run: |
uv python install
uv tool install tox --with tox-uv

- name: Lint the code
run: tox -e lint
env:
# For tox to use uv..
ENV_INSTALLER: "uv pip"
17 changes: 14 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@ jobs:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: setup Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.0"
python-version: "3.13"
- run: python -m pip install tox
enable-cache: true
activate-environment: true

- name: Set up Python and install tox
run: |
uv python install
uv tool install tox --with tox-uv

- name: Build package
run: tox -e build
env:
# For tox to use uv..
ENV_INSTALLER: "uv pip"
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,21 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version:

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.0"
python-version: ${{ matrix.python-version }}
- run: pip install tox coverage[toml]
enable-cache: true
activate-environment: true

- name: Set up Python and install tox
run: |
uv python install
uv pip install coverage[toml]
uv tool install tox --with tox-uv

- name: run Python tests and collect coverage
run: |
Expand All @@ -47,6 +60,8 @@ jobs:
# Use the CPU only version of torch when building/running the code
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
HUGGINGFACE_TOKEN_METATRAIN: ${{ secrets.HUGGINGFACE_TOKEN }}
# For tox to use uv..
ENV_INSTALLER: "uv pip"

- name: upload to codecov.io
uses: codecov/codecov-action@v5
Expand Down
10 changes: 9 additions & 1 deletion ci/containers/Containerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ FROM docker://nvidia/cuda:12.9.1-cudnn-devel-ubuntu24.04

# FFTW library required by spinfast: https://github.com/moble/spinsfast?tab=readme-ov-file#pip
RUN apt update && \
apt install -y libfftw3-dev python3 python3-pip python3-venv git && \
apt install -y libfftw3-dev \
python3 python3-pip python3-venv \
git curl && \
apt clean

RUN python3 -m pip install --break-system-packages tox

# Install uv, using the recommended script
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"
# Setup tox for uv usage
ENV ENV_INSTALLER="uv pip"

ENV PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu129
ENV CUDA_HOME="/usr/local/cuda"
8 changes: 4 additions & 4 deletions ci/containers/Containerfile.mtt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ FROM $BASE_IMAGE
# The repo is cloned by CI (GIT_STRATEGY: clone)
COPY . /metatrain/

RUN python3 -m venv /mtt-venv && \
RUN uv venv /mtt-venv && \
. /mtt-venv/bin/activate && \
python -m pip install torch==2.8.0+cu129 setuptools wheel cmake>=3.30 && \
python -m pip install --no-build-isolation sphericart-torch && \
python -m pip install /metatrain[soap-bpnn]
uv pip install --no-cache-dir torch==2.8.0+cu129 setuptools wheel cmake>=3.30 && \
uv pip install --no-cache-dir --no-build-isolation sphericart-torch && \
uv pip install --no-cache-dir /metatrain[soap-bpnn]
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ source = [
".tox/*/lib/python*/site-packages/metatrain"
]

[tool.coverage.run]
patch = ["subprocess"]

[tool.ruff]
exclude = ["docs/src/examples/**", "src/metatrain/_version.py"]
line-length = 88
Expand Down
24 changes: 17 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[tox]
min_version = 4.0
requires =
tox>=4.31
tox-uv>=1.23
# these are the default environments, i.e. the list of tests running when you
# execute `tox` in the command-line without anything else
envlist =
Expand All @@ -12,7 +15,8 @@ envlist =
nanopet-tests

[testenv]
package = editable
package = wheel
wheel_build_env = .pkg
passenv = *
lint_folders =
"{toxinidir}/developer/" \
Expand Down Expand Up @@ -103,9 +107,11 @@ extras = # architectures used in the package tests
pet
setenv =
COVERAGE_RUN = 1
allowlist_externals = bash
allowlist_externals =
uv
bash
commands_pre =
python -m pip install --no-build-isolation sphericart torch-spex>=0.1,<0.2 wigners
{env:ENV_INSTALLER:python -m pip} install --no-build-isolation sphericart torch-spex>=0.1,<0.2 wigners
bash {toxinidir}/tests/resources/generate-outputs.sh
commands =
pytest \
Expand All @@ -123,7 +129,9 @@ deps =
build
check-manifest
twine
allowlist_externals = bash
allowlist_externals =
uv
bash
commands_pre =
bash -c "rm -f dist/*.whl"
bash -c "rm -f dist/*.tar.gz"
Expand All @@ -143,7 +151,7 @@ deps =
cmake
changedir = src/metatrain/soap_bpnn/tests/
commands =
python -m pip install --no-build-isolation sphericart torch-spex>=0.1,<0.2 wigners cmake
{env:ENV_INSTALLER:python -m pip} install --no-build-isolation sphericart torch-spex>=0.1,<0.2 wigners cmake
pytest {posargs}


Expand Down Expand Up @@ -203,11 +211,13 @@ description = builds the documentation with sphinx
deps =
-r docs/requirements.txt
cmake
allowlist_externals = bash
allowlist_externals =
uv
bash
extras = # these models are used in the documentation
gap
commands =
python -m pip install --no-build-isolation sphericart torch-spex>=0.1,<0.2 wigners
{env:ENV_INSTALLER:python -m pip} install --no-build-isolation sphericart torch-spex>=0.1,<0.2 wigners
# Run example and usage scripts.
bash -c "set -e && cd {toxinidir}/examples/basic_usage && bash usage.sh"
bash -c "set -e && cd {toxinidir}/examples/ase && bash train.sh"
Expand Down
Loading