-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: adapt implementation to QRules v0.10 (#362)
* DX: run AmpForm tests with QRules v0.9.x * ENH: adapt implementation to QRules v0.10 * ENH: remove QRules version restriction * FEAT: add `get_qrules_version()` function * MAINT: update links to QRules v0.10.x API * MAINT: upgrade constraints to QRules v0.10.1
- Loading branch information
Showing
23 changed files
with
215 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Test with QRules v0.9 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PYTHONHASHSEED: "0" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- epic/* | ||
- "[0-9]+.[0-9]+.x" | ||
pull_request: | ||
branches: | ||
- main | ||
- epic/* | ||
- "[0-9]+.[0-9]+.x" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
pytest: | ||
name: Run unit tests | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ComPWA/actions/pip-install@v1 | ||
with: | ||
additional-packages: tox | ||
editable: "yes" | ||
extras: test | ||
python-version: "3.9" | ||
specific-packages: qrules==0.9.* | ||
- run: pytest -n auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
from functools import lru_cache | ||
|
||
if sys.version_info < (3, 8): | ||
from importlib_metadata import version | ||
else: | ||
from importlib.metadata import version | ||
|
||
|
||
@lru_cache(maxsize=1) | ||
def get_qrules_version() -> tuple[int, ...]: | ||
"""Get the version of qrules as a tuple of integers. | ||
>>> get_qrules_version() >= (0, 10) | ||
True | ||
>>> import pytest | ||
>>> from ampform._qrules import get_qrules_version | ||
>>> if get_qrules_version() < (0, 10): | ||
... pytest.skip("Doctest only works for qrules>=0.10") | ||
""" | ||
v = version("qrules") | ||
return tuple(int(i) for i in v.split(".") if i.strip().isdigit()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.