Skip to content

Commit 703c435

Browse files
committed
setup.py -> pyproject.toml
1 parent ead2483 commit 703c435

File tree

15 files changed

+90
-99
lines changed

15 files changed

+90
-99
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ jobs:
9898
9999
# install package
100100
- name: Install the package
101-
run: python -m pip install .[all]
101+
run: |
102+
python -m pip install .[all]
103+
python -m pip install amici
102104
103105
#############################################
104106
## Lint
@@ -120,7 +122,7 @@ jobs:
120122
if [[ "${TAG}" =~ ^refs/tags/ ]]; then
121123
version="${TAG/refs\/tags\//}"
122124
else
123-
version=$(python -c "import glob; import importlib.util; version_filename = glob.glob('**/_version.py', recursive=True)[0]; spec = importlib.util.spec_from_file_location('module.name', version_filename); module = importlib.util.module_from_spec(spec); spec.loader.exec_module(module); print(module.__version__)")
125+
version=$(python -c "from biosimulators_amici import __version__; print(__version__)")
124126
fi
125127
126128
echo "version=$version" >> $GITHUB_OUTPUT
@@ -180,7 +182,7 @@ jobs:
180182
## Compile documentation
181183
#############################################
182184
- name: Install the requirements for compiling the documentation
183-
run: python -m pip install -r docs-src/requirements.txt
185+
run: python -m pip install .[doc]
184186

185187
- name: Compile the documentation
186188
run: |

CONTRIBUTING.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ The repository follows standard Python conventions:
1313
* `README.md`: Overview of the repository
1414
* `biosimulators_amici/`: Python code for a BioSimulators-compliant command-line interface to AMICI
1515
* `tests/`: unit tests for the command-line interface
16-
* `setup.py`: installation script for the command-line interface
17-
* `setup.cfg`: configuration for the installation of the command-line interface
18-
* `requirements.txt`: dependencies for the command-line interface
19-
* `requirements.optional.txt`: optional dependencies for the command-line interface
2016
* `MANIFEST.in`: a list of files to include in the package for the command-line interface
2117
* `LICENSE`: License
2218
* `CONTRIBUTING.md`: Guide to contributing to BioSimulators-AMICI (this document)
@@ -54,7 +50,7 @@ coverage html
5450
BioSimulators-AMICI is documented using [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html) and the [napoleon Sphinx plugin](https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html). The documentation can be compiled by running the following commands:
5551

5652
```
57-
python -m pip install -r docs-src/requirements.txt
53+
python -m pip install .[doc]
5854
sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
5955
sphinx-build docs-src docs
6056
```
@@ -71,16 +67,12 @@ Below are instructions for releasing a new version:
7167

7268
1. Make the required changes to the repository.
7369
* To update the version of the underyling simulator, update its version numbers in the following files:
74-
* `requirements.txt`
7570
* `Dockerfile`
7671
* `biosimulators.json`
7772
2. Commit the changes to this repository.
78-
3. Increment the `__version__` variable in `biosimulators_amici/_version.py`.
79-
4. Commit this change to `biosimulators_amici/_version.py`.
80-
5. Add a tag for the new version by running `git tag { version }`. `version` should be equal to the value of the
81-
`__version__` variable in `biosimulators_amici/_version.py`.
82-
6. Push these commits and the new tag to GitHub by running `git push && git push --tags`.
83-
7. This push will trigger a GitHub action which will execute the following tasks:
73+
3. Add a tag for the new version by running `git tag { version }`.
74+
4. Push these commits and the new tag to GitHub by running `git push && git push --tags`.
75+
5. This push will trigger a GitHub action which will execute the following tasks:
8476
* Create a GitHub release for the version.
8577
* Push the release to PyPI.
8678
* Compile the documentation and push the compiled documentation to the repository so that the new documentation is viewable at github.io.

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ LABEL \
3232
# Install requirements
3333
RUN apt-get update -y \
3434
&& apt-get install -y --no-install-recommends \
35+
git \
3536
g++ \
3637
libexpat1 \
3738
libatlas-base-dev \
@@ -47,7 +48,7 @@ RUN apt-get update -y \
4748
# Copy code for command-line interface into image and install it
4849
COPY . /root/Biosimulators_AMICI
4950
RUN pip install pip==23.0.1
50-
RUN pip install sympy /root/Biosimulators_AMICI \
51+
RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BIOSIMULATORS_AMICI=${VERSION} pip install sympy /root/Biosimulators_AMICI \
5152
&& rm -rf /root/Biosimulators_AMICI
5253
#RUN pip install sympy /root/Biosimulators_AMICI amici==${SIMULATOR_VERSION} \
5354
# && rm -rf /root/Biosimulators_AMICI

MANIFEST.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ include README.rst
33

44
# license
55
include LICENSE
6-
7-
# requirements
8-
include requirements.txt
9-
include requirements.optional.txt

biosimulators_amici/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import amici
22

3-
from ._version import __version__ # noqa: F401
4-
# :obj:`str`: version
3+
from importlib.metadata import version, PackageNotFoundError
4+
5+
try:
6+
__version__ = version("biosimulators-amici")
7+
except PackageNotFoundError:
8+
# package is not installed
9+
pass
510

611
from .core import exec_sed_task, preprocess_sed_task, exec_sed_doc, exec_sedml_docs_in_combine_archive # noqa: F401
712

biosimulators_amici/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99
from . import get_simulator_version
10-
from ._version import __version__
10+
from . import __version__
1111
from .core import exec_sedml_docs_in_combine_archive
1212
from biosimulators_utils.simulator.cli import build_cli
1313

biosimulators_amici/_version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs-src/conf.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

7-
import re
87
import datetime
98
import os
109
import sys
10+
import biosimulators_amici
1111

1212
# -- Path setup --------------------------------------------------------------
1313

@@ -23,15 +23,10 @@
2323
copyright = '{}, BioSimulators Team'.format(datetime.datetime.now().year)
2424
author = 'BioSimulators Team'
2525

26-
# The short X.Y version
27-
filename = os.path.join(source_dir, '_version.py')
28-
verstrline = open(filename, 'rt').read()
29-
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
30-
mo = re.search(VSRE, verstrline, re.M)
31-
version = mo.group(1)
32-
3326
# The full version, including alpha/beta/rc tags
34-
release = '.'.join(version.split('.')[0:3])
27+
release = biosimulators_amici.__version__
28+
# The short X.Y version
29+
version = '.'.join(release.split('.')[0:2])
3530

3631
# -- General configuration ---------------------------------------------------
3732

docs-src/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[build-system]
2+
requires = ["setuptools>=80", "setuptools-scm[simple]>=8"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "biosimulators_amici"
7+
dynamic = ["version"]
8+
9+
description = "BioSimulators-compliant command-line interface to the AMICI simulation program <https://github.com/AMICI-dev/amici>."
10+
readme = "README.md"
11+
authors = [
12+
{ name = "Center for Reproducible Biomedical Modeling", email = "[email protected]" }
13+
]
14+
license = { text = "MIT" }
15+
keywords = [
16+
"BioSimulators",
17+
"systems biology",
18+
"computational biology",
19+
"mathematical model",
20+
"kinetic model",
21+
"simulation",
22+
"SBML",
23+
"SED-ML",
24+
"COMBINE",
25+
"OMEX",
26+
]
27+
classifiers = [
28+
"Development Status :: 3 - Alpha",
29+
"Intended Audience :: Science/Research",
30+
"License :: OSI Approved :: MIT License",
31+
"Topic :: Scientific/Engineering :: Bio-Informatics",
32+
]
33+
34+
dependencies = [
35+
"biosimulators-utils[logging] >= 0.1.180",
36+
"amici >= 0.11.17",
37+
"kisao >= 2.33",
38+
"lxml",
39+
"numpy",
40+
]
41+
42+
[project.optional-dependencies]
43+
tests = [
44+
"biosimulators_utils[containers]",
45+
"python_dateutil",
46+
]
47+
doc = [
48+
"pydata-sphinx-theme",
49+
"sphinx >= 1.8",
50+
]
51+
all = [
52+
"biosimulators_utils[containers]",
53+
"python_dateutil",
54+
"pydata-sphinx-theme",
55+
"sphinx >= 1.8",
56+
]
57+
58+
[project.urls]
59+
Homepage = "https://github.com/biosimulators/Biosimulators_AMICI"
60+
Download = "https://github.com/biosimulators/Biosimulators_AMICI"
61+
62+
[project.scripts]
63+
biosimulators-amici = "biosimulators_amici.__main__:main"
64+
65+
[tool.setuptools.packages.find]
66+
where = ["."]
67+
exclude = ["tests", "tests.*"]

0 commit comments

Comments
 (0)