Skip to content

Commit

Permalink
fixing tests, fixing flake8, fixing mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskoenig committed Aug 15, 2024
1 parent 724de6b commit e4d1597
Show file tree
Hide file tree
Showing 104 changed files with 405 additions and 212 deletions.
6 changes: 4 additions & 2 deletions release-notes/0.9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ following changes:

# Features
- bump `pymetadata>=0.4.0` to switch to OLS4
- python 3.12 support
- dropping python 3.9
- python 3.12 support (dropping python 3.9)
- pydantic fixes
- bugfixes
- updated sbml4humans
- libsbml-4.20.4
- improved ODE generation

Your sbmlutils team
1 change: 1 addition & 0 deletions src/sbmlutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""sbmlutils - Python utilities for SBML."""

from pathlib import Path

__author__ = "Matthias König"
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/biomodels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for downloading biomodel models."""

import shutil
import tempfile
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/comp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Package for SBML comp."""

from .comp import (
# Port,
create_ExternalModelDefinition,
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/comp/flatten.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers for model flattening."""

import os
import time
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Rich console for logging."""

from rich import pretty
from rich.console import Console
from rich.theme import Theme
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/converters/copasi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers to work with COPASI files."""

from pathlib import Path

import libsbml
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/converters/mathml.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*, /, +, -
and, or, not
"""

from math import *
from typing import Any, Dict, Optional, Tuple

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/converters/odefac_example/odefac_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example of creating markdown and python code."""

from pathlib import Path

from sbmlutils.console import console
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/converters/xpp_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
pip install libroadrunner
```
"""

from pathlib import Path

import roadrunner
Expand Down
17 changes: 10 additions & 7 deletions src/sbmlutils/cytoscape.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
"""Module for visualiation in Cytoscape."""

import os
import tempfile


os.environ["PY4CYTOSCAPE_DETAIL_LOGGER_DIR"] = str(tempfile.gettempdir())

from pathlib import Path
from typing import Any, Union
from pathlib import Path # noqa: E402
from typing import Any, Union # noqa: E402

import py4cytoscape as p4c
from requests.exceptions import RequestException
import py4cytoscape as p4c # type: ignore # noqa: E402
from requests.exceptions import RequestException # noqa: E402

from sbmlutils import log
from sbmlutils.console import console
from sbmlutils.parser import antimony_to_sbml
from sbmlutils import log # noqa: E402
from sbmlutils.console import console # noqa: E402
from sbmlutils.parser import antimony_to_sbml # noqa: E402


logger = log.get_logger(__name__)
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/data/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
The functionality is very useful, but only if this can be applied to existing
models in a simple manner.
"""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/data/interpolation_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example demonstrating the interpolation of data."""

import tempfile
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/data/interpolation_pancreas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example demonstrating the interpolation of data."""

import tempfile
from pathlib import Path
from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/distrib/distrib_examples.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code for working with the libsbml distrib package."""

import tempfile

import libsbml
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/distrib/distrib_packages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example testing uncertainty with libsbml packages."""

import tempfile
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Examples for model creation."""

from pathlib import Path
from sbmlutils.examples.dallaman import dallaman
from sbmlutils.examples.demo import demo
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/algebraic_rule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""AlgebraicRule example."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.resources import EXAMPLES_DIR
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Model demonstrates how to annotate model objects with SBOTerms and Terms from
other ontologies. Annotations use the functionality from `pymetadata`.
"""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/assignment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""AssignmentRule and InitialAssignment example."""

from sbmlutils.console import console
from sbmlutils.converters import odefac
from sbmlutils.examples import templates
Expand Down
3 changes: 2 additions & 1 deletion src/sbmlutils/examples/combine_archive/omex_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This demonstrates just the very core SBML functionality.
"""

from pathlib import Path
from typing import Optional

Expand Down Expand Up @@ -69,7 +70,7 @@
for k in range(n_cells - 1):
_m.reactions.append( # type: ignore
Reaction(
sid=f"J{k}", equation=f"S{k} <-> S{k+1}", formula=f"D * (S{k}-S{k+1})"
sid=f"J{k}", equation=f"S{k} <-> S{k + 1}", formula=f"D * (S{k} - S{k + 1})"
),
)

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/compartment_species_reaction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Compartment, Species, Reaction example."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata.sbo import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/dallaman/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Module for DallaMan Meal model."""
1 change: 1 addition & 0 deletions src/sbmlutils/examples/demo/demo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Demo kinetic network."""

from pathlib import Path

from sbmlutils.examples import templates
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/distrib/distrib_comp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Distrib and comp example to check flattening."""

import shutil
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/distrib/distrib_distributions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Distrib example demonstrating distributions."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.validation import ValidationOptions
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/distrib/distrib_uncertainties.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Uncertainty example."""

import libsbml

from sbmlutils.examples import templates
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/fbc/fbc_key_value_pair.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FBC example for KeyValuePairs."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata.sbo import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/fbc/fbc_mass_charge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FBC mass and charge example."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/fbc/fbc_userdefinedconstraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FBA example with UserDefinedConstraints."""

import numpy as np

from sbmlutils.examples import templates
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/fbc/fbc_v2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FBA example with exchange reactions."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/fbc/fbc_v3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FBA example with exchange reactions."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata.sbo import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/fbc/fbc_version3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
For latest SBML fbc v3 specification see
https://github.com/bgoli/sbml-fbc-spec/blob/main/sf_svn/spec/main.pdf
"""

from logging import getLogger
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/icg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ICG examples."""

from pathlib import Path

ICG_PATH = Path(__file__).parent
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/icg/factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ICG model factory."""

from pathlib import Path
from typing import Any, Dict

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/icg/model_body.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PKPD model for whole-body icg metabolism."""

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/icg/model_liver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ICG liver model."""

from pathlib import Path

from sbmlutils.cytoscape import visualize_sbml
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This demonstrates just the very core SBML functionality.
"""

from pathlib import Path

import libsbml
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/model_definitions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Multiple model definitions."""

from sbmlutils.examples import templates
from sbmlutils.factory import *

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/multiple_substance_units.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for substance units."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata.sbo import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/notes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example model with notes."""

from sbmlutils.examples import templates
from sbmlutils.factory import *

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/parameter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parameter example."""

from sbmlutils.examples import templates
from sbmlutils.factory import *
from sbmlutils.metadata import *
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/reaction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create reaction example."""

import numpy as np

from sbmlutils.examples import templates
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/templates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Template information for the model creation."""

from datetime import datetime

from sbmlutils.factory import Creator
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/tiny/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
```
"""

from pathlib import Path

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/tiny/tiny.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tiny model example."""

