diff --git a/.gitignore b/.gitignore index 60a9371..1286f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ __pycache__/ *.so # Distribution / packaging +_version.py .Python build/ develop-eggs/ diff --git a/meteor/__init__.py b/meteor/__init__.py index e69de29..62d6a78 100644 --- a/meteor/__init__.py +++ b/meteor/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["__version__", "version"] + +from ._version import __version__, version diff --git a/meteor/diffmaps.py b/meteor/diffmaps.py index bfd3f85..bff8b2e 100644 --- a/meteor/diffmaps.py +++ b/meteor/diffmaps.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Sequence +from collections.abc import Sequence import numpy as np import reciprocalspaceship as rs diff --git a/meteor/iterative.py b/meteor/iterative.py index 1168749..9077193 100644 --- a/meteor/iterative.py +++ b/meteor/iterative.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Callable +from collections.abc import Callable import numpy as np import pandas as pd diff --git a/meteor/rsmap.py b/meteor/rsmap.py index aebd333..f1d1531 100644 --- a/meteor/rsmap.py +++ b/meteor/rsmap.py @@ -1,7 +1,8 @@ from __future__ import annotations +from collections.abc import Callable from pathlib import Path -from typing import Any, Callable, ClassVar, Literal, overload +from typing import Any, ClassVar, Literal, overload import gemmi import numpy as np diff --git a/meteor/scale.py b/meteor/scale.py index 6181df6..ca63ca2 100644 --- a/meteor/scale.py +++ b/meteor/scale.py @@ -1,7 +1,5 @@ from __future__ import annotations -from typing import Tuple - import numpy as np import pandas as pd import reciprocalspaceship as rs @@ -9,7 +7,7 @@ from .rsmap import Map -ScaleParameters = Tuple[float, float, float, float, float, float, float] +ScaleParameters = tuple[float, float, float, float, float, float, float] """ 7x float tuple to hold anisotropic scaling parameters """ diff --git a/meteor/tv.py b/meteor/tv.py index 6909a85..88bd861 100644 --- a/meteor/tv.py +++ b/meteor/tv.py @@ -1,9 +1,10 @@ from __future__ import annotations import json +from collections.abc import Sequence from dataclasses import asdict, dataclass from pathlib import Path -from typing import Literal, Sequence, overload +from typing import Literal, overload import numpy as np from skimage.restoration import denoise_tv_chambolle diff --git a/meteor/validate.py b/meteor/validate.py index 36a946e..8a2885e 100644 --- a/meteor/validate.py +++ b/meteor/validate.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Callable, Sequence +from collections.abc import Callable, Sequence import numpy as np from scipy.optimize import minimize_scalar diff --git a/pyproject.toml b/pyproject.toml index 1ae7a35..c1b6005 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,16 @@ +[build-system] +requires = ["setuptools >= 61.0", "setuptools-scm"] +build-backend = "setuptools.build_meta" + [project] name = "meteor" description = "denoise crystallographic difference maps" -version = "0.2.0" +dynamic = ["version"] authors = [ { name = "Alisia Fadini", email = "af840@cam.ac.uk" }, { name = "Thomas Lane", email = "thomas.lane@desy.de" } ] +requires-python = ">=3.11" dependencies = [ "numpy >= 1.26", "scipy >= 1.14.0", @@ -21,14 +26,13 @@ tests = [ "pytest-cov", ] -[build-system] -requires = ["setuptools >= 61.0"] -build-backend = "setuptools.build_meta" - [project.scripts] "meteor.diffmap" = "meteor.scripts.compute_difference_map:main" "meteor.phaseboost" = "meteor.scripts.compute_iterative_tv_map:main" +[tool.setuptools_scm] +version_file = "meteor/_version.py" + [tool.mypy] disallow_untyped_calls = true disallow_untyped_defs = true diff --git a/test/unit/scripts/test_compute_iterative_tv_map.py b/test/unit/scripts/test_compute_iterative_tv_map.py index 94f229e..ab5ae8d 100644 --- a/test/unit/scripts/test_compute_iterative_tv_map.py +++ b/test/unit/scripts/test_compute_iterative_tv_map.py @@ -1,8 +1,9 @@ from __future__ import annotations import argparse +from collections.abc import Sequence from pathlib import Path -from typing import Any, Sequence +from typing import Any from unittest import mock import numpy as np diff --git a/test/unit/test_diffmaps.py b/test/unit/test_diffmaps.py index 30163a3..c280f88 100644 --- a/test/unit/test_diffmaps.py +++ b/test/unit/test_diffmaps.py @@ -1,4 +1,4 @@ -from typing import Callable +from collections.abc import Callable import numpy as np import pandas as pd diff --git a/test/unit/test_io.py b/test/unit/test_io.py index 1175248..5671e3a 100644 --- a/test/unit/test_io.py +++ b/test/unit/test_io.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Callable +from collections.abc import Callable import pytest diff --git a/test/unit/test_tv.py b/test/unit/test_tv.py index 183ee25..ee455b2 100644 --- a/test/unit/test_tv.py +++ b/test/unit/test_tv.py @@ -1,8 +1,8 @@ from __future__ import annotations +from collections.abc import Sequence from dataclasses import asdict from pathlib import Path -from typing import Sequence import numpy as np import pandas as pd