Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyEnzyme v2.0.0 #67

Draft
wants to merge 82 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
e63345f
remove old workflows
JR-1991 Jun 22, 2024
71db8a1
fix spelling
JR-1991 Jun 22, 2024
fac2c87
remove unused code and artifacts
JR-1991 Jun 22, 2024
5dad733
add migrated lib
JR-1991 Jun 22, 2024
14f25a5
migrate to pyproject
JR-1991 Jun 22, 2024
6301617
linting and testing workflows
JR-1991 Jun 22, 2024
0c979c5
update fixtures
JR-1991 Jun 22, 2024
28697df
ignore mac things
JR-1991 Jun 22, 2024
a924ce6
fix typos
JR-1991 Jun 22, 2024
984847e
update readme
JR-1991 Jun 22, 2024
51ad12f
add new tests
JR-1991 Jun 22, 2024
7622a8a
only lint `pyenzyme` and `tests`
JR-1991 Jun 22, 2024
ab29d57
add dev examples
JR-1991 Jun 22, 2024
415ec1e
use `serialization_alias` for ld fields
JR-1991 Jun 25, 2024
c2e52e3
remove unused imports
JR-1991 Jun 25, 2024
0e7f516
added pyright and poetry
haeussma Jun 26, 2024
eb19c84
regenerated lib via gen.toml including celsius
haeussma Jun 26, 2024
bf0ff6d
replaced content with newly generated model
haeussma Jun 26, 2024
cf1618c
replaced mode, added celsius as unit
haeussma Jun 26, 2024
b2bb4f1
remove unused import
JR-1991 Jun 26, 2024
e8d6dc5
Merge pull request #68 from EnzymeML/add-celsius
JR-1991 Jun 26, 2024
065d66c
updated pandas dependency version range
haeussma Aug 16, 2024
981ddcb
update dev examples
JR-1991 Aug 16, 2024
ef42fa7
implement sbml omex parser
JR-1991 Aug 16, 2024
16f4e89
adjust serializer to model change
JR-1991 Aug 16, 2024
81dde6d
adjust and extend mappings to model changes
JR-1991 Aug 16, 2024
6b29053
format strings in multiple lines
JR-1991 Aug 16, 2024
7be7ace
model update
JR-1991 Aug 16, 2024
4890eb2
utilities to parse RDF
JR-1991 Aug 16, 2024
4fcdb6d
remove redundant `unit` arg
JR-1991 Aug 16, 2024
abe6944
export vital sbml functions
JR-1991 Aug 16, 2024
7350377
adjust to model changes
JR-1991 Aug 16, 2024
877cd41
add parameter fetcher
JR-1991 Aug 16, 2024
0e41499
refactor and extend to nested and multiple types
JR-1991 Aug 16, 2024
b15e149
rename to prevent mutability issues
JR-1991 Aug 16, 2024
6acea11
add `pymetadata` dep for OMEX support
JR-1991 Aug 16, 2024
d687c43
update tests
JR-1991 Aug 16, 2024
734f849
remove unused imports
JR-1991 Aug 16, 2024
df6c1af
remove unused `units`
JR-1991 Aug 16, 2024
835e2c3
update dev example
JR-1991 Aug 19, 2024
978e100
attach readers and writers to model class
JR-1991 Aug 19, 2024
ec497a5
add parameters to enzmldoc
JR-1991 Aug 19, 2024
165eeec
move params to root
JR-1991 Aug 19, 2024
c2c68c3
adapt to parameter loc and cast `str` to `float`
JR-1991 Aug 19, 2024
f1eeaf4
adapt parameter change
JR-1991 Aug 19, 2024
7547872
cast to float
JR-1991 Aug 19, 2024
958b321
add utility to strip ld keys
JR-1991 Aug 19, 2024
a57a732
update tests
JR-1991 Aug 19, 2024
6330f0c
add `to_pandas` to `EnzymeMLDocument`
JR-1991 Aug 20, 2024
bf62d86
data, time, time_unit in `MeasurementData` not mandatory anymore
haeussma Aug 20, 2024
fe3d3bb
- can not assume filenames
fbergmann Aug 23, 2024
f17303f
- init defaults to add missing attributes
fbergmann Aug 23, 2024
ca68f4f
- omex uses /tab-separated-values for tsv
fbergmann Aug 23, 2024
c895c26
update dev examples
JR-1991 Sep 7, 2024
2c9a3cf
add default imports
JR-1991 Sep 7, 2024
428a889
extract all files within omex
JR-1991 Sep 7, 2024
7a381d8
adapt parser and serializer to annotations
JR-1991 Sep 7, 2024
767c10a
add support for legacy and new version
JR-1991 Sep 7, 2024
8697431
rename method and update docs
JR-1991 Sep 7, 2024
43f76e6
use `float` instead of `int`
JR-1991 Sep 7, 2024
20e73a1
add function to extract the namespaces
JR-1991 Sep 7, 2024
64b2075
update tests
JR-1991 Sep 7, 2024
19f9281
add `pydantic-xml` dep
JR-1991 Sep 7, 2024
8e234dd
add testing section
JR-1991 Sep 7, 2024
93713f0
add container test
JR-1991 Sep 7, 2024
7830cd8
check fragments instead of complete uris
JR-1991 Sep 7, 2024
6d17141
Merge branch 'pydantic-xml' into v2-migration
JR-1991 Sep 7, 2024
64cd210
if multiplier is `1` set it to `None`
JR-1991 Sep 7, 2024
1e3bee5
add run command
JR-1991 Sep 7, 2024
2b702a2
add `vessel_id` to `Complex`
JR-1991 Sep 8, 2024
5d351a5
update dev examples
JR-1991 Sep 8, 2024
55eac11
extract compartment for `Complex`
JR-1991 Sep 8, 2024
f530e1e
update tests
JR-1991 Sep 8, 2024
2c10d54
remove unused import
JR-1991 Sep 8, 2024
91b9993
add suite class
JR-1991 Sep 23, 2024
de446b6
fix units not recognized
JR-1991 Sep 24, 2024
4efc6d1
Return `None` if `unit` is `None`
JR-1991 Sep 24, 2024
a0282d4
set temp unit and value optional
JR-1991 Sep 24, 2024
d1fa04e
fix unit ids not retrieved corectly
JR-1991 Sep 25, 2024
7e41492
fix unit ids and remove validation error
JR-1991 Sep 25, 2024
ccf56c4
Update pyproject.toml
haeussma Dec 18, 2024
c286783
Update pyproject.toml
haeussma Dec 19, 2024
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
34 changes: 0 additions & 34 deletions .github/workflows/build.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
src: "./pyenzyme"
- uses: chartboost/ruff-action@v1
with:
src: "./tests"
36 changes: 0 additions & 36 deletions .github/workflows/python-publish.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/stale.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Unit Tests

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pytest-cov openpyxl
pip3 install -e .
- name: Test with pytest
run: |
python3 -m pytest -v
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,24 @@ dmypy.json
# Pyre type checker
.pyre/