from math import inf
from pathlib import Path

Expand Down
9 changes: 6 additions & 3 deletions src/sbmlutils/examples/tutorial/linear_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
`sbmlutils` allows to generate patterns of objects by combining loops in combination
with string patterns. In this example we create a kinetic model of a linear chain.
"""

from sbmlutils.converters import odefac
from sbmlutils.cytoscape import visualize_sbml
from sbmlutils.examples import templates
Expand Down Expand Up @@ -34,15 +35,17 @@
sid=f"S{k + 2}",
initialConcentration=0.0,
compartment="cell",
name=f"Species {k +2}",
name=f"Species {k + 2}",
),
)
model.parameters.append(
Parameter(sid=f"k{k+1}", value=0.1, name=f"rate constant {k+1}"),
Parameter(sid=f"k{k + 1}", value=0.1, name=f"rate constant {k + 1}"),
)
model.reactions.append(
Reaction(
sid=f"J{k+1}", equation=f"S{k+1} -> S{k+2}", formula=f"k{k+1} * S{k+1}"
sid=f"J{k + 1}",
equation=f"S{k + 1} -> S{k + 2}",
formula=f"k{k + 1} * S{k + 1}",
),
)

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/tutorial/minimal_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This demonstrates just the very core SBML functionality.
"""

from sbmlutils.cytoscape import visualize_sbml
from sbmlutils.factory import *
from sbmlutils.metadata import *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Annotate an existing model."""

from pathlib import Path

from sbmlutils.cytoscape import visualize_sbml
Expand Down
3 changes: 2 additions & 1 deletion src/sbmlutils/examples/tutorial/minimal_model_comp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example creating composite model."""

from pathlib import Path

from sbmlutils.comp import flatten_sbml
Expand Down Expand Up @@ -40,7 +41,7 @@
for k in range(n_cells - 1):
model.reactions.append(
Reaction(
sid=f"J{k}", equation=f"S{k} <-> S{k+1}", formula=f"D * (S{k}-S{k+1})"
sid=f"J{k}", equation=f"S{k} <-> S{k + 1}", formula=f"D * (S{k} - S{k + 1})"
),
)

Expand Down
1 change: 1 addition & 0 deletions src/sbmlutils/examples/tutorial/model_composition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example for model composition via multiple models."""

from pathlib import Path

from sbmlutils.cytoscape import visualize_sbml
Expand Down
Loading

0 comments on commit e4d1597

Please sign in to comment.