From f917b1f190b293400a973b65365544437108804e Mon Sep 17 00:00:00 2001 From: "Jaime R. Calzada" Date: Wed, 9 Aug 2023 10:21:33 -0400 Subject: [PATCH 1/6] Add pyproject.toml, poetry.lock and install_jigsaw.py. In principle, this should be able to reproduce the functionality of the current setup.py into a poetry environment. --- install_jigsaw.py | 26 ++++++++++++++++ poetry.lock | 76 +++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 34 +++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 install_jigsaw.py create mode 100644 poetry.lock create mode 100644 pyproject.toml diff --git a/install_jigsaw.py b/install_jigsaw.py new file mode 100644 index 0000000..19d0c42 --- /dev/null +++ b/install_jigsaw.py @@ -0,0 +1,26 @@ +from pathlib import Path +import shutil +import subprocess + +def run(): + src_parent = Path(__file__).parent.resolve() + jigsaw_src_dir = src_parent / "external/jigsaw" + cmake_build_dir = jigsaw_src_dir / "build" + cmake_build_dir.mkdir(exist_ok=True) + subprocess.run( + [ + "cmake", + '..', + "-DCMAKE_BUILD_TYPE=Release", + "-DCMAKE_INSTALL_PREFIX=." + ], + cwd=cmake_build_dir + ) + subprocess.run(["make", f"-j4"], cwd=cmake_build_dir) + subprocess.run(["make", f"-j4", "install"], cwd=cmake_build_dir) + exesrc_path = cmake_build_dir / "bin" + libsrc_path = cmake_build_dir / "lib" + exedst_path = src_parent / "jigsawpy/_bin" + libdst_path = src_parent / "jigsawpy/_lib" + shutil.copytree(exesrc_path, exedst_path) + shutil.copytree(libsrc_path, libdst_path) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..a790f77 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,76 @@ +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. + +[[package]] +name = "numpy" +version = "1.25.2" +description = "Fundamental package for array computing in Python" +optional = false +python-versions = ">=3.9" +files = [ + {file = "numpy-1.25.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:db3ccc4e37a6873045580d413fe79b68e47a681af8db2e046f1dacfa11f86eb3"}, + {file = "numpy-1.25.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:90319e4f002795ccfc9050110bbbaa16c944b1c37c0baeea43c5fb881693ae1f"}, + {file = "numpy-1.25.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfe4a913e29b418d096e696ddd422d8a5d13ffba4ea91f9f60440a3b759b0187"}, + {file = "numpy-1.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f08f2e037bba04e707eebf4bc934f1972a315c883a9e0ebfa8a7756eabf9e357"}, + {file = "numpy-1.25.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bec1e7213c7cb00d67093247f8c4db156fd03075f49876957dca4711306d39c9"}, + {file = "numpy-1.25.2-cp310-cp310-win32.whl", hash = "sha256:7dc869c0c75988e1c693d0e2d5b26034644399dd929bc049db55395b1379e044"}, + {file = "numpy-1.25.2-cp310-cp310-win_amd64.whl", hash = "sha256:834b386f2b8210dca38c71a6e0f4fd6922f7d3fcff935dbe3a570945acb1b545"}, + {file = "numpy-1.25.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c5462d19336db4560041517dbb7759c21d181a67cb01b36ca109b2ae37d32418"}, + {file = "numpy-1.25.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c5652ea24d33585ea39eb6a6a15dac87a1206a692719ff45d53c5282e66d4a8f"}, + {file = "numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d60fbae8e0019865fc4784745814cff1c421df5afee233db6d88ab4f14655a2"}, + {file = "numpy-1.25.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60e7f0f7f6d0eee8364b9a6304c2845b9c491ac706048c7e8cf47b83123b8dbf"}, + {file = "numpy-1.25.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:bb33d5a1cf360304754913a350edda36d5b8c5331a8237268c48f91253c3a364"}, + {file = "numpy-1.25.2-cp311-cp311-win32.whl", hash = "sha256:5883c06bb92f2e6c8181df7b39971a5fb436288db58b5a1c3967702d4278691d"}, + {file = "numpy-1.25.2-cp311-cp311-win_amd64.whl", hash = "sha256:5c97325a0ba6f9d041feb9390924614b60b99209a71a69c876f71052521d42a4"}, + {file = "numpy-1.25.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b79e513d7aac42ae918db3ad1341a015488530d0bb2a6abcbdd10a3a829ccfd3"}, + {file = "numpy-1.25.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:eb942bfb6f84df5ce05dbf4b46673ffed0d3da59f13635ea9b926af3deb76926"}, + {file = "numpy-1.25.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e0746410e73384e70d286f93abf2520035250aad8c5714240b0492a7302fdca"}, + {file = "numpy-1.25.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7806500e4f5bdd04095e849265e55de20d8cc4b661b038957354327f6d9b295"}, + {file = "numpy-1.25.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8b77775f4b7df768967a7c8b3567e309f617dd5e99aeb886fa14dc1a0791141f"}, + {file = "numpy-1.25.2-cp39-cp39-win32.whl", hash = "sha256:2792d23d62ec51e50ce4d4b7d73de8f67a2fd3ea710dcbc8563a51a03fb07b01"}, + {file = "numpy-1.25.2-cp39-cp39-win_amd64.whl", hash = "sha256:76b4115d42a7dfc5d485d358728cdd8719be33cc5ec6ec08632a5d6fca2ed380"}, + {file = "numpy-1.25.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:1a1329e26f46230bf77b02cc19e900db9b52f398d6722ca853349a782d4cff55"}, + {file = "numpy-1.25.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c3abc71e8b6edba80a01a52e66d83c5d14433cbcd26a40c329ec7ed09f37901"}, + {file = "numpy-1.25.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1b9735c27cea5d995496f46a8b1cd7b408b3f34b6d50459d9ac8fe3a20cc17bf"}, + {file = "numpy-1.25.2.tar.gz", hash = "sha256:fd608e19c8d7c55021dffd43bfe5492fab8cc105cc8986f813f8c3c048b38760"}, +] + +[[package]] +name = "scipy" +version = "1.11.1" +description = "Fundamental algorithms for scientific computing in Python" +optional = false +python-versions = "<3.13,>=3.9" +files = [ + {file = "scipy-1.11.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:aec8c62fbe52914f9cf28d846cf0401dd80ab80788bbab909434eb336ed07c04"}, + {file = "scipy-1.11.1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:3b9963798df1d8a52db41a6fc0e6fa65b1c60e85d73da27ae8bb754de4792481"}, + {file = "scipy-1.11.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e8eb42db36526b130dfbc417609498a6192381abc1975b91e3eb238e0b41c1a"}, + {file = "scipy-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:366a6a937110d80dca4f63b3f5b00cc89d36f678b2d124a01067b154e692bab1"}, + {file = "scipy-1.11.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:08d957ca82d3535b3b9ba6c8ff355d78fe975271874e2af267cb5add5bd78625"}, + {file = "scipy-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:e866514bc2d660608447b6ba95c8900d591f2865c07cca0aa4f7ff3c4ca70f30"}, + {file = "scipy-1.11.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ba94eeef3c9caa4cea7b402a35bb02a5714ee1ee77eb98aca1eed4543beb0f4c"}, + {file = "scipy-1.11.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:512fdc18c65f76dadaca139348e525646d440220d8d05f6d21965b8d4466bccd"}, + {file = "scipy-1.11.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cce154372f0ebe88556ed06d7b196e9c2e0c13080ecb58d0f35062dc7cc28b47"}, + {file = "scipy-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b4bb943010203465ac81efa392e4645265077b4d9e99b66cf3ed33ae12254173"}, + {file = "scipy-1.11.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:249cfa465c379c9bb2c20123001e151ff5e29b351cbb7f9c91587260602c58d0"}, + {file = "scipy-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:ffb28e3fa31b9c376d0fb1f74c1f13911c8c154a760312fbee87a21eb21efe31"}, + {file = "scipy-1.11.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:39154437654260a52871dfde852adf1b93b1d1bc5dc0ffa70068f16ec0be2624"}, + {file = "scipy-1.11.1-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:b588311875c58d1acd4ef17c983b9f1ab5391755a47c3d70b6bd503a45bfaf71"}, + {file = "scipy-1.11.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d51565560565a0307ed06fa0ec4c6f21ff094947d4844d6068ed04400c72d0c3"}, + {file = "scipy-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b41a0f322b4eb51b078cb3441e950ad661ede490c3aca66edef66f4b37ab1877"}, + {file = "scipy-1.11.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:396fae3f8c12ad14c5f3eb40499fd06a6fef8393a6baa352a652ecd51e74e029"}, + {file = "scipy-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:be8c962a821957fdde8c4044efdab7a140c13294997a407eaee777acf63cbf0c"}, + {file = "scipy-1.11.1.tar.gz", hash = "sha256:fb5b492fa035334fd249f0973cc79ecad8b09c604b42a127a677b45a9a3d4289"}, +] + +[package.dependencies] +numpy = ">=1.21.6,<1.28.0" + +[package.extras] +dev = ["click", "cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy", "pycodestyle", "pydevtool", "rich-click", "ruff", "types-psutil", "typing_extensions"] +doc = ["jupytext", "matplotlib (>2)", "myst-nb", "numpydoc", "pooch", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-design (>=0.2.0)"] +test = ["asv", "gmpy2", "mpmath", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"] + +[metadata] +lock-version = "2.0" +python-versions = ">=3.9.0,<3.13" +content-hash = "0beb43983f9516025cf67a5ae7a6faf11835821a2d020ccd662dc90f12290093" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e75bc46 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,34 @@ +[tool.poetry] +name = "jigsawpy" +version = "1.0.0" +description = "Python interface for the JIGSAW meshing library." +authors = ["Darren Engwirda "] +homepage = "https://github.com/dengwirda/" +keywords = ["Mesh-generation", "Delaunay", "Voronoi"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Operating System :: OS Independent", + "Intended Audience :: Science/Research", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: C++", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering :: Visualization" +] + +[tool.poetry.dependencies] +python = ">=3.9.0,<3.13" +numpy = "^1.25.2" +scipy = "^1.11.1" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +install-jigsaw = 'install_jigsaw:run' + +[tool.poetry.urls] +"Github" = "https://github.com/dengwirda/" From 7b6e2d9bec432b2ec88a689be1cfb4e4d7c42bc9 Mon Sep 17 00:00:00 2001 From: "Jaime R. Calzada" Date: Wed, 9 Aug 2023 19:24:11 -0400 Subject: [PATCH 2/6] Now includes libsaw shared library as part of build --- build.py | 35 +++++++++++++++++++++++++++++++++++ install_jigsaw.py | 26 -------------------------- pyproject.toml | 16 ++++++++++++++-- 3 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 build.py delete mode 100644 install_jigsaw.py diff --git a/build.py b/build.py new file mode 100644 index 0000000..766e590 --- /dev/null +++ b/build.py @@ -0,0 +1,35 @@ +from pathlib import Path +import shutil +import subprocess +import platform + +def build(): + src_parent = Path(__file__).parent.resolve() + exedst_path = src_parent / "jigsawpy/_bin" + libdst_path = src_parent / "jigsawpy/_lib" + syslib = {"Windows": "jigsaw.dll", "Linux": "libjigsaw.so", "Darwin": "libjigsaw.dylib"} + tgt_libsaw_path = libdst_path / syslib[platform.system()] + if not tgt_libsaw_path.is_file(): + jigsaw_src_dir = src_parent / "external/jigsaw" + cmake_build_dir = jigsaw_src_dir / "build" + cmake_build_dir.mkdir(exist_ok=True) + subprocess.run( + [ + "cmake", + '..', + "-DCMAKE_BUILD_TYPE=Release", + "-DCMAKE_INSTALL_PREFIX=." + ], + cwd=cmake_build_dir + ) + subprocess.run(["make", f"-j4"], cwd=cmake_build_dir) + subprocess.run(["make", f"-j4", "install"], cwd=cmake_build_dir) + exesrc_path = cmake_build_dir / "bin" + libsrc_path = cmake_build_dir / "lib" + exedst_path = src_parent / "jigsawpy/_bin" + libdst_path = src_parent / "jigsawpy/_lib" + shutil.copytree(exesrc_path, exedst_path) + shutil.copytree(libsrc_path, libdst_path) + + +build() diff --git a/install_jigsaw.py b/install_jigsaw.py deleted file mode 100644 index 19d0c42..0000000 --- a/install_jigsaw.py +++ /dev/null @@ -1,26 +0,0 @@ -from pathlib import Path -import shutil -import subprocess - -def run(): - src_parent = Path(__file__).parent.resolve() - jigsaw_src_dir = src_parent / "external/jigsaw" - cmake_build_dir = jigsaw_src_dir / "build" - cmake_build_dir.mkdir(exist_ok=True) - subprocess.run( - [ - "cmake", - '..', - "-DCMAKE_BUILD_TYPE=Release", - "-DCMAKE_INSTALL_PREFIX=." - ], - cwd=cmake_build_dir - ) - subprocess.run(["make", f"-j4"], cwd=cmake_build_dir) - subprocess.run(["make", f"-j4", "install"], cwd=cmake_build_dir) - exesrc_path = cmake_build_dir / "bin" - libsrc_path = cmake_build_dir / "lib" - exedst_path = src_parent / "jigsawpy/_bin" - libdst_path = src_parent / "jigsawpy/_lib" - shutil.copytree(exesrc_path, exedst_path) - shutil.copytree(libsrc_path, libdst_path) diff --git a/pyproject.toml b/pyproject.toml index e75bc46..f023d10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,14 @@ classifiers = [ "Topic :: Scientific/Engineering :: Physics", "Topic :: Scientific/Engineering :: Visualization" ] +packages = [ + { include = "jigsawpy" }, +] +include = [ + { path = "jigsawpy/_lib", format = "wheel" }, + { path = "jigsawpy/_bin", format = "wheel" }, + "external/**/*", +] [tool.poetry.dependencies] python = ">=3.9.0,<3.13" @@ -27,8 +35,12 @@ scipy = "^1.11.1" requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" -[tool.poetry.scripts] -install-jigsaw = 'install_jigsaw:run' +[tool.poetry.build] +generate-setup-file = false +script = "build.py" + +# [tool.poetry.scripts] +# install-jigsaw = 'install_jigsaw:run' [tool.poetry.urls] "Github" = "https://github.com/dengwirda/" From c5c3871d490227060c0a7b4a0ab7aa37f00634d6 Mon Sep 17 00:00:00 2001 From: "Jaime R. Calzada" Date: Wed, 9 Aug 2023 19:27:47 -0400 Subject: [PATCH 3/6] add wildcards to include --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f023d10..a7af591 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,8 +21,8 @@ packages = [ { include = "jigsawpy" }, ] include = [ - { path = "jigsawpy/_lib", format = "wheel" }, - { path = "jigsawpy/_bin", format = "wheel" }, + { path = "jigsawpy/_lib/*", format = "wheel" }, + { path = "jigsawpy/_bin/*", format = "wheel" }, "external/**/*", ] From e33f6641854ddae577333e7651a157ed3e9a3144 Mon Sep 17 00:00:00 2001 From: "Jaime R. Calzada" Date: Wed, 9 Aug 2023 19:35:29 -0400 Subject: [PATCH 4/6] Now the wheels include the _bin and _lib --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a7af591..cb1aa6d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ packages = [ include = [ { path = "jigsawpy/_lib/*", format = "wheel" }, { path = "jigsawpy/_bin/*", format = "wheel" }, - "external/**/*", ] [tool.poetry.dependencies] @@ -39,8 +38,5 @@ build-backend = "poetry.core.masonry.api" generate-setup-file = false script = "build.py" -# [tool.poetry.scripts] -# install-jigsaw = 'install_jigsaw:run' - [tool.poetry.urls] "Github" = "https://github.com/dengwirda/" From 199711eede81b677edadaf375de582803c591bd1 Mon Sep 17 00:00:00 2001 From: Jaime R Calzada Date: Wed, 9 Oct 2024 13:29:36 -0400 Subject: [PATCH 5/6] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cb1aa6d..a6bd955 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ include = [ ] [tool.poetry.dependencies] -python = ">=3.9.0,<3.13" +python = ">=3.10" numpy = "^1.25.2" scipy = "^1.11.1" From 3fff857f2673599fb7acdcffcbab254f26ae3f7e Mon Sep 17 00:00:00 2001 From: Jaime R Calzada Date: Fri, 18 Oct 2024 11:22:19 -0400 Subject: [PATCH 6/6] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a6bd955..d9b98de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ include = [ [tool.poetry.dependencies] python = ">=3.10" -numpy = "^1.25.2" +numpy = ">=1.25.2,<3" scipy = "^1.11.1" [build-system]