# pyrightconfig
pyrightconfig.json

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
pyenzyme/Examples/getJSONValid.py

# test dirs
# test dirs
tests/tmp

# PyCharm IDE
.idea/
.idea/

# Mac OS
.DS_Store

# Poetry
poetry.lock
23 changes: 0 additions & 23 deletions .readthedocs.yaml

This file was deleted.

21 changes: 7 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
FROM python:3.9
WORKDIR /app

COPY . /app
FROM python:3.11.9-slim-bullseye

RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& apt-get install -y --no-install-recommends gcc \
&& apt-get install -y --no-install-recommends cmake \
&& apt-get purge -y --auto-remove
RUN apt-get update
RUN pip install poetry

WORKDIR /app
COPY . /app

RUN pip3 install git+https://github.com/EnzymeML/PyEnzyme.git
RUN pip3 install fastapi uvicorn jinja2

COPY pyenzyme_server.py /app
RUN poetry install --with tests

CMD ["uvicorn", "pyenzyme_server:app", "--host", "0.0.0.0", "--port", "80"]
ENTRYPOINT ["poetry", "run", "pytest", "-vv"]
92 changes: 33 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</a>
<a href="https://www.codacy.com/gh/EnzymeML/PyEnzyme/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=EnzymeML/PyEnzyme&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/4ceb8d010e7b456c926c8b18737ff102"/></a>
</h1>
<p align="center">
<p align="center">
PyEnzyme is the interface to the data model <b>EnzymeML</b> and offers a convenient way to document and model research data. Lightweight syntax for rapid development of data management solution in enzymology and biocatalysis.</p>

### 🧬 Features
Expand All @@ -17,22 +17,27 @@ PyEnzyme is the interface to the data model <b>EnzymeML</b> and offers a conveni
- **Visualize** experimental results for inspection and publication.

## ⚡️ Quick start
Get started with PyEnzyme by running the following command

Get started with PyEnzyme by running the following command

```
# Using PyPI
python -m pip install pyenzyme
```

Or build by source

```
git clone https://github.com/EnzymeML/PyEnzyme.git
cd PyEnzyme
python3 setup.py install
```

### ⚙️ Package Options
PyEnzyme comes with many flavors, choose whether you want only the base installation, the modeling package or all of it using the following options.

