diff --git a/DEVELOPING.md b/DEVELOPING.md index 04906337..3d28d3ec 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -26,7 +26,7 @@ uv add --optional ## Creating Distributions -1. Bump the version in [version.py](./wfdb/version.py). +1. Bump the version in [pyproject.toml](./pyproject.toml). 2. Add a summary of the changes to [the changelog](https://github.com/MIT-LCP/wfdb-python/blob/main/docs/changes.rst). You may also need to update [the documentation](https://github.com/MIT-LCP/wfdb-python/tree/main/docs). For example, if function arguments have been updated, this change will need to be captured. Open a pull request to merge these changes to the main branch. diff --git a/docs/changes.rst b/docs/changes.rst index c1003495..a21d7c50 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -14,6 +14,9 @@ Unreleased **Raise minimum versions of dependencies** The minimum versions of ``soundfile`` (0.12.1), ``matplotlib`` (3.8.0) and ``requests`` (2.31.0) have been raised. The minimum versions of the other dependencies are unchanged. +**Build with uv_build** + The package is now built with ``uv_build`` instead of ``hatchling``. The version number is specified in ``pyproject.toml`` only, and ``wfdb.__version__`` is read from the installed package metadata (it is ``"unknown"`` if the package is run from a source tree without being installed). + Version 4.3.1 (Feb 2026) ----------------------------- diff --git a/docs/conf.py b/docs/conf.py index 86ca68f0..d1907b87 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,6 +19,7 @@ # import os import sys +import tomllib sys.path.insert(0, os.path.abspath("..")) @@ -66,8 +67,8 @@ def __getattr__(cls, name): copyright = "2018, MIT Lab for Computational Physiology" author = "MIT Lab for Computational Physiology" -with open("../wfdb/version.py") as f: - __version__ = f.read().split()[-1].strip("'") +with open("../pyproject.toml", "rb") as f: + __version__ = tomllib.load(f)["project"]["version"] # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. diff --git a/pyproject.toml b/pyproject.toml index 43b24914..0c92b787 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,14 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["uv_build >= 0.13.0, < 0.14"] +build-backend = "uv_build" [project] name = "wfdb" +version = "4.3.1" description = "The WFDB Python package: tools for reading, writing, and processing physiologic signals and annotations." authors = [{name = "The Laboratory for Computational Physiology", email = "contact@physionet.org"}] -license = {text = "MIT License"} +license = "MIT" +license-files = ["LICENSE"] readme = "README.md" requires-python = ">= 3.11" dependencies = [ @@ -19,7 +21,6 @@ dependencies = [ "fsspec >= 2023.10.0", "aiohttp >= 3.10.11", ] -dynamic = ["version"] [project.optional-dependencies] dev = [ @@ -39,13 +40,5 @@ documentation = "https://wfdb.readthedocs.io/" line-length = 80 target-version = ["py311"] -[tool.hatch.build.targets.sdist] -exclude = [ - "/tests", - "/sample-data", - "/demo-img.png", - "/demo.ipynb", -] - -[tool.hatch.version] -path = "wfdb/version.py" +[tool.uv.build-backend] +module-root = "" diff --git a/wfdb/version.py b/wfdb/version.py index ed48cdab..c026e9f0 100644 --- a/wfdb/version.py +++ b/wfdb/version.py @@ -1 +1,7 @@ -__version__ = "4.3.1" +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version("wfdb") +except PackageNotFoundError: + # Running from a source tree that has not been installed + __version__ = "unknown"