Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 1 addition & 5 deletions .github/workflows/test_benchmark_collection_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ jobs:
sudo apt-get update \
&& sudo apt-get install -y swig libatlas-base-dev

- name: pip
run: |
pip3 install --upgrade --user wheel \
&& pip3 install --upgrade --user setuptools
- run: pip3 install pytest shyaml

- run: echo "${HOME}/.local/bin/" >> $GITHUB_PATH
Expand All @@ -40,7 +36,7 @@ jobs:
# install AMICI
- name: Create AMICI sdist
run: |
cd python/sdist && /usr/bin/python3 setup.py sdist
pip3 install build && cd python/sdist && python3 -m build --sdist
- name: Install AMICI sdist
run: |
AMICI_PARALLEL_COMPILE=2 pip3 install -v --user \
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ jobs:
run: |
sudo scripts/downloadAndBuildSwig.sh

- name: pip
run: |
pip3 install setuptools

- name: sphinx
run: |
scripts/run-sphinx.sh
4 changes: 0 additions & 4 deletions .github/workflows/test_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ jobs:
run: |
scripts/buildCpputest.sh

- name: pip
run: |
pip3 install numpy

- name: Build AMICI
run: |
scripts/buildAmici.sh
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ jobs:
run: |
sudo apt-get update \
&& sudo apt-get install -y swig libatlas-base-dev
- name: pip
run: |
pip3 install --upgrade --user wheel \
&& pip3 install --upgrade --user setuptools
- run: pip3 install petab shyaml

- run: echo "${HOME}/.local/bin/" >> $GITHUB_PATH
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test_petab_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ jobs:
libatlas-base-dev \
python3-venv

- name: pip
run: |
pip3 install --upgrade --user wheel \
&& pip3 install --upgrade --user setuptools
- run: pip3 install pytest shyaml pytest-cov pysb petab

- name: Build BNGL
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test_python_ver_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ jobs:
libatlas-base-dev \
libhdf5-serial-dev \
libboost-math-dev
- name: pip
run: |
pip3 install --upgrade --user wheel \
&& pip3 install --upgrade --user setuptools


# install AMICI
- name: Build BNGL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_sbml_semantic_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: apt
run: |
sudo apt-get update \
&& sudo apt-get install -y swig3.0 libatlas-base-dev
&& sudo apt-get install -y swig4.0 libatlas-base-dev
- run: AMICI_PARALLEL_COMPILE=2 ./scripts/installAmiciSource.sh
- run: AMICI_PARALLEL_COMPILE=2 ./scripts/run-SBMLTestsuite.sh

