Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VirtualFluids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iRMB
VirtualFluids
Commits
ee0e63cf
Commit
ee0e63cf
authored
1 year ago
by
Hkorb
Browse files
Options
Downloads
Patches
Plain Diff
switch to skbuild-core for python build
parent
bbf614ed
No related branches found
No related tags found
1 merge request
!246
Refactor python bindings
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitlab-ci.yml
+4
-7
4 additions, 7 deletions
.gitlab-ci.yml
MANIFEST.in
+1
-1
1 addition, 1 deletion
MANIFEST.in
pyproject.toml
+44
-7
44 additions, 7 deletions
pyproject.toml
setup.cfg
+0
-11
0 additions, 11 deletions
setup.cfg
setup.py
+0
-72
0 additions, 72 deletions
setup.py
with
49 additions
and
98 deletions
.gitlab-ci.yml
+
4
−
7
View file @
ee0e63cf
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
MANIFEST.in
+
1
−
1
View file @
ee0e63cf
include pythonbindings/*/bindings*
\ No newline at end of file
include pythonbindings/*/*.cpython*
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pyproject.toml
+
44
−
7
View file @
ee0e63cf
[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"
This diff is collapsed.
Click to expand it.
setup.cfg
deleted
100644 → 0
+
0
−
11
View file @
bbf614ed
[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
This diff is collapsed.
Click to expand it.
setup.py
deleted
100644 → 0
+
0
−
72
View file @
bbf614ed
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
,
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment