From a0b18dcb94deb41769115713ee1c4568851627ce Mon Sep 17 00:00:00 2001 From: William Poole Date: Sat, 15 Feb 2025 18:02:39 -0800 Subject: [PATCH] Manual installation of lineages: deploy to master (#178) * fix 139 docs * Default bioscrape installation to core-only without lineage (#176) * default to x64 for macos * test defaulting arch * udpate setup-python action version * try v3.8 for macos * update to 3.8 * fix distutils deprecated * merge master * remove default lineage installation * triggering tests * skipped a lineage test --------- Co-authored-by: William Poole * Update checkout version in pypi workflow (#179) --------- Co-authored-by: Ayush Pandey --- .github/workflows/pypi_release.yml | 4 ++-- README.md | 6 +++--- bioscrape/types.pyx | 1 + setup.py | 13 +++++-------- tests/test_serialization.py | 9 +++++++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pypi_release.yml b/.github/workflows/pypi_release.yml index 1816c7e..42b98c0 100644 --- a/.github/workflows/pypi_release.yml +++ b/.github/workflows/pypi_release.yml @@ -10,9 +10,9 @@ jobs: environment: Release Deploy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: '3.12' diff --git a/README.md b/README.md index af39d14..3c3e0b9 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Install the latest version of Bioscrape:: $ pip install bioscrape -Please note that Bioscrape is a Cython extension module and requires a C++ compiler to be set up on your computer for installation. +Please note that Bioscrape is a Cython extension module and requires a C++ compiler to be set up on your computer for installation. With the PyPi distribution, you can only install the core Bioscrape without the additional lineages package. To install lineages, clone the GitHub repository and run `python setup.py install lineage` from the bioscrape directory. Try online without installing, open self-explanatory jupyter notebooks with Google Colab (linked at the top of this README). @@ -99,8 +99,8 @@ will help you make the PR if you are new to `git` (just ask on the issue). The [ Bioscrape versions: -* 1.2.2 (latest release): To install run `pip install bioscrape` -* 1.2.0 (tagged stable release): To install run `pip install bioscrape==1.2.0` +* 1.3.0 (latest release): To install run `pip install bioscrape` +* 1.2.2 (tagged stable release): To install run `pip install bioscrape==1.2.2` * 1.0.4 (beta release): To install run `pip install bioscrape==1.0.4` # License diff --git a/bioscrape/types.pyx b/bioscrape/types.pyx index ecf8a15..41f0861 100644 --- a/bioscrape/types.pyx +++ b/bioscrape/types.pyx @@ -1515,6 +1515,7 @@ cdef class Model: sbml_filename (str): The SBML filename to import the model. Note that you cannot any other arguments when importing from SBML. You can import the SBML model, then edit the model with the API. + If no keyword argument is passed, then an SBML file is assumed as the input. filename (str): The (old bioscrape XML) file to read the model. Recommended way to import a model is by importing an SBML using `sbml_filename` argument species (List[str]): A list of species names, when constructing the model. diff --git a/setup.py b/setup.py index 386eab6..485ba74 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ numpyInclude = [get_include(), '.'] #Install Bioscrape Core Package - package_data = {'bioscrape': ['*.pxd']} + package_data = {'bioscrape': ['*.pxd', '*.pyx']} bioscrape_src_dir = 'bioscrape' ext_options = {} @@ -51,15 +51,12 @@ # # Turn on to enable gdb debugging # cythonize_options["gdb_debug"] = True - # # Turn on to enable gdb debugging - # cythonize_options["gdb_debug"] = True - #Determine if we install bioscrape, lineage, or both install_bioscrape = False install_lineage = False if "bioscrape" not in sys.argv and "lineage" not in sys.argv: install_bioscrape = True - install_lineage = True + install_lineage = False if "bioscrape" in sys.argv: install_bioscrape = True sys.argv.remove("bioscrape") @@ -67,8 +64,8 @@ install_lineage = True sys.argv.remove("lineage") - elif "bioscrape" not in sys.argv: - install_lineage = True + # elif "bioscrape" not in sys.argv: + # install_lineage = False cython_extensions = [] if install_bioscrape: @@ -87,7 +84,7 @@ print("Bioscrape Cythonized.") if install_lineage: - package_data['lineage'] = ['*.pxd'] + package_data['lineage'] = ['*.pxd', '*.pyx'] print("Installing Lineage...") lineage_src_dir = 'lineage' lineage_source_files = ['lineage.pyx'] diff --git a/tests/test_serialization.py b/tests/test_serialization.py index c84aa45..ed5543a 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -12,7 +12,12 @@ import pandas as pd from bioscrape.simulator import * from bioscrape.types import * -from bioscrape.lineage import * + +try: + from bioscrape.lineage import * + skip_lineage = False +except ModuleNotFoundError: + skip_lineage = True # Seed RNG value. All tests use this value. seed = 54173 @@ -117,7 +122,7 @@ def test_random_complex_model(): f"{'stochastic' if is_stochastic else 'deterministic'} " + \ "simulation when pickled and unpickled." - +@pytest.mark.skipif(skip_lineage, reason="Lineage Not Installed") def test_random_complex_lineagemodel(): ''' Creates a two-reaction LineageModel with more or less the same settings as