Expand Down
3 changes: 2 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ add_custom_target(python-wheel
add_custom_target(python-sdist
COMMENT "Creating sdist for AMICI base python package"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/sdist
COMMAND ${Python3_EXECUTABLE} setup.py sdist --dist-dir=${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${Python3_EXECUTABLE} -m pip install build
COMMAND ${Python3_EXECUTABLE} -m build --sdist --outdir=${CMAKE_CURRENT_BINARY_DIR}
)


Expand Down
3 changes: 3 additions & 0 deletions python/sdist/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools>=40.6.3", "wheel", "numpy"]
build-backend = "setuptools.build_meta"
62 changes: 62 additions & 0 deletions python/sdist/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[metadata]
name = amici
description = Advanced multi-language Interface to CVODES and IDAS
version = file: amici/version.txt
license = BSD 3-Clause License
url = https://github.com/AMICI-dev/AMICI
keywords = differential equations, simulation, ode, cvodes, systems biology, sensitivity analysis, sbml, pysb, petab
author = Fabian Froehlich, Jan Hasenauer, Daniel Weindl and Paul Stapor
author_email = fabian_froehlich@hms.harvard.edu
project_urls =
Bug Reports = https://github.com/AMICI-dev/AMICI/issues
Source = https://github.com/AMICI-dev/AMICI
Documentation = https://amici.readthedocs.io/en/latest/
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Operating System :: POSIX :: Linux
Operating System :: MacOS :: MacOS X
Programming Language :: Python
Programming Language :: C++
Topic :: Scientific/Engineering :: Bio-Informatics

[options]
packages = find:
package_dir =
amici = amici
python_requires = >=3.6
install_requires =
sympy>=1.7.1
python-libsbml
h5py
pandas
pkgconfig
wurlitzer
toposort
include_package_data = True
zip_safe = False

[options.extras_require]
petab = petab>=0.1.11
pysb = pysb>=1.11.0

[options.package_data]
amici =
amici/include/amici/*
src/*template*
swig/*
libs/*
setup.py.template

[options.exclude_package_data]
* =
README.txt


[options.entry_points]

; amici_import_petab.py is kept for backwards compatibility
console_scripts =
amici_import_petab = amici.petab_import:main
amici_import_petab.py = amici.petab_import:main
112 changes: 8 additions & 104 deletions python/sdist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,22 @@

This file expects to be run from within its directory.

Requires:
Non-python-package requirements:
- swig3.0
- setuptools
- pkgconfig python+executables
- hdf5 libraries and headers
- Optional: hdf5 libraries and headers
"""

import os
import subprocess
import sys

import setup_clibs # Must run from within containing directory

from distutils import log


def try_install(package: str) -> None:
"""Try installing the given package using pip. Exit on error."""

log.info(f"Missing required package {package}. Trying to install...")
errno = subprocess.call([sys.executable, "-m", "pip", "install", package])
if errno:
log.error(f"Failed trying to install {package}. "
"Please install manually before installing AMICI.")
raise SystemExit(errno)

import importlib
importlib.invalidate_caches()
globals()[package] = importlib.import_module(package)


try:
# Required for numpy include directory, and for importing anything from
# the `amici` package. Therefore, try before any amici import.
import numpy as np
except ImportError:
# We need numpy, but setup_requires fires too late
try_install('numpy')
# retry
import numpy as np

try:
# Required for customizing installation, but setup_requires fires too late
from setuptools import find_packages, setup, Extension
except ImportError:
try_install('setuptools')
from setuptools import find_packages, setup, Extension

# Add current directory to path, as we need some modules from the AMICI
# Add containing directory to path, as we need some modules from the AMICI
# package already for installation
sys.path.insert(0, os.getcwd())
sys.path.insert(0, os.path.dirname(__file__))

import numpy as np
import setup_clibs # Must run from within containing directory
from setuptools import find_packages, setup, Extension

from amici import __version__
from amici.custom_commands import (
AmiciInstall, AmiciBuildCLib, AmiciDevelop,
AmiciInstallLib, AmiciBuildExt, AmiciSDist)
Expand All @@ -69,11 +32,6 @@ def try_install(package: str) -> None:
add_openmp_flags,
)

# Python version check. We need >= 3.6 due to e.g. f-strings
if sys.version_info < (3, 6):
sys.exit('amici requires at least Python version 3.6')


def main():
# Extra compiler flags
cxx_flags = []
Expand Down Expand Up @@ -171,7 +129,6 @@ def main():

# Install
setup(
name='amici',
cmdclass={
'install': AmiciInstall,
'sdist': AmiciSDist,
Expand All @@ -180,63 +137,10 @@ def main():
'install_lib': AmiciInstallLib,
'develop': AmiciDevelop,
},
version=__version__,
description='Advanced multi-language Interface to CVODES and IDAS',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/AMICI-dev/AMICI',
author='Fabian Froehlich, Jan Hasenauer, Daniel Weindl and '
'Paul Stapor',
author_email='fabian_froehlich@hms.harvard.edu',
license='BSD',
libraries=[libamici, libsundials, libsuitesparse],
ext_modules=[amici_module],
packages=find_packages(),
package_dir={'amici': 'amici'},
entry_points={
'console_scripts': [
'amici_import_petab = amici.petab_import:main',
# for backwards compatibility
'amici_import_petab.py = amici.petab_import:main'
]
},
install_requires=['sympy>=1.7.1',
'python-libsbml',
'h5py',
'pandas',
'pkgconfig',
'wurlitzer',
'toposort'],
setup_requires=['setuptools>=40.6.3'],
python_requires='>=3.6',
extras_require={
'petab': ['petab>=0.1.11'],
'pysb': ['pysb>=1.11.0']
},
package_data={
'amici': ['amici/include/amici/*',
'src/*template*',
'swig/*',
'libs/*',
'setup.py.template',
],
},
zip_safe=False,
include_package_data=True,
exclude_package_data={
'': ['README.txt'],
},
test_suite="tests",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
'Programming Language :: Python',
'Programming Language :: C++',
'Topic :: Scientific/Engineering :: Bio-Informatics',
],
)


Expand Down
1 change: 0 additions & 1 deletion scripts/buildDependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ script_path=$(cd "$script_path" && pwd)
"${script_path}/buildSundials.sh"
"${script_path}/buildCpputest.sh"
"${script_path}/buildBNGL.sh"
pip3 install numpy
5 changes: 2 additions & 3 deletions scripts/buildSdist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ set -e
script_path=$(dirname "$BASH_SOURCE")
amici_path=$(cd "$script_path/.." && pwd)

pip3 install --upgrade --user wheel
pip3 install --upgrade --user setuptools
pip3 install build

cd "${amici_path}/python/sdist"
python3 setup.py sdist
python -m build --sdist
1 change: 0 additions & 1 deletion scripts/installAmiciArchive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ else
source ${AMICI_PATH}/build/venvArchive/bin/activate
fi

pip install --upgrade pip setuptools pkgconfig wheel
pip install $(ls -t ${AMICI_PATH}/build/python/amici-*.tar.gz | head -1)
deactivate
5 changes: 2 additions & 3 deletions scripts/installAmiciSource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ else
source ${AMICI_PATH}/build/venv/bin/activate
fi

# install wheel separately to prevent build_wheel fail in next step
pip install --upgrade wheel
pip install --upgrade pip setuptools pkgconfig scipy matplotlib coverage pytest pytest-cov
pip install --upgrade pip pkgconfig scipy matplotlib coverage pytest pytest-cov
pip install git+https://github.com/pysb/pysb # pin to develop to fix sympy compatibility

pip install --verbose -e ${AMICI_PATH}/python/sdist[petab]
deactivate