enzax 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. enzax-0.3.0/.github/pull_request_template.md +7 -0
  2. enzax-0.3.0/.github/workflows/count-lines-of-code.yml +26 -0
  3. enzax-0.3.0/.github/workflows/lighthouserc.json +40 -0
  4. enzax-0.3.0/.github/workflows/release.yml +47 -0
  5. enzax-0.3.0/.github/workflows/run_tests.yml +42 -0
  6. enzax-0.3.0/.github/workflows/test_docs.yml +41 -0
  7. enzax-0.3.0/.gitignore +169 -0
  8. enzax-0.3.0/.pre-commit-config.yaml +15 -0
  9. enzax-0.3.0/.readthedocs.yaml +21 -0
  10. enzax-0.3.0/CODE_OF_CONDUCT.md +79 -0
  11. enzax-0.3.0/CONTRIBUTING.md +37 -0
  12. enzax-0.3.0/LICENSE +201 -0
  13. enzax-0.3.0/PKG-INFO +96 -0
  14. enzax-0.3.0/README.md +70 -0
  15. enzax-0.3.0/conftest.py +20 -0
  16. enzax-0.3.0/docs/accessibility.md +33 -0
  17. enzax-0.3.0/docs/api/binding.md +16 -0
  18. enzax-0.3.0/docs/api/kinetic_model.md +9 -0
  19. enzax-0.3.0/docs/api/mcmc.md +13 -0
  20. enzax-0.3.0/docs/api/parameter_split.md +13 -0
  21. enzax-0.3.0/docs/api/parameters.md +11 -0
  22. enzax-0.3.0/docs/api/rate_equation.md +16 -0
  23. enzax-0.3.0/docs/api/rate_equations.md +9 -0
  24. enzax-0.3.0/docs/api/sbml.md +9 -0
  25. enzax-0.3.0/docs/api/steady_state.md +7 -0
  26. enzax-0.3.0/docs/contributing.md +1 -0
  27. enzax-0.3.0/docs/custom_rate_equations.md +581 -0
  28. enzax-0.3.0/docs/getting_started.md +234 -0
  29. enzax-0.3.0/docs/index.md +11 -0
  30. enzax-0.3.0/docs/statistical_modelling.md +133 -0
  31. enzax-0.3.0/mkdocs.yml +51 -0
  32. enzax-0.3.0/notebooks/sbmlsandbox.ipynb +317 -0
  33. enzax-0.3.0/pyproject.toml +71 -0
  34. enzax-0.3.0/scripts/mcmc_demo.py +148 -0
  35. enzax-0.3.0/scripts/sbml_demo.py +149 -0
  36. enzax-0.3.0/scripts/steady_state_demo.py +46 -0
  37. enzax-0.3.0/src/enzax/__init__.py +22 -0
  38. enzax-0.3.0/src/enzax/array_types.py +176 -0
  39. enzax-0.3.0/src/enzax/binding.py +393 -0
  40. enzax-0.3.0/src/enzax/examples/cho_steady_state.json +116 -0
  41. enzax-0.3.0/src/enzax/examples/cho_steady_state_fluxes.json +94 -0
  42. enzax-0.3.0/src/enzax/examples/conserved_moiety.py +151 -0
  43. enzax-0.3.0/src/enzax/examples/glycolysis.py +468 -0
  44. enzax-0.3.0/src/enzax/examples/linear.py +56 -0
  45. enzax-0.3.0/src/enzax/examples/mammalian_glycolysis.xml +5183 -0
  46. enzax-0.3.0/src/enzax/examples/methionine.py +194 -0
  47. enzax-0.3.0/src/enzax/examples/smallbone.py +155 -0
  48. enzax-0.3.0/src/enzax/examples/smallbone2013_model18_modified.xml +9146 -0
  49. enzax-0.3.0/src/enzax/kinetic_model.py +545 -0
  50. enzax-0.3.0/src/enzax/mcmc.py +76 -0
  51. enzax-0.3.0/src/enzax/parameter_split.py +276 -0
  52. enzax-0.3.0/src/enzax/parameters.py +257 -0
  53. enzax-0.3.0/src/enzax/rate_equation.py +220 -0
  54. enzax-0.3.0/src/enzax/rate_equations/__init__.py +7 -0
  55. enzax-0.3.0/src/enzax/rate_equations/drain.py +66 -0
  56. enzax-0.3.0/src/enzax/rate_equations/saturable.py +763 -0
  57. enzax-0.3.0/src/enzax/sbml.py +188 -0
  58. enzax-0.3.0/src/enzax/statistical_modelling.py +212 -0
  59. enzax-0.3.0/src/enzax/steady_state.py +61 -0
  60. enzax-0.3.0/tests/__init__.py +0 -0
  61. enzax-0.3.0/tests/data/exampleode.xml +710 -0
  62. enzax-0.3.0/tests/data/expected_fluxes.json +54 -0
  63. enzax-0.3.0/tests/data/expected_glycolysis_flux.json +63 -0
  64. enzax-0.3.0/tests/data/expected_methionine_gradient.json +1 -0
  65. enzax-0.3.0/tests/data/sbml_glycolysis_parameters.json +195 -0
  66. enzax-0.3.0/tests/test_binding.py +458 -0
  67. enzax-0.3.0/tests/test_bit_exact.py +53 -0
  68. enzax-0.3.0/tests/test_examples.py +54 -0
  69. enzax-0.3.0/tests/test_glycolysis.py +188 -0
  70. enzax-0.3.0/tests/test_kinetic_model.py +147 -0
  71. enzax-0.3.0/tests/test_lp_grad.py +142 -0
  72. enzax-0.3.0/tests/test_parameter_split.py +168 -0
  73. enzax-0.3.0/tests/test_parameters.py +303 -0
  74. enzax-0.3.0/tests/test_rate_equations.py +162 -0
  75. enzax-0.3.0/tests/test_sbml.py +37 -0
