Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b149a06
Change coverage configuration file
sofiia-chorna Oct 8, 2025
6f61325
Include pytest-cov to architecture tests
sofiia-chorna Oct 8, 2025
48707f7
Add llpr to envlist
sofiia-chorna Oct 8, 2025
ffe3471
Add architecture tests to github ci steps
sofiia-chorna Oct 8, 2025
1171997
Add badge to doc
sofiia-chorna Oct 8, 2025
c83d683
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Oct 8, 2025
e0d3c18
Rename llpr to llpr-tests
sofiia-chorna Oct 8, 2025
d83af02
Separate coverage configs and badges
sofiia-chorna Oct 8, 2025
774b33b
Move coverage checks to architectures test workflow
sofiia-chorna Oct 8, 2025
0cf9bbf
Merge branch 'architecture-coverage-test' of https://github.com/sofii…
sofiia-chorna Oct 8, 2025
cc16998
Fix path to llpr
sofiia-chorna Oct 8, 2025
ab5fe05
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Oct 8, 2025
e96653a
Fix codecov-flag duplications
sofiia-chorna Oct 8, 2025
452c4c8
Merge branch 'architecture-coverage-test' of https://github.com/sofii…
sofiia-chorna Oct 8, 2025
0f625a2
Delete additional spacing
sofiia-chorna Oct 8, 2025
d5eacd9
Replace markdown with rst
sofiia-chorna Nov 6, 2025
cb78198
Move coverage to tox.ini to have it locally
sofiia-chorna Nov 6, 2025
b5f953a
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Nov 6, 2025
e30967e
Remove already deleted command from main
sofiia-chorna Nov 6, 2025
1162c51
Added flashmd
sofiia-chorna Nov 6, 2025
08f303e
Failling llpr checkpoint to be fixed separatelly
sofiia-chorna Nov 7, 2025
3ba02a0
Merge branch 'architecture-coverage-test' of https://github.com/lab-c…
sofiia-chorna Nov 7, 2025
6f56444
Centrize coverage ignore
sofiia-chorna Nov 7, 2025
eb179eb
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Nov 7, 2025
d6c4fdf
llpr-tests to be done in separate PR
sofiia-chorna Nov 7, 2025
af68f4a
Merge branch 'architecture-coverage-test' of https://github.com/lab-c…
sofiia-chorna Nov 7, 2025
64804cf
Delete llpr from architectural test
sofiia-chorna Nov 13, 2025
00111f8
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Nov 13, 2025
2cd7dc8
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Nov 19, 2025
2e26957
Added llpr to architecture tests
sofiia-chorna Nov 19, 2025
8f98cd1
Add badge to pet
sofiia-chorna Nov 19, 2025
b1b793f
Exclude tests in architectures from coverage report, clean up
sofiia-chorna Nov 19, 2025
6040a45
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Nov 19, 2025
2351e2f
Fix paths in omit coverage
sofiia-chorna Nov 19, 2025
ba787c6
Ignore tests in codecov
sofiia-chorna Nov 19, 2025
bb47225
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Dec 4, 2025
23043f2
Merge branch 'main' into architecture-coverage-test
sofiia-chorna Dec 5, 2025
b962f8c
Change to components, omit nested test folders, generate rst automati…
sofiia-chorna Dec 5, 2025
4db0a00
Add component_ids
sofiia-chorna Dec 6, 2025
f8bff80
Try relative path
sofiia-chorna Dec 6, 2025
363a0ec
Try to add component reporting
sofiia-chorna Dec 6, 2025
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
61 changes: 50 additions & 11 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
coverage:
status:
project:
default:
target: 88%
default: false

# core package
core:
target: 88%
paths:
- "src/metatrain/utils/.*"
- "src/metatrain/cli/.*"

patch:
default:
informational: true

component:
default: true

component_management:
individual_components:

# stable architectures
- component_id: gap
name: GAP
paths:
- "src/metatrain/gap/.*"

- component_id: soap_bpnn
name: SOAP-BPNN
paths:
- "src/metatrain/soap_bpnn/.*"

- component_id: pet
name: PET
paths:
- "src/metatrain/pet/.*"

- component_id: llpr
name: LLPR
paths:
- "src/metatrain/llpr/.*"

# deprecated architectures
- component_id: nanopet
name: NanoPET
paths:
- "src/metatrain/deprecated/nanopet/.*"

# experimental architectures
- component_id: flashmd
name: FlashMD
paths:
- "src/metatrain/experimental/flashmd/.*"

ignore:
# no need to report coverage of the test code themself
- "tests/.*"
- "examples/.*"
- "src/metatrain/utils/testing/.*"
# we don't check coverage for the architectures
- "src/metatrain/deprecated/.*"
- "src/metatrain/experimental/.*"
- "src/metatrain/gap/.*"
- "src/metatrain/pet/.*"
- "src/metatrain/soap_bpnn/.*"
- "src/metatrain/llpr/.*"
- "src/metatrain/**/tests/.*"
# we don't currently run distributed tests on CI
- "src/metatrain/utils/distributed/.*"

Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/architecture-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@ jobs:
- name: Setup dependencies
run: |
uv tool install tox --with tox-uv
pip install coverage[toml]

- name: run architecture tests
run: tox -e ${{ matrix.architecture-name }}-tests
- name: run architecture tests and generate coverage
run: |
tox -e ${{ matrix.architecture-name }}-tests
coverage xml -o coverage.xml
env:
# Use the CPU only version of torch when building/running the code
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu

