From 1eba9bcb68e8422154ae51620f37ccbc1b3fb99f Mon Sep 17 00:00:00 2001 From: Yusuke Matsui Date: Thu, 2 Nov 2023 17:20:09 +0000 Subject: [PATCH 1/7] clean up build process by removing pybind11 stuff --- pyproject.toml | 2 +- requirements.txt | 1 - setup.py | 24 ------------------------ 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d2e63c5..2c2cf1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] requires = ["setuptools", "pybind11"] -build-backend = "setuptools.build_meta:__legacy__" \ No newline at end of file +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 826cb56..b09bac3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -pybind11>=2.9 nanopq diff --git a/setup.py b/setup.py index 7a562e7..cc30140 100644 --- a/setup.py +++ b/setup.py @@ -17,36 +17,12 @@ version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1) -class get_pybind_include(object): - """Helper class to determine the pybind11 include path - - The purpose of this class is to postpone importing pybind11 - until it is actually installed, so that the ``get_include()`` - method can be invoked. """ - - def __init__(self, user=False): - try: - import pybind11 - except ImportError: - if subprocess.call([sys.executable, '-m', 'pip', 'install', 'pybind11']): - raise RuntimeError('pybind11 install failed.') - self.user = user - - def __str__(self): - import pybind11 - return pybind11.get_include(self.user) - ext_modules = [ Extension( 'main', ['src/main.cpp', 'src/pqkmeans.cpp'], # For c++ pqkmeans - include_dirs=[ - # Path to pybind11 headers - get_pybind_include(), - get_pybind_include(user=True) - ], language='c++', undef_macros=['NDEBUG'], # This makes sure assert() works ), From 3d7be666b7b5b809502ac09fce946b10b60684e7 Mon Sep 17 00:00:00 2001 From: Yusuke Matsui Date: Thu, 2 Nov 2023 17:27:56 +0000 Subject: [PATCH 2/7] explicitly install in the gh actions --- .github/workflows/build.yml | 3 +++ Makefile | 15 +++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1fe0320..472399d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,6 +42,9 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt - uses: ilammy/msvc-dev-cmd@v1 + - name: Install Rii + run: | + make build - name: Test with CC=${{ matrix.compiler }} env: CC: ${{ matrix.compiler }} diff --git a/Makefile b/Makefile index df68475..0ad836f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: test clean build deploy test_deploy +.PHONY: test clean build test: python setup.py test @@ -6,11 +6,14 @@ test: clean: rm -rf build tmp dist *.egg-info *.so .eggs +# build: +# python setup.py sdist + build: - python setup.py sdist + pip install . -deploy: clean build - twine upload dist/* +# deploy: clean build +# twine upload dist/* -test_deploy: clean build - twine upload --repository-url https://test.pypi.org/legacy/ dist/* +# test_deploy: clean build +# twine upload --repository-url https://test.pypi.org/legacy/ dist/* From f2adda9f47db4eaa83932f05c117a6f790ab7185 Mon Sep 17 00:00:00 2001 From: Yusuke Matsui Date: Thu, 2 Nov 2023 17:35:22 +0000 Subject: [PATCH 3/7] updated setup.py following the official one --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index cc30140..5fbee7d 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ +from pybind11.setup_helpers import Pybind11Extension, build_ext from setuptools import setup, Extension, find_packages -from setuptools.command.build_ext import build_ext import sys import setuptools import re @@ -19,7 +19,7 @@ ext_modules = [ - Extension( + Pybind11Extension( 'main', ['src/main.cpp', 'src/pqkmeans.cpp'], # For c++ pqkmeans @@ -115,7 +115,7 @@ def build_extensions(self): install_requires=requirements, setup_requires=['pybind11>=2.9'], ext_modules=ext_modules, - cmdclass={'build_ext': BuildExt}, + cmdclass={'build_ext': build_ext}, zip_safe=False, python_requires=">=3.6", ) From 430c4fe524b89ea7d6c069fadce94d61490b8017 Mon Sep 17 00:00:00 2001 From: Yusuke Matsui Date: Thu, 2 Nov 2023 17:36:05 +0000 Subject: [PATCH 4/7] deleted too much --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5fbee7d..768bd12 100644 --- a/setup.py +++ b/setup.py @@ -115,7 +115,7 @@ def build_extensions(self): install_requires=requirements, setup_requires=['pybind11>=2.9'], ext_modules=ext_modules, - cmdclass={'build_ext': build_ext}, + cmdclass={'build_ext': BuildExt}, zip_safe=False, python_requires=">=3.6", ) From 42d46fba6fb0972c9b57a2265144770f142961f8 Mon Sep 17 00:00:00 2001 From: Yusuke Matsui Date: Thu, 2 Nov 2023 17:39:13 +0000 Subject: [PATCH 5/7] requirement is requried?? --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index b09bac3..826cb56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ +pybind11>=2.9 nanopq From 42b0fe23ec1a5e21b94ad34fbcf55d81eacab567 Mon Sep 17 00:00:00 2001 From: Yusuke Matsui Date: Thu, 2 Nov 2023 17:49:03 +0000 Subject: [PATCH 6/7] set version --- Makefile | 3 +-- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0ad836f..06b7dde 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,7 @@ test: clean: rm -rf build tmp dist *.egg-info *.so .eggs -# build: -# python setup.py sdist + build: pip install . diff --git a/pyproject.toml b/pyproject.toml index 2c2cf1d..a15a2ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "pybind11"] +requires = ["setuptools>=42", "pybind11>=2.9"] build-backend = "setuptools.build_meta" \ No newline at end of file From 36ea79b7887497f346b46b16463e10859ff9f570 Mon Sep 17 00:00:00 2001 From: Yusuke Matsui Date: Sat, 4 Nov 2023 01:15:11 +0000 Subject: [PATCH 7/7] setuptools>64 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a15a2ea..d4a51cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools>=42", "pybind11>=2.9"] +requires = ["setuptools>=64", "pybind11>=2.9"] build-backend = "setuptools.build_meta" \ No newline at end of file