Skip to content

Commit

Permalink
setup.cfg -> pyproject.toml (#2408)
Browse files Browse the repository at this point in the history
Let's reduce the number of package configuration files...
  • Loading branch information
dweindl authored Apr 22, 2024
1 parent 29b7ee8 commit f392619
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Remove direct dependencies from setup.cfg
# Remove any "git+https"-based dependencies that are not supported
# by PyPI and are only required for testing.
run: sed -i '/git+https/d' python/sdist/setup.cfg
run: sed -i '/git+https/d' python/sdist/pyproject.toml

- name: sdist
run: scripts/buildSdist.sh
Expand Down
8 changes: 6 additions & 2 deletions python/sdist/amici/custom_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
class AmiciInstall(install):
"""Custom `install` command to handle extra arguments"""

print("running AmiciInstall")

# Passing --no-clibs allows to install the Python-only part of AMICI
user_options = install.user_options + [
("no-clibs", None, "Don't build AMICI C++ extension"),
]

def run(self):
"""Setuptools entry-point"""
print(f"running {self.__class__.__name__}")

super().run()

def initialize_options(self):
super().initialize_options()
self.no_clibs = False
Expand Down
1 change: 0 additions & 1 deletion python/sdist/bin

This file was deleted.

110 changes: 109 additions & 1 deletion python/sdist/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
# https://setuptools.pypa.io/en/latest/userguide/index.html
[build-system]
requires = [
"setuptools>=40.6.3",
"setuptools>=61",
"wheel",
# oldest-supported-numpy helps us to pin numpy here to the lowest supported
# version to have ABI-compatibility with the numpy version in the runtime
Expand All @@ -13,6 +15,112 @@ requires = [
]
build-backend = "setuptools.build_meta"

[project]
name = "amici"
dynamic = ["version"]
description = "Advanced multi-language Interface to CVODES and IDAS"
requires-python = ">=3.9"
dependencies = [
"cmake-build-extension==0.5.1",
"sympy>=1.9",
"numpy>=1.19.3; python_version=='3.9'",
"numpy>=1.21.4; python_version>='3.10'",
"numpy>=1.23.2; python_version=='3.11'",
"numpy; python_version>='3.12'",
"python-libsbml",
"pandas>=2.0.2",
"pyarrow",
"wurlitzer",
"toposort",
"setuptools>=48",
"mpmath",
]
license = {text = "BSD 3-Clause License"}
authors = [
{name = "Fabian Froehlich", email = "[email protected]"},
{name = "Daniel Weindl", email = "[email protected]"},
{name = "Jan Hasenauer"},
{name = "AMICI contributors"},
]
maintainers = [
{name = "Fabian Froehlich", email = "[email protected]"},
{name = "Daniel Weindl", email = "[email protected]"},
]
readme = "README.md"
keywords =["differential equations", "simulation", "ode", "cvodes",
"systems biology", "sensitivity analysis", "sbml", "pysb", "petab"]
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",
]

[project.optional-dependencies]
# Don't include any URLs here - they are not supported by PyPI:
# HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
# Invalid value for requires_dist. Error: Can't have direct dependency: ...
petab = ["petab>=0.2.9"]
pysb = ["pysb>=1.13.1"]
test = [
"benchmark_models_petab @ git+https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab.git@master#subdirectory=src/python",
"h5py",
"pytest",
"pytest-cov",
"pytest-rerunfailures",
"coverage",
"shyaml",
"antimony>=2.13",
# see https://github.com/sys-bio/antimony/issues/92
# unsupported x86_64 / x86_64h
"antimony!=2.14; platform_system=='Darwin' and platform_machine in 'x86_64h'",
"scipy",
"pooch"
]
vis =[
"matplotlib",
"seaborn",
]
examples =[
"jupyter",
"scipy",
]

[project.scripts]
# amici_import_petab.py is kept for backwards compatibility
amici_import_petab = "amici.petab.cli.import_petab:_main"
"amici_import_petab.py" = "amici.petab.cli.import_petab:_main"

[project.urls]
Homepage = "https://github.com/AMICI-dev/AMICI"
Documentation = "https://amici.readthedocs.io/en/latest/"
Repository = "https://github.com/AMICI-dev/AMICI.git"
"Bug Tracker" = "https://github.com/AMICI-dev/AMICI/issues"

# TODO: consider using setuptools_scm
#[tool.setuptools_scm]
## https://setuptools-scm.readthedocs.io/en/latest/
#root = "../.."

[tool.setuptools.package-data]
amici = [
"amici/include/amici/*",
"src/*template*",
"swig/*",
"libs/*",
"setup.py.template",
]

[tool.setuptools.exclude-package-data]
"*" = ["README.txt"]

[tool.setuptools.dynamic]
version = {attr = "amici.__version__"}

[tool.black]
line-length = 79

Expand Down
91 changes: 0 additions & 91 deletions python/sdist/setup.cfg

This file was deleted.

10 changes: 0 additions & 10 deletions python/sdist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,6 @@ def get_extensions():


def main():
# Readme as long package description to go on PyPi
# (https://pypi.org/project/amici/)
with open(
os.path.join(os.path.dirname(__file__), "README.md"),
encoding="utf-8",
) as fh:
long_description = fh.read()

ext_modules = get_extensions()

# handle parallel building
Expand All @@ -185,8 +177,6 @@ def main():
"develop": AmiciDevelop,
"build_py": AmiciBuildPy,
},
long_description=long_description,
long_description_content_type="text/markdown",
ext_modules=ext_modules,
)

Expand Down

0 comments on commit f392619

Please sign in to comment.