diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2cf3e6a6497efc437fee5a3281fa72c75ee59eae..39502f83b05ee4f8b76242d74809370dfffb27cb 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -130,16 +130,16 @@ gcc_12_python: artifacts: expire_in: 1 hrs paths: - - build/ - - dist/ - - _skbuild/ + - pybuild/ # build in separate folder to avoid conflicts with c++ build before_script: - export CCACHE_BASEDIR=$CI_PROJECT_DIR - export CCACHE_DIR=$CI_PROJECT_DIR/cache script: - - python3 setup.py bdist_wheel build_ext --build-temp=_skbuild -- -DBUILD_VF_CPU=ON -DBUILD_VF_DOUBLE_ACCURACY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache + - export SKBUILD_BUILD_DIR="pybuild" + - export SKBUILD_CMAKE_ARGS="-DBUILD_VF_CPU=ON;-DBUILD_VF_DOUBLE_ACCURACY=ON;-DCMAKE_CXX_COMPILER_LAUNCHER=ccache;-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache;-DCMAKE_C_COMPILER_LAUNCHER=ccache;-G=Ninja" + - pip install . -v ############################################################################### ## Container Upload ## @@ -208,9 +208,6 @@ gcc_12_python_bindings_test: needs: ["gcc_12_python"] before_script: - - export PYTHONPATH="Python" - - export VF_WHEEL=$(find dist/*.whl) - - pip3 install $VF_WHEEL - pip3 install -r Python/requirements.txt script: diff --git a/MANIFEST.in b/MANIFEST.in index adafcf99560acd9da79aa060194df8263b6e77e0..196bdc09019d6028792a565d0776e2c267d3c15a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include pythonbindings/*/bindings* \ No newline at end of file +include pythonbindings/*/*.cpython* \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 257da6fd95d683081dbff865c864079eae9c675d..df0b13b9c22718ef4172d4698fd29b8e85f0ad22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,46 @@ [build-system] -requires = [ - "setuptools>=42", - "scikit-build", - "cmake", - "ninja; platform_system!='Windows'" +requires = ["scikit-build-core"] +build-backend = "scikit_build_core.build" + +[project] +name = "pyfluids" +version = "0.1.0" +description = "Python bindings for VirtualFluids" +readme = "README.md" +requires-python = ">=3.6" +classifiers = [ + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ] -build-backend = "setup_builder" -backend-path = ["utilities"] \ No newline at end of file +url = "https://git.rz.tu-bs.de/irmb/virtualfluids" + +[tool.cmake] +jobs = 8 + +[tool.scikit-build] +build-dir = "build" +strict-config = true +logging.level = "INFO" + +[tool.scikit-build.wheel] +packages = ["pythonbindings/pyfluids", "pythonbindings/pyfluids-stubs", "pythonbindings/pymuparser"] + +[tool.scikit_build.cmake] +verbose = true +build-type = "Release" + +[tool.scikit-build.cmake.define] +BUILD_VF_PYTHON_BINDINGS = "ON" +BUILD_SHARED_LIBS = "OFF" +BUILD_VF_UNIT_TESTS = "OFF" +BUILD_WARNINGS_AS_ERRORS = "OFF" + + +[mypy] +plugins = "numpy.typing.mypy_plugin" + diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 5894f9dec06953c3eeb909af96db9cb19d202d65..0000000000000000000000000000000000000000 --- a/setup.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[metadata] -name = pyfluids -description = Python binding for VirtualFluids -long_description = file: README.md -long_description_content_type = text/markdown -platforms = any -url = https://git.rz.tu-bs.de/irmb/virtualfluids -version = 0.1.0 - -[options] -python_requires = >=3.6 diff --git a/setup.py b/setup.py deleted file mode 100644 index 530431b3775970b5222bc87d32bfb407363f95d6..0000000000000000000000000000000000000000 --- a/setup.py +++ /dev/null @@ -1,72 +0,0 @@ -import sys -from pathlib import Path -from typing import List - -import skbuild - -""" -Install python wrapper of Virtual Fluids -install via python: - python setup.py install - set CMAKE Flags via -DBUILD_VF_GPU:BOOL=ON - CMAKE flags have to be separated by -- - example: python setup.py install -- -DBUILD_VF_CPU:BOOL=ON -or install via pip: - pip install . - for pip>21: - set CMAKE Flags via --config-settings "-DBUILD_VF_GPU=ON" - example: pip install . --config-settings="-DBUILD_VF_GPU=ON" - each option has to be passed in individually i.e --config-settings="-DOPT1=ON" --config-settings="-DOPT2=OFF" - for pip <21: - set CMAKE Flags via --global-option ="-DBUILD_VF_GPU=ON" - example: pip install . --global-option="-DBUILD_VF_GPU=ON" -""" - -package_name = "pyfluids" -target = "python_bindings" -src_dir = "pythonbindings" -stub_package = package_name+"-stubs" - -stub_dir = Path(src_dir)/stub_package - - -def add_subfiles(dir_path: Path, suffix: str, root_dir: Path) -> List[str]: - files = [] - for f in dir_path.iterdir(): - if f.is_dir(): - files.extend(add_subfiles(f, suffix, root_dir)) - if f.is_file(): - if f.suffix != suffix: - continue - files.append(str(f.relative_to(root_dir))) - return files - -def add_directory(dir_path: Path, suffix: str): - return add_subfiles(dir_path, suffix, dir_path) - -stub_files = add_directory(stub_dir, ".pyi") - -# hack to get config-args for installation with pip>21 -cmake_args = [] -if "config_args" in locals(): - cmake_args.extend([f"{k}={v}" for k, v in locals()["config_args"].items()]) - -cmake_args += [ - f"-DPython3_ROOT_DIR={Path(sys.prefix)}", - "-DBUILD_VF_PYTHON_BINDINGS=ON", - "-DBUILD_SHARED_LIBS=OFF", - "-DBUILD_VF_DOUBLE_ACCURACY=OFF", - "-DBUILD_VF_UNIT_TESTS:BOOL=OFF", - "-DBUILD_WARNINGS_AS_ERRORS=OFF", - ] - -skbuild.setup( - name=package_name, - packages=[package_name, "pymuparser", "pyfluids-stubs"], - package_dir={"": src_dir}, - cmake_args=cmake_args, - cmake_install_target=target, - package_data={ "pyfluids": ["py.typed"], - "pyfluids-stubs": stub_files}, - include_package_data=True, -)