From 0199d3ad9f23dd42cce5532f5cf1f44f9ec69e59 Mon Sep 17 00:00:00 2001 From: Jimmy Charnley Kromann Date: Fri, 29 Mar 2024 20:38:20 +0100 Subject: [PATCH] Reconfigure package --- MANIFEST.in | 3 +++ Makefile | 11 +++++++---- _compile.py | 2 +- environment_dev.yaml | 3 ++- setup.py | 6 +++--- 5 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..320358a9 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include *.py +recursive-include src/qmllib *.f90 +global-exclude *~ *.py[cod] *.so diff --git a/Makefile b/Makefile index d9b63b3a..a27cfeaa 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,8 @@ all: env setup env: ${mamba} env create -f ./environment_dev.yaml -p ./env --quiet - # ${pip} install -e . + ${python} -m pre_commit install + ${python} -m pip install -e . setup: ./.git/hooks/pre-commit @@ -35,9 +36,9 @@ compile: ${python} _compile.py build: - @# ${python} -m build . + ${python} -m build --sdist --skip-dependency-check . @# ${python} -m pip wheel --no-deps -v . - ${python} -m pip wheel -v . + @# ${python} -m pip wheel -v . @#ls *.whl clean: @@ -46,8 +47,10 @@ clean: -name "*.pyc" \ -name ".pyo" \ -delete + rm -rf ./src/*.egg-info/ rm -rf *.whl - rm -fr ./build/ ./__pycache__/ + rm -rf ./build/ ./__pycache__/ + rm -rf ./dist/ clean-env: rm -rf ./env/ diff --git a/_compile.py b/_compile.py index dc7e7f0a..ca459595 100644 --- a/_compile.py +++ b/_compile.py @@ -69,9 +69,9 @@ def main(): for module_name, module_sources in f90_modules.items(): path = Path(module_name) - parent = path.parent stem = path.stem + cwd = Path("src/qmllib") / parent cmd = ["python", "-m", "numpy.f2py", "-c"] + flags + module_sources + ["-m", str(stem)] print(cwd, " ".join(cmd)) diff --git a/environment_dev.yaml b/environment_dev.yaml index 84608176..d855b050 100644 --- a/environment_dev.yaml +++ b/environment_dev.yaml @@ -8,12 +8,13 @@ dependencies: - monkeytype - numpy - pandas - - pyarrow - pip - pre-commit + - pyarrow - pytest - scikit-learn - scipy # build + - build - meson - ninja diff --git a/setup.py b/setup.py index 89f08067..e4a4e324 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ -import sys -from pathlib import Path - from setuptools import setup try: import _compile except ImportError: + import sys + from pathlib import Path + sys.path.append(str(Path(__file__).resolve().parent)) import _compile