From 21245b1183a73e6854ae5e112609ea34c7a23b7a Mon Sep 17 00:00:00 2001 From: Jason Leaver Date: Sat, 18 May 2024 10:25:42 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=20=F0=9F=90=8Dmoved=20to=20src=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- pyproject.toml | 16 +++++++++++++++- setup.py | 4 ++-- {nzthermo => src/nzthermo}/__init__.py | 0 {nzthermo => src/nzthermo}/_c.pyi | 0 {nzthermo => src/nzthermo}/_c.pyx | 0 {nzthermo => src/nzthermo}/_typing.py | 0 {nzthermo => src/nzthermo}/const.py | 0 {nzthermo => src/nzthermo}/core.py | 0 {nzthermo => src/nzthermo}/functional.py | 0 {nzthermo => src/nzthermo}/py.typed | 0 11 files changed, 19 insertions(+), 4 deletions(-) rename {nzthermo => src/nzthermo}/__init__.py (100%) rename {nzthermo => src/nzthermo}/_c.pyi (100%) rename {nzthermo => src/nzthermo}/_c.pyx (100%) rename {nzthermo => src/nzthermo}/_typing.py (100%) rename {nzthermo => src/nzthermo}/const.py (100%) rename {nzthermo => src/nzthermo}/core.py (100%) rename {nzthermo => src/nzthermo}/functional.py (100%) rename {nzthermo => src/nzthermo}/py.typed (100%) diff --git a/.gitignore b/.gitignore index 3954d72..1f9e309 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ build/ **/*.so **/*.c .egg/ -*.egg-info/ \ No newline at end of file +*.egg-info/ +src/nzthermo/_version.py \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 81e0b2e..c52cf9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,11 @@ [build-system] -requires = ["setuptools>=58.2.0", "wheel", "Cython>=0.29.23", "numpy>=1.23.4"] +requires = [ + "wheel>=0.37.1", + "setuptools>=64", + "setuptools_scm>=8", + "Cython>=0.29.23", + "numpy>=1.23.4", +] build-backend = "setuptools.build_meta" [project] @@ -9,6 +15,14 @@ description = "(N, Z) Thermodynamics" authors = [{ name = "Jason Leaver", email = "leaver2000@gmail.com" }] dependencies = ['numpy'] +[tool.setuptools.packages.find] +where = ["src"] +include = ["nzthermo"] + +[tool.setuptools_scm] +write_to = "src/nzthermo/_version.py" + + [tool.pytest] testpaths = ["tests/"] diff --git a/setup.py b/setup.py index 482c753..bff5bd0 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ purge = True # this flag will be used to remove the created .c files to minimize the docker image size -if tuple(sys.argv[1:3]) == ("clean", "--all") and os.path.exists("nzthermo/_c.c"): +if tuple(sys.argv[1:3]) == ("clean", "--all") and os.path.exists("src/nzthermo/_c.c"): # when switching between production and coverage we need to remove the _c.c file to # ensure that the cython code is recompiled with the correct compiler directives os.remove("nzthermo/_c.c") @@ -53,7 +53,7 @@ extension_modules = [ setuptools.Extension( "nzthermo._c", - ["nzthermo/_c.pyx"], + ["src/nzthermo/_c.pyx"], include_dirs=include_dirs, define_macros=define_macros, extra_compile_args=extra_compile_args, diff --git a/nzthermo/__init__.py b/src/nzthermo/__init__.py similarity index 100% rename from nzthermo/__init__.py rename to src/nzthermo/__init__.py diff --git a/nzthermo/_c.pyi b/src/nzthermo/_c.pyi similarity index 100% rename from nzthermo/_c.pyi rename to src/nzthermo/_c.pyi diff --git a/nzthermo/_c.pyx b/src/nzthermo/_c.pyx similarity index 100% rename from nzthermo/_c.pyx rename to src/nzthermo/_c.pyx diff --git a/nzthermo/_typing.py b/src/nzthermo/_typing.py similarity index 100% rename from nzthermo/_typing.py rename to src/nzthermo/_typing.py diff --git a/nzthermo/const.py b/src/nzthermo/const.py similarity index 100% rename from nzthermo/const.py rename to src/nzthermo/const.py diff --git a/nzthermo/core.py b/src/nzthermo/core.py similarity index 100% rename from nzthermo/core.py rename to src/nzthermo/core.py diff --git a/nzthermo/functional.py b/src/nzthermo/functional.py similarity index 100% rename from nzthermo/functional.py rename to src/nzthermo/functional.py diff --git a/nzthermo/py.typed b/src/nzthermo/py.typed similarity index 100% rename from nzthermo/py.typed rename to src/nzthermo/py.typed From 507c50b23952e77317ea66973f1a865ba450de14 Mon Sep 17 00:00:00 2001 From: Jason Leaver Date: Sat, 18 May 2024 10:33:09 -0500 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=8D=20migrated=20to=20src=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +++-- pyproject.toml | 18 ++++++++++++++---- setup.py | 4 ++-- {nzthermo => src/nzthermo}/__init__.py | 0 {nzthermo => src/nzthermo}/_c.pxd | 0 {nzthermo => src/nzthermo}/_c.pyi | 0 {nzthermo => src/nzthermo}/_c.pyx | 0 .../nzthermo}/_experimental/__init__.py | 0 .../nzthermo}/_experimental/_datetime.pyx | 0 .../nzthermo}/_experimental/py_wbgt.pyx | 0 .../nzthermo}/_experimental/wbgt.c | 0 .../nzthermo}/_experimental/wbgt.h | 0 {nzthermo => src/nzthermo}/_typing.py | 0 {nzthermo => src/nzthermo}/const.py | 0 {nzthermo => src/nzthermo}/core.py | 0 {nzthermo => src/nzthermo}/functional.py | 0 {nzthermo => src/nzthermo}/py.typed | 0 17 files changed, 19 insertions(+), 8 deletions(-) rename {nzthermo => src/nzthermo}/__init__.py (100%) rename {nzthermo => src/nzthermo}/_c.pxd (100%) rename {nzthermo => src/nzthermo}/_c.pyi (100%) rename {nzthermo => src/nzthermo}/_c.pyx (100%) rename {nzthermo => src/nzthermo}/_experimental/__init__.py (100%) rename {nzthermo => src/nzthermo}/_experimental/_datetime.pyx (100%) rename {nzthermo => src/nzthermo}/_experimental/py_wbgt.pyx (100%) rename {nzthermo => src/nzthermo}/_experimental/wbgt.c (100%) rename {nzthermo => src/nzthermo}/_experimental/wbgt.h (100%) rename {nzthermo => src/nzthermo}/_typing.py (100%) rename {nzthermo => src/nzthermo}/const.py (100%) rename {nzthermo => src/nzthermo}/core.py (100%) rename {nzthermo => src/nzthermo}/functional.py (100%) rename {nzthermo => src/nzthermo}/py.typed (100%) diff --git a/.gitignore b/.gitignore index 5b29e29..8775833 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,11 @@ build/ **/__pycache__/ **/*.pyc **/*.so -nzthermo/*.c +src/nzthermo/*.c .egg/ *.egg-info/ .vscode/ .coverage .reports/ -.trash/ \ No newline at end of file +.trash/ +src/nzthermo/_version.py \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index cbee4ed..0725f5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,26 @@ [build-system] -requires = ["setuptools>=58.2.0", "wheel", "Cython>=0.29.23", "numpy>=1.23.4"] +requires = [ + "wheel>=0.37.1", + "setuptools>=64", + "setuptools_scm>=8", + "Cython>=0.29.23", + "numpy>=1.23.4", +] build-backend = "setuptools.build_meta" [project] name = "nzthermo" -version = "0.0.1" +dynamic = ["version"] description = "(N, Z) Thermodynamics" authors = [{ name = "Jason Leaver", email = "leaver2000@gmail.com" }] dependencies = ['numpy'] -[tool.setuptools] -packages = ["nzthermo"] +[tool.setuptools.packages.find] +where = ["src"] +include = ["nzthermo"] + +[tool.setuptools_scm] +write_to = "src/nzthermo/_version.py" [tool.pytest] testpaths = ["tests/"] diff --git a/setup.py b/setup.py index 464d839..174fd81 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ if tuple(sys.argv[1:3]) == ("clean", "--all"): # when switching between production and coverage we need to remove the _c.c file to # ensure that the cython code is recompiled with the correct compiler directives - for file in ("nzthermo/_c.c", "nzthermo/_datetime.c"): + for file in ("src/nzthermo/_c.c", "src/nzthermo/_datetime.c"): print(f"removing {file}") if os.path.exists(file): os.remove(file) @@ -58,7 +58,7 @@ extension_modules = [ setuptools.Extension( "nzthermo._c", - ["nzthermo/_c.pyx"], + ["src/nzthermo/_c.pyx"], include_dirs=include_dirs, define_macros=define_macros, extra_compile_args=extra_compile_args, diff --git a/nzthermo/__init__.py b/src/nzthermo/__init__.py similarity index 100% rename from nzthermo/__init__.py rename to src/nzthermo/__init__.py diff --git a/nzthermo/_c.pxd b/src/nzthermo/_c.pxd similarity index 100% rename from nzthermo/_c.pxd rename to src/nzthermo/_c.pxd diff --git a/nzthermo/_c.pyi b/src/nzthermo/_c.pyi similarity index 100% rename from nzthermo/_c.pyi rename to src/nzthermo/_c.pyi diff --git a/nzthermo/_c.pyx b/src/nzthermo/_c.pyx similarity index 100% rename from nzthermo/_c.pyx rename to src/nzthermo/_c.pyx diff --git a/nzthermo/_experimental/__init__.py b/src/nzthermo/_experimental/__init__.py similarity index 100% rename from nzthermo/_experimental/__init__.py rename to src/nzthermo/_experimental/__init__.py diff --git a/nzthermo/_experimental/_datetime.pyx b/src/nzthermo/_experimental/_datetime.pyx similarity index 100% rename from nzthermo/_experimental/_datetime.pyx rename to src/nzthermo/_experimental/_datetime.pyx diff --git a/nzthermo/_experimental/py_wbgt.pyx b/src/nzthermo/_experimental/py_wbgt.pyx similarity index 100% rename from nzthermo/_experimental/py_wbgt.pyx rename to src/nzthermo/_experimental/py_wbgt.pyx diff --git a/nzthermo/_experimental/wbgt.c b/src/nzthermo/_experimental/wbgt.c similarity index 100% rename from nzthermo/_experimental/wbgt.c rename to src/nzthermo/_experimental/wbgt.c diff --git a/nzthermo/_experimental/wbgt.h b/src/nzthermo/_experimental/wbgt.h similarity index 100% rename from nzthermo/_experimental/wbgt.h rename to src/nzthermo/_experimental/wbgt.h diff --git a/nzthermo/_typing.py b/src/nzthermo/_typing.py similarity index 100% rename from nzthermo/_typing.py rename to src/nzthermo/_typing.py diff --git a/nzthermo/const.py b/src/nzthermo/const.py similarity index 100% rename from nzthermo/const.py rename to src/nzthermo/const.py diff --git a/nzthermo/core.py b/src/nzthermo/core.py similarity index 100% rename from nzthermo/core.py rename to src/nzthermo/core.py diff --git a/nzthermo/functional.py b/src/nzthermo/functional.py similarity index 100% rename from nzthermo/functional.py rename to src/nzthermo/functional.py diff --git a/nzthermo/py.typed b/src/nzthermo/py.typed similarity index 100% rename from nzthermo/py.typed rename to src/nzthermo/py.typed From bb2a79faa69233dfce59b118034919f2874670e8 Mon Sep 17 00:00:00 2001 From: Jason Leaver Date: Sat, 18 May 2024 10:57:40 -0500 Subject: [PATCH 3/3] Merge branch 'feature/src-layout' into development --- tests/moist_lapse_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/moist_lapse_test.py b/tests/moist_lapse_test.py index 120ae3a..9f3e919 100644 --- a/tests/moist_lapse_test.py +++ b/tests/moist_lapse_test.py @@ -28,7 +28,7 @@ def test_moist_lapse_mode_1(dtype): [ mpcalc.moist_lapse( pressure[i] * units.pascal, temperature[i] * units.kelvin, ref_pressure[i] * units.pascal - ).m + ).m # type: ignore for i in range(len(temperature)) ], # type: ignore rtol=1e-4,