Skip to content

Commit 6a66e57

Browse files
committed
BLD: simplify build-time requirements with flit-core
1 parent 2e97552 commit 6a66e57

File tree

4 files changed

+19
-36
lines changed

4 files changed

+19
-36
lines changed

MANIFEST.in

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

pyproject.toml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
[build-system]
2-
requires = [
3-
"setuptools>=77.0.0",
4-
"setuptools_scm[toml]>=7.0.1",
5-
]
6-
7-
build-backend = "setuptools.build_meta"
2+
requires = ["flit_core >=3.11,<4"]
3+
build-backend = "flit_core.buildapi"
84

95
[project]
106
name = "unyt"
7+
version = "3.0.1dev0"
118
description = "A package for handling numpy arrays with units"
129
authors = [
1310
{ name = "The yt project", email = "[email protected]" },
@@ -31,9 +28,6 @@ dependencies = [
3128
"sympy>=1.9.0",
3229
"packaging>=20.9",
3330
]
34-
dynamic = [
35-
"version",
36-
]
3731

3832
[project.readme]
3933
file = "README.rst"
@@ -87,24 +81,14 @@ required-environments = [
8781
"sys_platform == 'darwin' and platform_machine == 'arm64'",
8882
]
8983

90-
[tool.setuptools]
91-
include-package-data = true
92-
zip-safe = false
9384

94-
[tool.setuptools.packages.find]
85+
[tool.flit.sdist]
9586
include = [
9687
"unyt",
9788
"unyt.tests",
9889
"unyt.tests.data",
9990
"unyt._mpl_array_converter",
10091
]
101-
namespaces = false
102-
103-
[tool.setuptools.package-data]
104-
unyt = [
105-
"tests/data/old_json_registry.txt",
106-
]
107-
10892

10993
[tool.black]
11094
exclude = '''
@@ -154,10 +138,6 @@ select = [
154138
[tool.ruff.lint.isort]
155139
combine-as-imports = true
156140

157-
[tool.setuptools_scm]
158-
write_to = "unyt/_version.py"
159-
version_scheme = "post-release"
160-
161141
[tool.pytest.ini_options]
162142
addopts = "-ra --ignore=benchmarks --ignore=paper --ignore=unyt/_mpl_array_converter --color=yes"
163143
filterwarnings = [

unyt/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
from unyt.unit_registry import UnitRegistry # NOQA: F401
5959
from unyt.unit_systems import UnitSystem # NOQA: F401
6060

61-
from ._version import __version__
62-
6361

6462
# function to only import quantities into this namespace
6563
# we go through the trouble of doing this instead of "import *"
@@ -95,3 +93,10 @@ def test(): # pragma: no cover
9593
from unyt.mpl_interface import matplotlib_support
9694

9795
matplotlib_support = matplotlib_support()
96+
97+
98+
def __getattr__(item: str):
99+
if item == "__version__":
100+
from importlib.metadata import version
101+
return version("unyt")
102+
raise AttributeError(f"Module 'unyt' has no attribute {item!r}.")

unyt/tests/test_version.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from importlib.metadata import version
2+
3+
import unyt
4+
5+
6+
def test_version():
7+
expected = version("unyt")
8+
assert unyt.__version__ == expected

0 commit comments

Comments
 (0)