sbmlmath 0.0.3__tar.gz → 0.2.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.
- sbmlmath-0.2.0/.github/dependabot.yml +10 -0
- sbmlmath-0.2.0/.github/workflows/ci.yaml +143 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/.github/workflows/deploy_release.yaml +2 -2
- sbmlmath-0.2.0/.pre-commit-config.yaml +26 -0
- sbmlmath-0.2.0/.readthedocs.yml +26 -0
- sbmlmath-0.2.0/PKG-INFO +74 -0
- sbmlmath-0.2.0/README.md +52 -0
- sbmlmath-0.2.0/doc/.gitignore +3 -0
- sbmlmath-0.2.0/doc/Makefile +20 -0
- sbmlmath-0.2.0/doc/about.rst +63 -0
- sbmlmath-0.2.0/doc/api.rst +10 -0
- sbmlmath-0.2.0/doc/conf.py +83 -0
- sbmlmath-0.2.0/doc/index.rst +9 -0
- sbmlmath-0.2.0/doc/make.bat +35 -0
- sbmlmath-0.2.0/doc/rtd_requirements.txt +2 -0
- sbmlmath-0.2.0/pyproject.toml +52 -0
- sbmlmath-0.2.0/sbmlmath/__init__.py +108 -0
- sbmlmath-0.2.0/sbmlmath/cfunction.py +145 -0
- sbmlmath-0.2.0/sbmlmath/csymbol.py +122 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/sbmlmath/mathml_parser.py +103 -24
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/sbmlmath/mathml_printer.py +24 -5
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/sbmlmath/species_symbol.py +27 -11
- sbmlmath-0.2.0/sbmlmath.egg-info/PKG-INFO +74 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/sbmlmath.egg-info/SOURCES.txt +10 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/sbmlmath.egg-info/requires.txt +1 -1
- sbmlmath-0.2.0/tests/test_csymbol.py +59 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/tests/test_mathml_parser_sbml_semantic_suite.py +4 -1
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/tests/test_misc.py +24 -3
- sbmlmath-0.2.0/tests/test_parser.py +57 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/tests/test_printer.py +1 -1
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/tests/test_species_symbol.py +3 -1
- sbmlmath-0.0.3/.github/workflows/ci.yaml +0 -53
- sbmlmath-0.0.3/.pre-commit-config.yaml +0 -19
- sbmlmath-0.0.3/PKG-INFO +0 -44
- sbmlmath-0.0.3/README.md +0 -33
- sbmlmath-0.0.3/pyproject.toml +0 -26
- sbmlmath-0.0.3/sbmlmath/__init__.py +0 -47
- sbmlmath-0.0.3/sbmlmath/cfunction.py +0 -52
- sbmlmath-0.0.3/sbmlmath/csymbol.py +0 -78
- sbmlmath-0.0.3/sbmlmath.egg-info/PKG-INFO +0 -44
- sbmlmath-0.0.3/tests/test_csymbol.py +0 -13
- sbmlmath-0.0.3/tests/test_parser.py +0 -29
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/.gitignore +0 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/LICENSE +0 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/sbmlmath.egg-info/dependency_links.txt +0 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/sbmlmath.egg-info/top_level.txt +0 -0
- {sbmlmath-0.0.3 → sbmlmath-0.2.0}/setup.cfg +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: '48 4 * * *'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test-ubuntu:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.9", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Check out repository
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Cache pip
|
|
27
|
+
uses: actions/cache@v4
|
|
28
|
+
with:
|
|
29
|
+
path: ~/.cache/pip
|
|
30
|
+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
|
|
31
|
+
restore-keys: |
|
|
32
|
+
${{ runner.os }}-${{ matrix.python-version }}-
|
|
33
|
+
|
|
34
|
+
- name: Cache / restore SBML test suite
|
|
35
|
+
id: cache-sbml-test-suite
|
|
36
|
+
uses: actions/cache@v4
|
|
37
|
+
with:
|
|
38
|
+
path: sbml-test-suite
|
|
39
|
+
key: ${{ runner.os }}-sbml-test-suite
|
|
40
|
+
|
|
41
|
+
- name: Download SBML test suite
|
|
42
|
+
if: steps.cache-sbml-test-suite.outputs.cache-hit != 'true'
|
|
43
|
+
run: git clone --depth=1 https://github.com/sbmlteam/sbml-test-suite/
|
|
44
|
+
|
|
45
|
+
- name: Install local packages
|
|
46
|
+
run: |
|
|
47
|
+
pip install --upgrade pip setuptools && pip install .[test]
|
|
48
|
+
|
|
49
|
+
- name: Unit tests
|
|
50
|
+
env:
|
|
51
|
+
SBML_TEST_SUITE_ROOT: "${{ github.workspace }}/sbml-test-suite/"
|
|
52
|
+
run: pytest -vv
|
|
53
|
+
|
|
54
|
+
- name: Run pre-commit hooks
|
|
55
|
+
run: pre-commit run --all-files
|
|
56
|
+
|
|
57
|
+
test-macos:
|
|
58
|
+
runs-on: macos-latest
|
|
59
|
+
|
|
60
|
+
strategy:
|
|
61
|
+
matrix:
|
|
62
|
+
python-version: ["3.9", "3.12"]
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
- name: Check out repository
|
|
66
|
+
uses: actions/checkout@v4
|
|
67
|
+
|
|
68
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
69
|
+
uses: actions/setup-python@v5
|
|
70
|
+
with:
|
|
71
|
+
python-version: ${{ matrix.python-version }}
|
|
72
|
+
|
|
73
|
+
- name: Cache pip
|
|
74
|
+
uses: actions/cache@v4
|
|
75
|
+
with:
|
|
76
|
+
path: ~/.cache/pip
|
|
77
|
+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
|
|
78
|
+
restore-keys: |
|
|
79
|
+
${{ runner.os }}-${{ matrix.python-version }}-
|
|
80
|
+
|
|
81
|
+
- name: Cache / restore SBML test suite
|
|
82
|
+
id: cache-sbml-test-suite
|
|
83
|
+
uses: actions/cache@v4
|
|
84
|
+
with:
|
|
85
|
+
path: sbml-test-suite
|
|
86
|
+
key: ${{ runner.os }}-sbml-test-suite
|
|
87
|
+
|
|
88
|
+
- name: Download SBML test suite
|
|
89
|
+
if: steps.cache-sbml-test-suite.outputs.cache-hit != 'true'
|
|
90
|
+
run: git clone --depth=1 https://github.com/sbmlteam/sbml-test-suite/
|
|
91
|
+
|
|
92
|
+
- name: Install local packages
|
|
93
|
+
run: |
|
|
94
|
+
pip install --upgrade pip setuptools && pip install .[test]
|
|
95
|
+
|
|
96
|
+
- name: Unit tests
|
|
97
|
+
env:
|
|
98
|
+
SBML_TEST_SUITE_ROOT: "${{ github.workspace }}/sbml-test-suite/"
|
|
99
|
+
run: pytest -vv
|
|
100
|
+
|
|
101
|
+
test-windows:
|
|
102
|
+
runs-on: windows-latest
|
|
103
|
+
|
|
104
|
+
strategy:
|
|
105
|
+
matrix:
|
|
106
|
+
python-version: ["3.9", "3.12"]
|
|
107
|
+
|
|
108
|
+
steps:
|
|
109
|
+
- name: Check out repository
|
|
110
|
+
uses: actions/checkout@v4
|
|
111
|
+
|
|
112
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
113
|
+
uses: actions/setup-python@v5
|
|
114
|
+
with:
|
|
115
|
+
python-version: ${{ matrix.python-version }}
|
|
116
|
+
|
|
117
|
+
- name: Cache pip
|
|
118
|
+
uses: actions/cache@v4
|
|
119
|
+
with:
|
|
120
|
+
path: ~/.cache/pip
|
|
121
|
+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
|
|
122
|
+
restore-keys: |
|
|
123
|
+
${{ runner.os }}-${{ matrix.python-version }}-
|
|
124
|
+
|
|
125
|
+
- name: Cache / restore SBML test suite
|
|
126
|
+
id: cache-sbml-test-suite
|
|
127
|
+
uses: actions/cache@v4
|
|
128
|
+
with:
|
|
129
|
+
path: sbml-test-suite
|
|
130
|
+
key: ${{ runner.os }}-sbml-test-suite
|
|
131
|
+
|
|
132
|
+
- name: Download SBML test suite
|
|
133
|
+
if: steps.cache-sbml-test-suite.outputs.cache-hit != 'true'
|
|
134
|
+
run: git clone --depth=1 https://github.com/sbmlteam/sbml-test-suite/
|
|
135
|
+
|
|
136
|
+
- name: Install local packages
|
|
137
|
+
run: |
|
|
138
|
+
pip install --upgrade pip setuptools && pip install .[test]
|
|
139
|
+
|
|
140
|
+
- name: Unit tests
|
|
141
|
+
env:
|
|
142
|
+
SBML_TEST_SUITE_ROOT: "${{ github.workspace }}/sbml-test-suite/"
|
|
143
|
+
run: pytest -vv
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# See https://pre-commit.com for more information
|
|
2
|
+
# See https://pre-commit.com/hooks.html for more hooks
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v5.0.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
- id: end-of-file-fixer
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-added-large-files
|
|
11
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
12
|
+
# Ruff version.
|
|
13
|
+
rev: v0.6.9
|
|
14
|
+
hooks:
|
|
15
|
+
# Run the linter.
|
|
16
|
+
- id: ruff
|
|
17
|
+
args:
|
|
18
|
+
- --fix
|
|
19
|
+
- --config
|
|
20
|
+
- pyproject.toml
|
|
21
|
+
|
|
22
|
+
# Run the formatter.
|
|
23
|
+
- id: ruff-format
|
|
24
|
+
args:
|
|
25
|
+
- --config
|
|
26
|
+
- pyproject.toml
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# .readthedocs.yml
|
|
2
|
+
# Read the Docs configuration file
|
|
3
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
4
|
+
|
|
5
|
+
# Required
|
|
6
|
+
version: 2
|
|
7
|
+
|
|
8
|
+
# Build documentation in the docs/ directory with Sphinx
|
|
9
|
+
sphinx:
|
|
10
|
+
builder: html
|
|
11
|
+
configuration: doc/conf.py
|
|
12
|
+
fail_on_warning: False
|
|
13
|
+
|
|
14
|
+
formats:
|
|
15
|
+
- pdf
|
|
16
|
+
|
|
17
|
+
python:
|
|
18
|
+
install:
|
|
19
|
+
- requirements: doc/rtd_requirements.txt
|
|
20
|
+
- method: pip
|
|
21
|
+
path: .
|
|
22
|
+
|
|
23
|
+
build:
|
|
24
|
+
os: "ubuntu-24.04"
|
|
25
|
+
tools:
|
|
26
|
+
python: "3.12"
|
sbmlmath-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sbmlmath
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: SBML Math <-> SymPy
|
|
5
|
+
Author-email: Daniel Weindl <sci@danielweindl.de>
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/dweindl/sbmlmath
|
|
8
|
+
Project-URL: Documentation, https://sbmlmath.readthedocs.io/
|
|
9
|
+
Project-URL: Repository, https://github.com/dweindl/sbmlmath.git
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/dweindl/sbmlmath/issues
|
|
11
|
+
Project-URL: PyPI, https://pypi.org/project/sbmlmath/
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: python-libsbml>=5.20.4
|
|
16
|
+
Requires-Dist: sympy
|
|
17
|
+
Requires-Dist: pint
|
|
18
|
+
Requires-Dist: lxml>=4.6.4
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
21
|
+
Requires-Dist: pre-commit>=3; extra == "test"
|
|
22
|
+
|
|
23
|
+
# sbmlmath — a Python library for handling SBML MathML
|
|
24
|
+
|
|
25
|
+
This is a Python library for interconverting [SymPy](https://github.com/sympy/sympy/)
|
|
26
|
+
expressions and [SBML](https://sbml.org/)-MathML.
|
|
27
|
+
SBML uses a subset of [MathML](https://www.w3.org/Math/) that this library
|
|
28
|
+
aims to support. This is not (intended to be) a general MathML parser.
|
|
29
|
+
|
|
30
|
+
Main functionality:
|
|
31
|
+
|
|
32
|
+
* sympy -> SBML MathML
|
|
33
|
+
* SBML MathML -> sympy
|
|
34
|
+
* in particular for cases where `sympy.sympify(libsbml.formulaToL3String(...))`
|
|
35
|
+
won't do the job
|
|
36
|
+
(mind the differences operator precedence between
|
|
37
|
+
sympy/[Python](https://docs.python.org/3/reference/expressions.html#operator-precedence)
|
|
38
|
+
and [libsbml L3 formulas](https://synonym.caltech.edu/software/libsbml/5.18.0/docs/formatted/python-api/libsbml-math.html#math-l3)!)
|
|
39
|
+
* retaining unit annotations and other `<ci>` attributes
|
|
40
|
+
|
|
41
|
+
**NOTE: This is under development and the API is to be considered unstable**
|
|
42
|
+
|
|
43
|
+
Python support policy: sbmlmath follows [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html).
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from sbmlmath import SBMLMathMLPrinter, SBMLMathMLParser
|
|
49
|
+
import sympy as sp
|
|
50
|
+
|
|
51
|
+
sympy_expr = sp.sympify("A ** B + exp(C) * D")
|
|
52
|
+
mathml = SBMLMathMLPrinter().doprint(sympy_expr)
|
|
53
|
+
print(mathml)
|
|
54
|
+
|
|
55
|
+
cycled_sympy = SBMLMathMLParser().parse_str(mathml)
|
|
56
|
+
print(cycled_sympy)
|
|
57
|
+
assert sympy_expr == cycled_sympy
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
Under construction at [sbmlmath.readthedocs.io](https://sbmlmath.readthedocs.io/).
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
Releases from [PyPI](https://pypi.org/project/sbmlmath/):
|
|
67
|
+
```bash
|
|
68
|
+
pip install sbmlmath
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The latest development version from GitHub:
|
|
72
|
+
```bash
|
|
73
|
+
pip install https://github.com/dweindl/sbmlmath/archive/main.zip
|
|
74
|
+
```
|
sbmlmath-0.2.0/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# sbmlmath — a Python library for handling SBML MathML
|
|
2
|
+
|
|
3
|
+
This is a Python library for interconverting [SymPy](https://github.com/sympy/sympy/)
|
|
4
|
+
expressions and [SBML](https://sbml.org/)-MathML.
|
|
5
|
+
SBML uses a subset of [MathML](https://www.w3.org/Math/) that this library
|
|
6
|
+
aims to support. This is not (intended to be) a general MathML parser.
|
|
7
|
+
|
|
8
|
+
Main functionality:
|
|
9
|
+
|
|
10
|
+
* sympy -> SBML MathML
|
|
11
|
+
* SBML MathML -> sympy
|
|
12
|
+
* in particular for cases where `sympy.sympify(libsbml.formulaToL3String(...))`
|
|
13
|
+
won't do the job
|
|
14
|
+
(mind the differences operator precedence between
|
|
15
|
+
sympy/[Python](https://docs.python.org/3/reference/expressions.html#operator-precedence)
|
|
16
|
+
and [libsbml L3 formulas](https://synonym.caltech.edu/software/libsbml/5.18.0/docs/formatted/python-api/libsbml-math.html#math-l3)!)
|
|
17
|
+
* retaining unit annotations and other `<ci>` attributes
|
|
18
|
+
|
|
19
|
+
**NOTE: This is under development and the API is to be considered unstable**
|
|
20
|
+
|
|
21
|
+
Python support policy: sbmlmath follows [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html).
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from sbmlmath import SBMLMathMLPrinter, SBMLMathMLParser
|
|
27
|
+
import sympy as sp
|
|
28
|
+
|
|
29
|
+
sympy_expr = sp.sympify("A ** B + exp(C) * D")
|
|
30
|
+
mathml = SBMLMathMLPrinter().doprint(sympy_expr)
|
|
31
|
+
print(mathml)
|
|
32
|
+
|
|
33
|
+
cycled_sympy = SBMLMathMLParser().parse_str(mathml)
|
|
34
|
+
print(cycled_sympy)
|
|
35
|
+
assert sympy_expr == cycled_sympy
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
Under construction at [sbmlmath.readthedocs.io](https://sbmlmath.readthedocs.io/).
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Releases from [PyPI](https://pypi.org/project/sbmlmath/):
|
|
45
|
+
```bash
|
|
46
|
+
pip install sbmlmath
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The latest development version from GitHub:
|
|
50
|
+
```bash
|
|
51
|
+
pip install https://github.com/dweindl/sbmlmath/archive/main.zip
|
|
52
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
sbmlmath — a Python library for handling SBML MathML
|
|
2
|
+
====================================================
|
|
3
|
+
|
|
4
|
+
This is a Python library for interconverting `SymPy <https://github.com/sympy/sympy/>`_
|
|
5
|
+
expressions and `SBML <https://sbml.org/>`_-MathML.
|
|
6
|
+
SBML uses a subset of `MathML <https://www.w3.org/Math/>`_ that this library
|
|
7
|
+
aims to support. This is not (intended to be) a general MathML parser.
|
|
8
|
+
|
|
9
|
+
Main functionality:
|
|
10
|
+
|
|
11
|
+
* sympy -> SBML MathML
|
|
12
|
+
|
|
13
|
+
* SBML MathML -> sympy
|
|
14
|
+
|
|
15
|
+
* in particular for cases where ``sympy.sympify(libsbml.formulaToL3String(...))``
|
|
16
|
+
won't do the job
|
|
17
|
+
(mind the differences operator precedence between
|
|
18
|
+
sympy/`Python <https://docs.python.org/3/reference/expressions.html#operator-precedence>`_
|
|
19
|
+
and `libsbml L3 formulas <https://synonym.caltech.edu/software/libsbml/5.18.0/docs/formatted/python-api/libsbml-math.html#math-l3>`_!)
|
|
20
|
+
|
|
21
|
+
* retaining unit annotations and other ``<ci>`` attributes
|
|
22
|
+
|
|
23
|
+
**NOTE: This is under development and the API is to be considered unstable**
|
|
24
|
+
|
|
25
|
+
Python support policy: sbmlmath follows `NEP 29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_.
|
|
26
|
+
|
|
27
|
+
Usage
|
|
28
|
+
-----
|
|
29
|
+
|
|
30
|
+
.. code-block:: python
|
|
31
|
+
|
|
32
|
+
from sbmlmath import SBMLMathMLPrinter, SBMLMathMLParser
|
|
33
|
+
import sympy as sp
|
|
34
|
+
|
|
35
|
+
sympy_expr = sp.sympify("A ** B + exp(C) * D")
|
|
36
|
+
mathml = SBMLMathMLPrinter().doprint(sympy_expr)
|
|
37
|
+
print(mathml)
|
|
38
|
+
|
|
39
|
+
cycled_sympy = SBMLMathMLParser().parse_str(mathml)
|
|
40
|
+
print(cycled_sympy)
|
|
41
|
+
assert sympy_expr == cycled_sympy
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
Installation
|
|
45
|
+
------------
|
|
46
|
+
|
|
47
|
+
Releases from `PyPI <https://pypi.org/project/sbmlmath/>`_:
|
|
48
|
+
|
|
49
|
+
.. code-block:: bash
|
|
50
|
+
|
|
51
|
+
pip install sbmlmath
|
|
52
|
+
|
|
53
|
+
The latest development version from GitHub:
|
|
54
|
+
|
|
55
|
+
.. code-block:: bash
|
|
56
|
+
|
|
57
|
+
pip install https://github.com/dweindl/sbmlmath/archive/main.zip
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
Source code
|
|
61
|
+
-----------
|
|
62
|
+
|
|
63
|
+
The source code is hosted on `GitHub <https://github.com/dweindl/sbmlmath>`_.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
import zlib
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_libsbml_inventory(
|
|
12
|
+
filename: str = "libsbml.inv",
|
|
13
|
+
base_url: str = "https://sbml.org/software/libsbml/5.18.0/docs/formatted/python-api/",
|
|
14
|
+
) -> tuple[str, str]:
|
|
15
|
+
"""Create the libsbml inventory file for use with intersphinx."""
|
|
16
|
+
inventory_header = (
|
|
17
|
+
"# Sphinx inventory version 2\n"
|
|
18
|
+
"# Project: libsbml\n"
|
|
19
|
+
"# Version: 5.18.0\n"
|
|
20
|
+
"# The remainder of this file is compressed using zlib.\n"
|
|
21
|
+
)
|
|
22
|
+
inventory_content = (
|
|
23
|
+
"libsbml.ASTNode py:class -1 classlibsbml_1_1_a_s_t_node.html libsbml.ASTNode\n"
|
|
24
|
+
"libsbml.SBase py:class -1 classlibsbml_1_1_s_base.html libsbml.SBase\n"
|
|
25
|
+
)
|
|
26
|
+
compressed_content = zlib.compress(inventory_content.encode("utf-8"))
|
|
27
|
+
|
|
28
|
+
with open(filename, "wb") as f:
|
|
29
|
+
f.write(inventory_header.encode("utf-8"))
|
|
30
|
+
f.write(compressed_content)
|
|
31
|
+
|
|
32
|
+
return (base_url, filename)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
project = "sbmlmath"
|
|
36
|
+
copyright = "2024, Daniel Weindl"
|
|
37
|
+
author = "Daniel Weindl"
|
|
38
|
+
|
|
39
|
+
# -- General configuration ---------------------------------------------------
|
|
40
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
41
|
+
|
|
42
|
+
extensions = [
|
|
43
|
+
"sphinx.ext.autodoc",
|
|
44
|
+
"sphinx.ext.intersphinx",
|
|
45
|
+
"sphinx.ext.autosummary",
|
|
46
|
+
"sphinx.ext.viewcode",
|
|
47
|
+
"sphinx.ext.napoleon",
|
|
48
|
+
"sphinx_autodoc_typehints",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
templates_path = ["_templates"]
|
|
52
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
autodoc_default_options = {
|
|
56
|
+
"members": None,
|
|
57
|
+
"imported-members": ["sbmlmath"],
|
|
58
|
+
"inherited-members": False,
|
|
59
|
+
"show-inheritance": None,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# sphinx-autodoc-typehints options
|
|
63
|
+
# https://github.com/tox-dev/sphinx-autodoc-typehints
|
|
64
|
+
always_use_bars_union = True
|
|
65
|
+
typehints_fully_qualified = False
|
|
66
|
+
|
|
67
|
+
# autodoc_class_signature = "separated"
|
|
68
|
+
|
|
69
|
+
intersphinx_mapping = {
|
|
70
|
+
"sympy": ("https://docs.sympy.org/latest/", None),
|
|
71
|
+
"pint": ("https://pint.readthedocs.io/en/stable/", None),
|
|
72
|
+
"python": ("https://docs.python.org/3", None),
|
|
73
|
+
"libsbml": get_libsbml_inventory(),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
typehints_document_rtype = True
|
|
77
|
+
autodoc_typehints = "description"
|
|
78
|
+
|
|
79
|
+
# -- Options for HTML output -------------------------------------------------
|
|
80
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
81
|
+
|
|
82
|
+
html_theme = "alabaster"
|
|
83
|
+
html_static_path = ["_static"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=.
|
|
11
|
+
set BUILDDIR=_build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "setuptools-scm>=8"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sbmlmath"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
authors = [
|
|
9
|
+
{name = "Daniel Weindl", email = "sci@danielweindl.de"},
|
|
10
|
+
]
|
|
11
|
+
description = "SBML Math <-> SymPy"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
license = {text = "BSD-3-Clause"}
|
|
15
|
+
dependencies = [
|
|
16
|
+
"python-libsbml>=5.20.4",
|
|
17
|
+
"sympy",
|
|
18
|
+
"pint",
|
|
19
|
+
"lxml>=4.6.4",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/dweindl/sbmlmath"
|
|
24
|
+
Documentation = "https://sbmlmath.readthedocs.io/"
|
|
25
|
+
Repository = "https://github.com/dweindl/sbmlmath.git"
|
|
26
|
+
"Bug Tracker" = "https://github.com/dweindl/sbmlmath/issues"
|
|
27
|
+
PyPI = "https://pypi.org/project/sbmlmath/"
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
test = ["pytest>=7", "pre-commit>=3"]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools_scm]
|
|
33
|
+
|
|
34
|
+
[tool.ruff]
|
|
35
|
+
line-length = 79
|
|
36
|
+
exclude = ["sbml-test-suite"]
|
|
37
|
+
lint.extend-select = [
|
|
38
|
+
"T", "W", "E", "F", "B", "C", "S", "I", "UP",
|
|
39
|
+
# "D",
|
|
40
|
+
# "ANN",
|
|
41
|
+
]
|
|
42
|
+
lint.ignore = [
|
|
43
|
+
"S101", # Use of assert detected
|
|
44
|
+
"F405", # star import
|
|
45
|
+
"F403", # star import
|
|
46
|
+
"E501", # Line too long
|
|
47
|
+
]
|
|
48
|
+
[tool.ruff.lint.per-file-ignores]
|
|
49
|
+
"tests/*" = ["T201"] # print statement
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
addopts = "--doctest-modules --ignore=doc/conf.py"
|