diff --git a/HISTORY.rst b/HISTORY.rst index ffaf498..c5009c1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,10 @@ History ======= +1.2.2 (2024-08-29) +------------------ +* Fix wheel builds + 1.2.1 (2024-08-05) ------------------ diff --git a/MANIFEST.in b/MANIFEST.in index eadbe6f..5dc7bd7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,2 @@ -include *.rst -include Makefile -recursive-include examples *.ipynb -recursive-include src *.h +exclude examples/* +include src/_mt2/*.h diff --git a/Makefile b/Makefile index 0399c58..1073b90 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,13 @@ clean: clean-build clean-pyc clean-venv .PHONY: clean-build clean-build: rm -rf build/ + rm -rf testdir/ rm -rf dist/ rm -rf .eggs/ + rm -rf src/*.egg-info/ find . -name '*.egg-info' -delete find . -name '*.egg' -delete + find . -name '*.so' -delete .PHONY: clean-pyc clean-pyc: @@ -27,3 +30,21 @@ clean-venv: .PHONY: test test: install uv run --locked python -m unittest discover tests + +.PHONY: build +build: install + @# Slightly disgusting; just installing the `build` module into the working venv and + @# removing after we're done. + uv pip install build + uv run python -m build + uv pip uninstall build + +.PHONY: test_wheel +test_wheel: clean build + @# Build the wheel, then install it and check that we can import it. + rm -rf testdir && mkdir testdir + cd testdir && uv venv + cd testdir && uv pip install `find ../dist/ -name *.whl` + testdir/.venv/bin/python -c "from mt2 import mt2" + rm -r testdir + diff --git a/pyproject.toml b/pyproject.toml index ced8b60..ca1f2b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mt2" -version = "1.2.1" +version = "1.2.2" description = "Stransverse mass computation as a numpy ufunc." authors = [ { name = "Tom Gillam", email = "tpgillam@googlemail.com" }, @@ -29,8 +29,3 @@ urls = { Homepage = "https://github.com/tpgillam/mt2" } requires = ["setuptools>=61.0", "numpy"] build-backend = "setuptools.build_meta" -[tool.setuptools.packages.find] -include = ["mt2*"] - -[tool.setuptools.package-data] -mt2 = ["src/*.h", "src/*.cpp"] diff --git a/setup.py b/setup.py index 63cf8eb..5c537e8 100644 --- a/setup.py +++ b/setup.py @@ -2,13 +2,13 @@ import numpy -__version__ = "1.2.1" +__version__ = "1.2.2" setup( ext_modules=[ Extension( - "_mt2", - ["src/main.cpp"], + "mt2._mt2", + ["src/_mt2/main.cpp"], define_macros=[ # Pass in the version info so we can expose it in the extension. ("VERSION_INFO", __version__), @@ -19,7 +19,7 @@ # citation information elsewhere. ("DISABLE_COPYRIGHT_PRINTING", "1"), ], - include_dirs=[numpy.get_include(), "src"], + include_dirs=[numpy.get_include()], language="c++", extra_compile_args=["-std=c++11"], ), diff --git a/src/lester_mt2_bisect_v7.h b/src/_mt2/lester_mt2_bisect_v7.h similarity index 100% rename from src/lester_mt2_bisect_v7.h rename to src/_mt2/lester_mt2_bisect_v7.h diff --git a/src/main.cpp b/src/_mt2/main.cpp similarity index 100% rename from src/main.cpp rename to src/_mt2/main.cpp diff --git a/src/mt2_Lallyver2.h b/src/_mt2/mt2_Lallyver2.h similarity index 100% rename from src/mt2_Lallyver2.h rename to src/_mt2/mt2_Lallyver2.h diff --git a/src/mt2_bisect.h b/src/_mt2/mt2_bisect.h similarity index 100% rename from src/mt2_bisect.h rename to src/_mt2/mt2_bisect.h diff --git a/mt2/__init__.py b/src/mt2/__init__.py similarity index 97% rename from mt2/__init__.py rename to src/mt2/__init__.py index 026b10f..77e6114 100644 --- a/mt2/__init__.py +++ b/src/mt2/__init__.py @@ -2,9 +2,9 @@ import numpy -from _mt2 import mt2_lester_ufunc, mt2_tombs_ufunc # pyright: ignore [reportMissingImports] +from mt2._mt2 import mt2_lester_ufunc, mt2_tombs_ufunc # pyright: ignore [reportMissingImports] -__version__ = "1.2.1" +__version__ = "1.2.2" __all__ = ["mt2", "mt2_arxiv", "mt2_ufunc"] diff --git a/mt2/diagnostics.py b/src/mt2/diagnostics.py similarity index 100% rename from mt2/diagnostics.py rename to src/mt2/diagnostics.py diff --git a/tests/common.py b/tests/common.py index 31f5456..49fb4b2 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1,4 +1,4 @@ -from _mt2 import mt2_lally_ufunc, mt2_lester_ufunc, mt2_tombs_ufunc +from mt2._mt2 import mt2_lally_ufunc, mt2_lester_ufunc, mt2_tombs_ufunc def mt2_lally(*args, desired_precision_on_mt2=0.0, out=None):