SBML Math <-> SymPy
Project description
sbmlmath — a Python library for handling SBML MathML
sbmlmath
is a Python library for interconverting SymPy
expressions and SBML-MathML.
SBML uses a subset of MathML that this library
aims to support. This is not (intended to be) a general MathML parser.
Main functionality:
- sympy -> SBML MathML
- SBML MathML -> sympy
- in particular for cases where
sympy.sympify(libsbml.formulaToL3String(...))
won't do the job (mind, e.g., the differences in operator precedence between sympy/Python and libsbml L3 formulas!) - retaining unit annotations and other
<ci>
attributes
- in particular for cases where
NOTE: This is under development and the API is to be considered unstable
Python support policy: sbmlmath follows NEP 29.
Usage
from sbmlmath import SBMLMathMLPrinter, SBMLMathMLParser
import sympy as sp
sympy_expr = sp.sympify("A ** B + exp(C) * D")
mathml = SBMLMathMLPrinter().doprint(sympy_expr)
print(mathml)
cycled_sympy = SBMLMathMLParser().parse_str(mathml)
print(cycled_sympy)
assert sympy_expr == cycled_sympy
Documentation
Under construction at sbmlmath.readthedocs.io.
Installation
Releases from PyPI:
pip install sbmlmath
The latest development version from GitHub:
pip install git+https://github.com/dweindl/sbmlmath.git#egg=sbmlmath
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sbmlmath-0.4.0.tar.gz
.
File metadata
- Download URL: sbmlmath-0.4.0.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1c0c7b57b9bacef73bc0adc5443c1e2633ae1d2548086ab768fa2e7a03ac3c31
|
|
MD5 |
082c8c7ad2d6c360bedd97e4a44f9330
|
|
BLAKE2b-256 |
25d68d9145a107ec999192b22a8e876892c08320391e2704c9be4797494fa056
|
Provenance
The following attestation bundles were made for sbmlmath-0.4.0.tar.gz
:
Publisher:
deploy_release.yaml
on dweindl/sbmlmath
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
sbmlmath-0.4.0.tar.gz
-
Subject digest:
1c0c7b57b9bacef73bc0adc5443c1e2633ae1d2548086ab768fa2e7a03ac3c31
- Sigstore transparency entry: 191624937
- Sigstore integration time:
-
Permalink:
dweindl/sbmlmath@3ef5c82519fe81a8861ce26f4570f88fafbdb2bf
-
Branch / Tag:
refs/tags/v0.4.0
- Owner: https://github.com/dweindl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
deploy_release.yaml@3ef5c82519fe81a8861ce26f4570f88fafbdb2bf
-
Trigger Event:
release
-
Statement type: