Skip to content

Commit

Permalink
Use setuptools_scm for package versions (#243)
Browse files Browse the repository at this point in the history
Removes some extra `build-system.requires` entries.

So far, repository versions were date-based (well, there was only one, v20230717). The Python package had a constant version number `0.0.0a1`.
To work well with the default setuptools_scm schema, future releases should ideally use `vYYYY.MM.DD` tags.
The Python package will then also have the same version as the benchmark collection as such.
  • Loading branch information
dweindl authored Oct 15, 2024
1 parent 91ac49f commit c163e11
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 7 additions & 1 deletion src/python/benchmark_models_petab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@

from .base import get_problem, get_problem_yaml_path
from .C import MODEL_DIRS, MODELS, MODELS_DIR
from .version import __version__
from .overview import get_overview_df
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("benchmark_models_petab")
except PackageNotFoundError:
# package is not installed
pass
3 changes: 0 additions & 3 deletions src/python/benchmark_models_petab/version.py

This file was deleted.

3 changes: 3 additions & 0 deletions src/python/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ cp -r "../../$DATA_DIR" $BUILD_DIR/$CODE_DIR
# Hop into
cd $BUILD_DIR

# update git root in setuptools_scm configuration
sed -ri 's/root = "..\/.."/root = "..\/..\/.."/' pyproject.toml

# Build
pip install --upgrade build
python -m build --sdist
14 changes: 4 additions & 10 deletions src/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
[build-system]
requires = [
"setuptools",
"wheel",
"petab",
]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"


[project]
name = "benchmark_models_petab"
description = "A collection of models with experimental data in the PEtab format"
Expand All @@ -33,17 +28,16 @@ dependencies = [
[project.optional-dependencies]
dev = ["ruff"]

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

[project.scripts]
bmp-petablint = "benchmark_models_petab.check_petablint:main"
bmp-check-sbml-metadata = "benchmark_models_petab.check_sbml_metadata:main"
bmp-create-overview = "benchmark_models_petab.overview:main"

[tool.setuptools_scm]
root = "../.."

[tool.ruff]
line-length = 79


[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

0 comments on commit c163e11

Please sign in to comment.