PyEnzyme comes with many flavors, choose whether you want only the base installation, the modeling package or all of it
using the following options.

```
# COPASI - modeling
python -m pip install "pyenzyme[copasi]"
Expand All @@ -53,71 +58,40 @@ python -m pip install "pyenzyme[dataverse]"
python -m pip install "pyenzyme[all]"
```

### 🚀 PyEnzyme's REST-API

If you want to deploy PyEnzyme as a server and use our REST-API to access PyEnzyme from any HTTP-capable programming language, use our official [docker image](https://hub.docker.com/r/enzymeml/pyenzyme/tags) or simply copy and past the following.

```bash
docker pull enzymeml/pyenzyme:latest
docker run -p 8000:8000 enzymeml/pyenzyme:latest
```
See the [API documentation](https://api.enzymeml.org) for details on our endpoints. You can also use our self-hosted PyEnzyme instance if you have no server space - Use https://api.enzymeml.org as base URL to the endpoints.

## ⚙️ Example code

This example will demonstrate how to create a simple EnzymeML document using PyEnzyme and how to use initializers from official databases **Chebi** and **UniProt** to gather metadata. For more examples, please visit our [documentation](https://pyenzyme.readthedocs.io/en/latest/index.html#) (Work in progress)
This example will demonstrate how to create a simple EnzymeML document using PyEnzyme and how to use initializers from
official databases **Chebi** and **UniProt** to gather metadata. For more examples, please visit
our [documentation](https://pyenzyme.readthedocs.io/en/latest/index.html#) (Work in progress)

```python
import pyenzyme as pe

# Initialize your document
enzmldoc = pe.EnzymeMLDocument(name="MyDoc")

# Create a vessel and add it to the document
vessel = pe.Vessel(name="Falcon Tube", volume=10.0, unit="ml")
vessel_id = enzmldoc.addVessel(vessel)

# Set up reactants and proteins from databases
protein = pe.Protein.fromUniProtID(
uniprotid="P07327", vessel_id=vessel_id,
init_conc=10.0, unit="fmole / l"
)

substrate = pe.Reactant.fromChebiID(
chebi_id="CHEBI:16236", vessel_id=vessel_id,
init_conc=200.0, unit="mmole / l"
)

product = pe.Reactant.fromChebiID(
chebi_id="CHEBI:15343", vessel_id=vessel_id,
init_conc=0.0, unit="mmole / l"
)

# ... and add each to the document
protein_id = enzmldoc.addProtein(protein)
substrate_id = enzmldoc.addReactant(substrate)
product_id = enzmldoc.addReactant(product)

# Build the reaction
reaction = pe.EnzymeReaction.fromEquation(
equation="ethanol -> acetaldehyde",
modifiers=[protein_id],
name="Alocohol dehydrogenation",
enzmldoc=enzmldoc
)

# ... and add it to the document
reaction_id = enzmldoc.addReaction(reaction)

# Finally, save the document to an OMEX archive
enzmldoc.toFile(".", name="ADH Experiment")
# To be added for V2
```

<sub>(Code should run as it is)</sup>

## 📖 Documentation and more examples

Explore all the features of **PyEnzyme** in our [documentation](https://pyenzyme.readthedocs.io/en/latest/index.html#) and take part in [Discussions](https://github.com/EnzymeML/PyEnzyme/discussions) and/or [Issues](https://github.com/EnzymeML/PyEnzyme/issues).
Explore all the features of **PyEnzyme** in our [documentation](https://pyenzyme.readthedocs.io/en/latest/index.html#)
and take part in [Discussions](https://github.com/EnzymeML/PyEnzyme/discussions)
and/or [Issues](https://github.com/EnzymeML/PyEnzyme/issues).

## 🧪 Testing

In order to run tests there are two different ways. First you can utilize `pytest` directly by running the following:

```bash
python -m pytest -vv
```

Or you can the provided Dockerfile to run the tests in a containerized environment.

```bash
docker build -t pyenzyme .
docker run pyenzyme
```

## ⚠️ License

`PyEnzyme` is free and open-source software licensed under the [BSD 2-Clause License](https://github.com/EnzymeML/PyEnzyme/blob/main/LICENSE).
`PyEnzyme` is free and open-source software licensed under
the [BSD 2-Clause License](https://github.com/EnzymeML/PyEnzyme/blob/main/LICENSE).
12 changes: 12 additions & 0 deletions dev-examples/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Dev Examples

These examples are intended to be used during development towards 2.0.0 and will be removed in the final release.

## How to run the examples

Dev examples should be run from the root directory of the repository and will produce outputs to the dev-example folder.

```bash
# From the root directory
python ./dev-examples/*.py
```
Loading
Loading