@@ -0,0 +1,7 @@
1
+
2
+ Checklist:
3
+
4
+ - [ ] tests pass
5
+ - [ ] `README.md` up to date
6
+ - [ ] docs up to date
7
+ - [ ] link to any relevant issues
@@ -0,0 +1,26 @@
1
+ name: Count Lines of Code
2
+
3
+ # Controls when the action will run. Triggers the workflow on push or pull request
4
+ # events but only for the main branch
5
+ on:
6
+ push:
7
+ branches: [ main ]
8
+ tags-ignore: '**'
9
+ pull_request:
10
+ branches: [ main ]
11
+
12
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
13
+ jobs:
14
+ # This workflow contains a single job called "build"
15
+ cloc:
16
+ # The type of runner that the job will run on
17
+ runs-on: ubuntu-latest
18
+
19
+ # Steps represent a sequence of tasks that will be executed as part of the job
20
+ steps:
21
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
22
+ - uses: actions/checkout@v3
23
+
24
+ # Runs djdefi/cloc-action
25
+ - name: Count Lines of Code (cloc)
26
+ uses: djdefi/cloc-action@5
@@ -0,0 +1,40 @@
1
+ {
2
+ "ci": {
3
+ "collect": {
4
+ "staticDistDir": "./site/",
5
+ "settings": {
6
+ "skipAudits": [
7
+ "canonical"
8
+ ]
9
+ }
10
+ },
11
+ "assert": {
12
+ "assertions": {
13
+ "categories:performance": [
14
+ "error",
15
+ {
16
+ "minScore": 0.8
17
+ }
18
+ ],
19
+ "categories:accessibility": [
20
+ "error",
21
+ {
22
+ "minScore": 0.8
23
+ }
24
+ ],
25
+ "categories:best-practices": [
26
+ "error",
27
+ {
28
+ "minScore": 0.8
29
+ }
30
+ ],
31
+ "categories:seo": [
32
+ "error",
33
+ {
34
+ "minScore": 0.7
35
+ }
36
+ ]
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,47 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ # Sequence of patterns matched against refs/tags
6
+ tags:
7
+ - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
8
+
9
+ jobs:
10
+ release-build:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v4
18
+ with:
19
+ # Install a specific version of uv.
20
+ version: "0.5.5"
21
+ python-version: 3.13
22
+
23
+ - name: build release distributions
24
+ run: uv build
25
+
26
+ - name: upload windows dists
27
+ uses: actions/upload-artifact@v4
28
+ with:
29
+ name: release-dists
30
+ path: dist/
31
+
32
+ pypi-publish:
33
+ runs-on: ubuntu-latest
34
+ needs:
35
+ - release-build
36
+ permissions:
37
+ id-token: write
38
+
39
+ steps:
40
+ - name: Retrieve release distributions
41
+ uses: actions/download-artifact@v4
42
+ with:
43
+ name: release-dists
44
+ path: dist/
45
+
46
+ - name: Publish release distributions to PyPI
47
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,42 @@
1
+ name: Run tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '**'
7
+ tags-ignore:
8
+ - '**'
9
+
10
+ jobs:
11
+ build:
12
+
13
+ runs-on: ${{ matrix.os }}
14
+
15
+ strategy:
16
+ matrix:
17
+ os: [ubuntu-latest, windows-latest]
18
+ python-version: [3.13]
19
+
20
+ steps:
21
+
22
+ - name: checkout code
23
+ uses: actions/checkout@v2
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v4
27
+ with:
28
+ # Install a specific version of uv.
29
+ version: "0.5.5"
30
+ python-version: ${{ matrix.python-version }}
31
+
32
+ - name: Install the project
33
+ run: uv sync --all-extras --dev
34
+
35
+ - name: pre-commit checks
36
+ uses: pre-commit/action@v3.0.1
37
+
38
+ - name: Run tests
39
+ run: uv run pytest tests
40
+
41
+ - name: Upload coverage reports to Codecov
42
+ uses: codecov/codecov-action@v3
@@ -0,0 +1,41 @@
1
+ # This workflow tests whether the documentation builds correctly and runs a
2
+ # lighthouse audit.
3
+
4
+ name: Docs check
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - '**'
10
+ tags-ignore:
11
+ - '**'
12
+
13
+ jobs:
14
+ docs:
15
+
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v4
24
+ with:
25
+ # Install a specific version of uv.
26
+ version: "0.5.5"
27
+ python-version: ${{ matrix.python-version }}
28
+
29
+ - name: Install the project
30
+ run: uv sync --all-extras --dev
31
+
32
+ - name: build docs with mkdocs
33
+ run: uv run mkdocs build
34
+
35
+ - name: Audit with Lighthouse
36
+ uses: treosh/lighthouse-ci-action@v12
37
+ with:
38
+ configPath: ".github/workflows/lighthouserc.json"
39
+ temporaryPublicStorage: true
40
+ uploadArtifacts: true
41
+ runs: 3 # Multiple runs to reduce variance
enzax-0.3.0/.gitignore ADDED
@@ -0,0 +1,169 @@
1
+ uv.lock
2
+ .aider*
3
+ .DS_Store
4
+
5
+ # scratchpads
6
+ scratch.md
7
+
8
+ # Byte-compiled / optimized / DLL files
9
+ __pycache__/
10
+ *.py[cod]
11
+ *$py.class
12
+
13
+ # C extensions
14
+ *.so
15
+
16
+ # Distribution / packaging
17
+ .Python
18
+ build/
19
+ develop-eggs/
20
+ dist/
21
+ downloads/
22
+ eggs/
23
+ .eggs/
24
+ lib/
25
+ lib64/
26
+ parts/
27
+ sdist/
28
+ var/
29
+ wheels/
30
+ share/python-wheels/
31
+ *.egg-info/
32
+ .installed.cfg
33
+ *.egg
34
+ MANIFEST
35
+
36
+ # PyInstaller
37
+ # Usually these files are written by a python script from a template
38
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
39
+ *.manifest
40
+ *.spec
41
+
42
+ # Installer logs
43
+ pip-log.txt
44
+ pip-delete-this-directory.txt
45
+
46
+ # Unit test / coverage reports
47
+ htmlcov/
48
+ .tox/
49
+ .nox/
50
+ .coverage
51
+ .coverage.*
52
+ .cache
53
+ nosetests.xml
54
+ coverage.xml
55
+ *.cover
56
+ *.py,cover
57
+ .hypothesis/
58
+ .pytest_cache/
59
+ cover/
60
+
61
+ # Translations
62
+ *.mo
63
+ *.pot
64
+
65
+ # Django stuff:
66
+ *.log
67
+ local_settings.py
68
+ db.sqlite3
69
+ db.sqlite3-journal
70
+
71
+ # Flask stuff:
72
+ instance/
73
+ .webassets-cache
74
+
75
+ # Scrapy stuff:
76
+ .scrapy
77
+
78
+ # Sphinx documentation
79
+ docs/_build/
80
+
81
+ # PyBuilder
82
+ .pybuilder/
83
+ target/
84
+
85
+ # Jupyter Notebook
86
+ .ipynb_checkpoints
87
+
88
+ # IPython
89
+ profile_default/
90
+ ipython_config.py
91
+
92
+ # pyenv
93
+ # For a library or package, you might want to ignore these files since the code is
94
+ # intended to run in multiple environments; otherwise, check them in:
95
+ # .python-version
96
+
97
+ # pipenv
98
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
100
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
101
+ # install all needed dependencies.
102
+ #Pipfile.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ #poetry.lock
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ #pdm.lock
114
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
115
+ # in version control.
116
+ # https://pdm-project.org/#use-with-ide
117
+ .pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122
+ __pypackages__/
123
+
124
+ # Celery stuff
125
+ celerybeat-schedule
126
+ celerybeat.pid
127
+
128
+ # SageMath parsed files
129
+ *.sage.py
130
+
131
+ # Environments
132
+ .env
133
+ .venv
134
+ env/
135
+ venv/
136
+ ENV/
137
+ env.bak/
138
+ venv.bak/
139
+
140
+ # Spyder project settings
141
+ .spyderproject
142
+ .spyproject
143
+
144
+ # Rope project settings
145
+ .ropeproject
146
+
147
+ # mkdocs documentation
148
+ /site
149
+
150
+ # mypy
151
+ .mypy_cache/
152
+ .dmypy.json
153
+ dmypy.json
154
+
155
+ # Pyre type checker
156
+ .pyre/
157
+
158
+ # pytype static type analyzer
159
+ .pytype/
160
+
161
+ # Cython debug symbols
162
+ cython_debug/
163
+
164
+ # PyCharm
165
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
166
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
167
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
168
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
169
+ #.idea/
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: check-yaml
6
+ - id: end-of-file-fixer
7
+ - id: trailing-whitespace
8
+ - repo: https://github.com/astral-sh/ruff-pre-commit
9
+ # Ruff version.
10
+ rev: v0.6.0
11
+ hooks:
12
+ # Run the linter.
13
+ - id: ruff
14
+ # Run the formatter.
15
+ - id: ruff-format
@@ -0,0 +1,21 @@
1
+ # Read the Docs configuration file for MkDocs projects
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+ # Required
4
+
5
+ version: 2
6
+
7
+ # Set the version of Python and other tools you might need
8
+ build:
9
+ os: ubuntu-22.04
10
+ tools:
11
+ python: "3.12"
12
+
13
+ mkdocs:
14
+ configuration: mkdocs.yml
15
+
16
+ python:
17
+ install:
18
+ - method: "pip"
19
+ path: .
20
+ extra_requirements:
21
+ - docs
@@ -0,0 +1,79 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behaviour that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behaviour include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behaviour and will take appropriate and fair corrective action in response to any behaviour that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported to the community leaders responsible for enforcement at tedgro@biosustain.dtu.dk. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behaviour deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behaviour was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behaviour. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behaviour.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behaviour, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
74
+
75
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
76
+
77
+ [homepage]: https://www.contributor-covenant.org
78
+
79
+ For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
@@ -0,0 +1,37 @@
1
+ # How to contribute to enzax
2
+
3
+ All contributions are very welcome!
4
+
5
+ Make sure to read the [code of conduct](https://github.com/dtu-qmcm/CODE_OF_CONDUCT.md) and follow its recommendations.
6
+
7
+ If you have a specific suggestion for how enzax could be improved, or if you find a bug then please file an issue or submit a pull request.
8
+
9
+ Alternatively, if you have any more general thoughts or questions, please post them in the [discussions page](https://github.com/dtu-qmcmc/enzax/discussions).
10
+
11
+ If you would like to contribute code changes, just follow the normal [GitHub workflow](https://docs.github.com/en/get-started/quickstart/github-flow): make a local branch with the changes then create a pull request.
12
+
13
+ ## Developing enzax locally
14
+
15
+ To develop enzax locally you will probably need to install it with development dependencies. Here is how to do so:
16
+
17
+ ```sh
18
+ $ pip install enzax'[dev]'
19
+ ```
20
+
21
+ You can see what these dependencies are by checking the `[dependencies]` table in enzax's [`pyproject.toml` file](https://github.com/dtu-qmcm/enzax/blob/main/pyproject.toml).
22
+
23
+ ## Releasing new versions of enzax
24
+
25
+ To release a new version of enzax, edit the field `version` in `pyproject.toml`, e.g. to `0.2.1` then make a pull request with this change.
26
+
27
+ Once the changes are merged into the `origin/main` branch, add a tag whose name begins with `v`, followed by the new version number to your local `main` branch, for example like this:
28
+
29
+ ```sh
30
+ $ git tag v0.2.1
31
+ ```
32
+
33
+ Now push the new tag to GitHub:
34
+
35
+ ```sh
36
+ $ git push origin "v0.2.1"
37
+ ```