From 7dc98a743ddceb5847a8a35221f417826ed20562 Mon Sep 17 00:00:00 2001 From: HugoKulesza <94374655+HugoKulesza@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:16:20 +0100 Subject: [PATCH] Remove submodule, and update pybind11 (#903) Signed-off-by: Hugo KULESZA --- .gitmodules | 3 --- cpp/CMakeLists.txt | 3 ++- cpp/lib/pybind11 | 1 - requirements.txt | 5 +++-- setup.py | 11 ++++++----- 5 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 .gitmodules delete mode 160000 cpp/lib/pybind11 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 92d0453397..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "cpp/lib/pybind11"] - path = cpp/lib/pybind11 - url = https://github.com/pybind/pybind11.git diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5062f32826..534e3a210e 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -37,6 +37,7 @@ endif() if(BUILD_PYTHON_BINDINGS) #Build pythin bindings - add_subdirectory(lib/pybind11) + set(PYBIND11_FINDPYTHON ON) + find_package(pybind11 CONFIG REQUIRED) add_subdirectory(pypowsybl-cpp) endif() \ No newline at end of file diff --git a/cpp/lib/pybind11 b/cpp/lib/pybind11 deleted file mode 160000 index 3e9dfa2866..0000000000 --- a/cpp/lib/pybind11 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3e9dfa2866941655c56877882565e7577de6fc7b diff --git a/requirements.txt b/requirements.txt index 5565731104..257bb37127 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,11 @@ # actual dependencies -pandas==2.2.2; python_version >= "3.9" +pandas==2.2.3; python_version >= "3.9" pandas==2.0.3; python_version <= "3.8" prettytable==3.11.0 # last version supporting python 3.8 networkx matplotlib==3.9.2; python_version >= "3.9" matplotlib==3.7.5; python_version <= "3.8" +pybind11[global]==2.13.6 # optional dependencies pandapower==2.14.11 @@ -14,7 +15,7 @@ sphinx==7.1.2 furo==2024.1.29 # CI dependencies -setuptools==73.0.1 +setuptools==75.3.0 wheel==0.44.0 coverage==7.3.2 pytest>=8.3.3 diff --git a/setup.py b/setup.py index a979c1f700..39441b3e2a 100644 --- a/setup.py +++ b/setup.py @@ -12,13 +12,14 @@ import zipfile import glob -from setuptools import setup, Extension -from setuptools.command.build_ext import build_ext +from pybind11.setup_helpers import Pybind11Extension, build_ext +from setuptools import setup from packaging.version import parse -class PyPowsyblExtension(Extension): +class PyPowsyblExtension(Pybind11Extension): def __init__(self): - Extension.__init__(self, 'pypowsybl._pypowsybl', sources=[]) + Pybind11Extension.__init__(self, 'pypowsybl._pypowsybl', + ["cpp/*"]) class PyPowsyblBuild(build_ext): @@ -44,7 +45,7 @@ def build_extension(self, ext): if not extdir.endswith(os.path.sep): extdir += os.path.sep cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, - '-DPYTHON_EXECUTABLE=' + sys.executable] + '-DPython_EXECUTABLE=' + sys.executable] cfg = 'Debug' if self.debug else 'Release' build_args = ['--config', cfg]