- name: upload to codecov.io
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
files: coverage.xml
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ jobs:
uv pip install coverage[toml]
uv tool install tox --with tox-uv

- name: run Python tests and collect coverage
run: |
tox -e tests
coverage xml --data-file tests/.coverage
- name: run Python tests
run: tox -e tests
env:
# Use the CPU only version of torch when building/running the code
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
Expand Down
19 changes: 18 additions & 1 deletion docs/src/architectures/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,27 @@ def generate_rst(
**template_variables
)

codecov_arch_path = architecture_name.replace(".", "/")
badge_string = (
f".. image:: https://codecov.io/gh/metatensor/metatrain/branch/architecture-coverage-test/graph/badge.svg?component={architecture_real_name}"
f"\n :target: https://codecov.io/gh/metatensor/metatrain/tree/architecture-coverage-test/src/metatrain/{codecov_arch_path}"
)

# Prepend docstring with reference and append missing sections
lines = docstring.split("\n")
title_id = 0
underline_id = 1
docstring = (
f".. _architecture-{template_variables['architecture']}:" + "\n\n" + docstring
f".. _architecture-{template_variables['architecture']}:\n\n"
+ lines[title_id]
+ "\n"
+ lines[underline_id]
+ "\n\n"
+ badge_string
+ "\n"
+ "\n".join(lines[2:])
)

# Check for missing sections and add them to the end of the docstring
for section in SECTIONS:
section_var = "{{SECTION_" + section.upper() + "}}"
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ exclude_lines = [
]
omit = [
"*/site-packages/*",
"*/metatrain/experimental/*",
"*/metatrain/utils/testing/*"
"*/tests/*",
"src/metatrain/*/tests/*",
"src/metatrain/*/*/tests/*",
"src/metatrain/utils/testing/*",
"examples/*"
]

[tool.coverage.paths]
Expand All @@ -106,6 +109,7 @@ source = [

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

[tool.ruff]
exclude = ["docs/src/examples/**", "src/metatrain/_version.py"]
Expand Down
36 changes: 22 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ passenv = *
setenv =
UV_EXTRA_INDEX_URL = {env:PIP_EXTRA_INDEX_URL:}
UV_INDEX_STRATEGY = unsafe-best-match
COVERAGE_FILE = {toxinidir}/.coverage
lint_folders =
"{toxinidir}/developer/" \
"{toxinidir}/examples/" \
"{toxinidir}/src/" \
"{toxinidir}/tests/" \
"{toxinidir}/docs/src/"

# We apply stricter checks on the main code, but not on tests, examples, or
# external architectures
lint_strict_folders =
Expand All @@ -40,6 +42,7 @@ lint_strict_folders =
"{toxinidir}/src/metatrain/soap_bpnn"
exclude_tests_regex = "(^|/)[^/]*test[^/]*$"
exclude_tests_glob = "**/*test*"

[testenv:lint]
description = Run linters and type checks
package = skip
Expand Down Expand Up @@ -108,7 +111,7 @@ commands =
--numprocesses=auto \
--cov=metatrain \
--cov-append \
--cov-report= \
--cov-report=term \
--import-mode=append \
{posargs}

Expand All @@ -132,68 +135,73 @@ commands =
check-manifest {toxinidir}

[testenv:soap-bpnn-tests]
description = Run SOAP-BPNN tests with pytest
description = Run SOAP-BPNN tests with pytest and collect coverage
passenv = *
deps =
pytest
pytest-cov
spherical # tensor target tests
cmake
extras = soap-bpnn
changedir = src/metatrain/soap_bpnn/tests/
commands =
pytest {posargs}

pytest --cov=metatrain.soap_bpnn --cov-append --cov-report=term {posargs}

[testenv:pet-tests]
description = Run PET tests with pytest
description = Run PET tests with pytest and collect coverage
passenv = *
deps =
pytest
pytest-cov
extras = pet
changedir = src/metatrain/pet/tests/
commands =
pytest {posargs}
pytest --cov=metatrain.pet --cov-append --cov-report=term {posargs}

[testenv:gap-tests]
description = Run GAP tests with pytest
description = Run GAP tests with pytest and collect coverage
passenv = *
deps =
pytest
pytest-cov
extras = gap
changedir = src/metatrain/gap/tests/
commands =
pytest {posargs}
pytest --cov=metatrain.gap --cov-append --cov-report=term {posargs}

[testenv:nanopet-tests]
description = Run NanoPET tests with pytest
description = Run NanoPET tests with pytest and collect coverage
passenv = *
deps =
pytest
pytest-cov
spherical # for nanoPET spherical target
extras = nanopet
changedir = src/metatrain/deprecated/nanopet/tests/
commands =
pytest {posargs}
pytest --cov=metatrain.deprecated.nanopet --cov-append --cov-report=term {posargs}

[testenv:llpr-tests]
description = Run LLPR tests with pytest
description = Run LLPR tests with pytest and collect coverage
passenv = *
deps =
pytest
pytest-cov
extras = llpr
changedir = src/metatrain/llpr/tests/
commands =
pytest {posargs}
pytest --cov=metatrain.llpr --cov-append --cov-report=term {posargs}

[testenv:flashmd-tests]
description = Run FlashMD tests with pytest
description = Run FlashMD tests with pytest and collect coverage
passenv = *
deps =
pytest
pytest-cov
extras = flashmd
changedir = src/metatrain/experimental/flashmd/tests/
commands =
pytest {posargs}
pytest --cov=metatrain.experimental.flashmd --cov-append --cov-report=term {posargs}

[testenv:docs]
description = builds the documentation with sphinx
Expand Down
Loading