Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ updates:
directory: /
schedule:
interval: monthly
cooldown:
default-days: 7
groups:
actions:
patterns: ["*"]
48 changes: 32 additions & 16 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'release' }}

permissions:
contents: read

jobs:
wheels:
name: wheels ${{ matrix.os }}
Expand All @@ -40,19 +43,23 @@ jobs:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- uses: pypa/cibuildwheel@v4.3.5
- uses: actions/upload-artifact@v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pypa/cibuildwheel@f9b966cfadf4109556cadc5bb39ddb72d0ce664e # v4.3.5
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: pipx run build --sdist
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: sdist
path: dist/*.tar.gz
Expand All @@ -68,7 +75,8 @@ jobs:
fail-fast: false
matrix:
image: ["fedora:latest", "debian:stable"]
container: ${{ matrix.image }}
# the current release of each distribution, on purpose
container: ${{ matrix.image }} # zizmor: ignore[unpinned-images]
steps:
- name: Install Python and build tools
run: |
Expand All @@ -78,15 +86,19 @@ jobs:
apt-get update && apt-get install -y --no-install-recommends \
python3 python3-venv ca-certificates
fi
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: wheels-ubuntu-latest
path: wheelhouse
- name: Install the wheel
run: |
python3 -m venv /opt/venv
/opt/venv/bin/pip install --upgrade pip pytest pytest-xdist
/opt/venv/bin/pip install --upgrade pip pytest pytest-xdist pytest-timeout
# the wheel of this run, never a release of the same version on PyPI
/opt/venv/bin/pip install --no-index --no-deps --only-binary=:all: --find-links wheelhouse symident
/opt/venv/bin/pip install --only-binary=:all: --find-links wheelhouse symident
- name: Build msolve
if: startsWith(matrix.image, 'fedora')
Expand All @@ -101,23 +113,27 @@ jobs:
steps:
- name: Install build tools
run: dnf install -y --setopt=install_weak_deps=False gcc make m4 diffutils curl xz tar
- uses: actions/checkout@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build msolve
run: SYMIDENT_LIBS_CACHE=/tmp/msolve SYMIDENT_JOBS=4 sh src/symident/tools/build-msolve.sh

# a source install on Fedora's own Python and compilers, as dMod2's CI installs it
fedora:
name: fedora
runs-on: ubuntu-latest
container: fedora:latest
container: fedora:latest # zizmor: ignore[unpinned-images]
steps:
- name: Install Python and the compilers
run: dnf install -y --setopt=install_weak_deps=False python3 python3-devel python3-pip gcc-c++ cmake
- uses: actions/checkout@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install from source
run: |
python3 -m venv /opt/venv
/opt/venv/bin/pip install --upgrade pip pytest pytest-xdist
/opt/venv/bin/pip install --upgrade pip pytest pytest-xdist pytest-timeout
/opt/venv/bin/pip install .
- name: Tests
run: cd /tmp && /opt/venv/bin/python -m pytest -q -n auto "$GITHUB_WORKSPACE/tests"
Expand All @@ -131,13 +147,13 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: wheels-*
path: dist
merge-multiple: true
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: pipx run pre-commit run --all-files --show-diff-on-failure

tests:
Expand All @@ -28,8 +33,10 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.10", "3.15"]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,22 @@ concurrency:
# a deployment to Pages runs to the end
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
- run: pip install ".[docs]"
- run: sphinx-build -W -b html docs docs/_build/html
- uses: actions/upload-pages-artifact@v3
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: docs/_build/html

Expand All @@ -51,4 +56,4 @@ jobs:
url: ${{ steps.deploy.outputs.page_url }}
steps:
- id: deploy
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ build.ninja
.ruff_cache/
docs/_build/
docs/generated/
.mypy_cache/
.nox/
dist/
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# `pre-commit install` runs these on every commit; CI runs them on all files.
exclude: ^tests/data/

ci:
autoupdate_commit_msg: "chore(pre-commit): update hooks"
autofix_commit_msg: "style: pre-commit fixes"
autoupdate_schedule: monthly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
Expand All @@ -18,6 +23,45 @@ repos:
rev: v0.17.6
hooks:
- id: ruff-check
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.4.1
hooks:
- id: mypy
files: ^src/
args: []

- repo: https://github.com/codespell-project/codespell
rev: v2.4.3
hooks:
- id: codespell
additional_dependencies: ["tomli; python_version<'3.11'"]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-log-warn
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

# NEWS.md keeps the bullets and wrapping of the release notes
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
args: [--wrap=keep, --compact-tables]
additional_dependencies: [mdformat-gfm]
exclude: ^NEWS\.md$

- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.33.1
hooks:
- id: zizmor

- repo: local
hooks:
Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,17 @@ the output:
```python
import symident as si

m = si.Model({"x1": "-(k21 + k01)*x1 + k12*x2 + u", "x2": "k21*x1 - k12*x2"},
{"y": "x2"}, known_inputs=["u"])
m = si.Model({"x1": "-(k21 + k01)*x1 + k12*x2 + u", "x2": "k21*x1 - k12*x2"}, {"y": "x2"}, known_inputs=["u"])
res = si.detect(m, mode="global")
print(res)
#> Result: structurally locally identifiable (rank 5 / 5)
#>
#> Global: values with the output of a generic one, counted at random points
#> 2 over the algebraic closure, 1 or 2 in the domain (order 5, stable)
#> exactly 2 values at a generic point, proven
#> sigma1 (exact): k01 -> k12, x1 -> (k01*x2 - k12*x2 + k21*x1)/k21, k12 ->
#> k01; in the domain where (k01*x2 - k12*x2 + k21*x1)/k21 > 0
#> fundamental domain: k01 < k12
# > Result: structurally locally identifiable (rank 5 / 5)
# >
# > Global: values with the output of a generic one, counted at random points
# > 2 over the algebraic closure, 1 or 2 in the domain (order 5, stable)
# > exactly 2 values at a generic point, proven
# > sigma1 (exact): k01 -> k12, x1 -> (k01*x2 - k12*x2 + k21*x1)/k21, k12 ->
# > k01; in the domain where (k01*x2 - k12*x2 + k21*x1)/k21 > 0
# > fundamental domain: k01 < k12
```

A model with non-identifiable directions prints them as generators, and `res.reduce()` returns
Expand All @@ -73,8 +72,8 @@ the reparametrization to identifiable parameters; the

## Interface

| | |
|---|---|
| | |
| -- | -- |
| `Model(odes, observables, ...)` | ODEs or a reaction network with observables, conditions, events, inputs and switches |
| `detect(model, ...)` | rank, identifiability and the non-identifiable directions (`Symmetries` of `Symmetry`) |
| `detect(model, mode="global", global_options=...)` | also the count of the values with the same output and the discrete symmetries |
Expand Down
63 changes: 50 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ def _chapters(doc):


# the header lists the pages of the root toctree; the guide and the method also open a menu of their chapters
html_context = {"symident_nav": [(d, _title(d), _chapters(d) if d in ("guide", "method") else [])
for d in ("install", "quickstart", "guide", "method", "api")]
+ [("changelog", "Changelog", [])]}
html_context = {
"symident_nav": [
(d, _title(d), _chapters(d) if d in ("guide", "method") else [])
for d in ("install", "quickstart", "guide", "method", "api")
]
+ [("changelog", "Changelog", [])]
}

# citations: numbered in the order cited, in the reference format of IEEE, as on the dMod2 and cppDE sites

Expand Down Expand Up @@ -107,22 +111,55 @@ def _doi(self):

def get_article_template(self, e):
return join[
_authors(), ", ", self._title(), tag("em")[field("journal")],
optional[", vol. ", field("volume")], optional[", no. ", field("number")],
optional[", pp. ", _pages()], optional[", Art. no. ", field("eid")], ", ", field("year"),
self._doi(), "."]
_authors(),
", ",
self._title(),
tag("em")[field("journal")],
optional[", vol. ", field("volume")],
optional[", no. ", field("number")],
optional[", pp. ", _pages()],
optional[", Art. no. ", field("eid")],
", ",
field("year"),
self._doi(),
".",
]

def get_inproceedings_template(self, e):
return join[
_authors(), ", ", self._title(), "in ", tag("em")[field("booktitle")], self._series(),
", ", field("address"), ": ", field("publisher"), ", ", field("year"),
optional[", pp. ", _pages()], self._doi(), "."]
_authors(),
", ",
self._title(),
"in ",
tag("em")[field("booktitle")],
self._series(),
", ",
field("address"),
": ",
field("publisher"),
", ",
field("year"),
optional[", pp. ", _pages()],
self._doi(),
".",
]

def get_book_template(self, e):
return join[
_authors(), ", ", tag("em")[field("title")], optional[", ", field("edition"), " ed."],
self._series(), ". ", field("address"), ": ", field("publisher"), ", ", field("year"),
self._doi(), "."]
_authors(),
", ",
tag("em")[field("title")],
optional[", ", field("edition"), " ed."],
self._series(),
". ",
field("address"),
": ",
field("publisher"),
", ",
field("year"),
self._doi(),
".",
]


register_plugin("pybtex.style.formatting", "ieee", _IEEE)
Expand Down
Loading
Loading