Skip to content

Commit 1bda92b

Browse files
authored
Merge pull request #29 from pymor/scikit-build-core
Use scikit-build-core as build system
2 parents d1778f6 + f28b055 commit 1bda92b

File tree

14 files changed

+170
-2678
lines changed

14 files changed

+170
-2678
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "lib/pybind11"]
2-
path = lib/pybind11
3-
url = https://github.com/pybind/pybind11

.pre-commit-config.yaml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
66
hooks:
7-
- id: trailing-whitespace
8-
- id: check-yaml
9-
- id: check-added-large-files
10-
- id: debug-statements
11-
- repo: https://github.com/psf/black
12-
rev: 22.6.0
7+
- id: trailing-whitespace
8+
- id: check-yaml
9+
- id: check-added-large-files
10+
- id: debug-statements
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.8.6
1313
hooks:
14-
- id: black
15-
- repo: https://github.com/pycqa/flake8
16-
rev: 4.0.1
17-
hooks:
18-
- id: flake8
19-
exclude: "^(versioneer.py|src/pymor_dealii/version.py)"
20-
- repo: https://github.com/pre-commit/mirrors-clang-format
21-
rev: 'v14.0.6'
22-
hooks:
23-
- id: clang-format
24-
exclude: "^lib/pybind11"
14+
- id: ruff
15+
args:
16+
- --fix
17+
- repo: https://github.com/pre-commit/mirrors-clang-format
18+
rev: 'v14.0.6'
19+
hooks:
20+
- id: clang-format
21+
exclude: "^lib/pybind11"

CMakeLists.txt

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
cmake_minimum_required(VERSION 3.2)
1+
cmake_minimum_required(VERSION 3.15)
2+
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
23

3-
# this should only be necessary while the deal setup macro is copied
4-
set(CMAKE_CXX_STANDARD 17 CACHE STRING "")
5-
6-
project(pymor_dealii)
4+
set(PYBIND11_FINDPYTHON ON)
5+
find_package(pybind11 CONFIG REQUIRED)
76

87
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
9-
10-
FIND_PACKAGE(deal.II 9.2
8+
FIND_PACKAGE(deal.II
119
HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
1210
)
1311
IF(NOT ${deal.II_FOUND})
@@ -18,13 +16,5 @@ IF(NOT ${deal.II_FOUND})
1816
)
1917
ENDIF()
2018

21-
# Set a default build configuration if none is specified. 'MinSizeRel' produces the smallest binaries
22-
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
23-
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
24-
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
25-
endif()
26-
# Add a CMake parameter for choosing a desired Python version
27-
set(PYBIND11_PYTHON_VERSION "3" CACHE STRING "Python version to use for compiling the example library")
28-
2919
add_subdirectory(lib)
3020
add_subdirectory(src)

LICENSE

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Copyright (c) 2013, 2014, 2015, Rene Milk, Stephan Rave, Felix Schindler
2-
All rights reserved.
1+
Copyright pyMOR developers and contributors. All rights reserved.
32

43
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
54
following conditions are met:
@@ -16,4 +15,3 @@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PRO
1615
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
1716
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1817
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19-

MANIFEST.in

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
cmake_minimum_required(VERSION 2.8.12)
2-
add_subdirectory(pybind11)
32

43
INCLUDE(dealii_macro)
54
DEAL_II_INITIALIZE_CACHED_VARIABLES()
@@ -10,11 +9,13 @@ pybind11_add_module(pymor_dealii_bindings bindings.cc)
109
# set_target_properties(pymor_dealii_bindings PROPERTIES PREFIX "")
1110

1211
PYMOR_DEAL_II_SETUP_TARGET(pymor_dealii_bindings)
12+
install(TARGETS pymor_dealii_bindings LIBRARY DESTINATION .)
1313

1414
# Create the example library
1515
pybind11_add_module(dealii_elasticity py_elasticity.cc elasticity.cc)
1616
# set_target_properties(dealii_elasticity PROPERTIES PREFIX "")
1717
PYMOR_DEAL_II_SETUP_TARGET(dealii_elasticity)
18+
install(TARGETS dealii_elasticity LIBRARY DESTINATION .)
1819

1920
add_executable(eoc eoc.cc elasticity.cc)
2021
target_compile_options(eoc PUBLIC ${PYBIND11_CPP_STANDARD})

lib/pybind11

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 145 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,146 @@
1-
# This file is autogenerated. Edit dependencies.py instead
1+
[project]
2+
name = "pymor_dealii"
3+
dynamic = ["version"]
4+
description = "pyMOR bindings for deal.II"
5+
readme = "README.md"
6+
authors = [
7+
{name = "pyMOR developers", email = "[email protected]"}
8+
]
9+
maintainers = [
10+
{name = "Stephan Rave", email = "[email protected]"},
11+
]
12+
requires-python = ">=3.9"
13+
dependencies = [
14+
"pymor==2024.2.*"
15+
]
16+
17+
[project.urls]
18+
homepage = "https://pymor.org"
19+
source = "https://github.com/pymor/pymor-deal.II"
20+
tracker = "https://github.com/pymor/pymor-deal.II/issues"
21+
22+
[project.optional-dependencies]
23+
test = [
24+
"pytest",
25+
"pytest-regressions"
26+
]
27+
228
[build-system]
3-
requires = ['setuptools>=49.1', 'wheel', 'packaging']
4-
build-backend = "setuptools.build_meta"
29+
requires = ["scikit-build-core>=0.10", "pybind11"]
30+
build-backend = "scikit_build_core.build"
31+
32+
[tool.scikit-build]
33+
minimum-version = "build-system.requires"
34+
build-dir = "build/{wheel_tag}"
35+
36+
[tool.scikit-build.metadata.version]
37+
provider = "scikit_build_core.metadata.regex"
38+
input = "src/pymor_dealii/__init__.py"
39+
40+
[tool.coverage.run]
41+
source = [
42+
"src/pymor_dealii",
43+
"src/test"
44+
]
45+
omit = [
46+
"src/pymor_dealii/version.py"
47+
]
48+
relative_files = true
49+
50+
[tool.pytest.ini_options]
51+
testpaths = "test"
52+
# python_files = "src/test/*.py"
53+
junit_family = "xunit2"
54+
python_classes = "Test"
55+
56+
[tool.ruff]
57+
src = ["src"] # this makes isort behave nicely
58+
line-length = 120
59+
60+
[tool.ruff.lint]
61+
select = [
62+
"F", # Pyflakes
63+
"W", # pycodestyle warning
64+
"E", # pycodestyle error
65+
"I", # isort
66+
"N", # pep8-naming
67+
"D", # pydocstyle
68+
"UP", # pyupgrade
69+
"YTT", # flake8-2020
70+
"ASYNC", # flake8-async
71+
"B", # flake8-bugbear
72+
"C4", # flake8-comprehensions
73+
"DTZ", # flake8-datetimez
74+
"EXE", # flake8-executable
75+
"ISC", # flake8-implicit-str-concat
76+
"ICN", # flake8-import-conventions
77+
"PT", # flake8-pytest-style
78+
"Q", # flake8-quotes
79+
"RSE", # flake8-raise
80+
"SIM", # flake8-simplify
81+
"TD", # flake8-todos
82+
"PGH", # pygrep-hooks
83+
"RUF", # Ruff-specific rules
84+
"NPY", # NumPy-specific rules
85+
]
86+
ignore = [
87+
"B006", # do not use mutable data structures for argument defaults
88+
"B007", # loop control variable not used within loop body
89+
"B008", # do not perform function call in argument defaults
90+
"B011", # do not `assert False`
91+
"B017", # pytest.raises(Exception) should be considered evil
92+
"B028", # no explicit `stacklevel` keyword argument found
93+
"C408", # unnecessary collection (dict, list, tuple) call
94+
"D100", # missing docstring in public module
95+
"D101", # missing docstring in public class
96+
"D102", # missing docstring in public method
97+
"D103", # missing docstring in public function
98+
"D104", # missing docstring in public package
99+
"D105", # missing docstring in magic method
100+
"D106", # missing docstring in public nested class
101+
"D203", # 1 blank line required before class docstring
102+
"D212", # multi-line docstring summary should start at the first line
103+
"D401", # first line of docstring should be in imperative mood
104+
"D404", # first word of the docstring should not be "This"
105+
"D405", # the linter thinks the argument name 'parameters' is a docstring section
106+
"D407", # same as above
107+
"D410", # same as above
108+
"D411", # same as above
109+
"D414", # same as above
110+
"E402", # module level import not at top of file (due to config.require("PKG") syntax)
111+
"E731", # do not assign a lambda expression, use a def
112+
"E741", # do not use variables named 'l', 'O', or 'I'
113+
"N802", # function name should be lowercase
114+
"N803", # argument name should be lowercase (we use single capital letters everywhere for vectorarrays)
115+
"N806", # same for variables in function
116+
"PT011", # pytest.raises(Exception) is too broad
117+
"PT012", # pytest.raises() block should contain a single simple statement
118+
"PT015", # assertion always fails, replace with `pytest.fail()`
119+
"RUF005", # consider unpacking instead of concatenation
120+
"RUF021", # parenthesize a and b expressions when chaining and and or together, to make the precedence clear
121+
"RUF023", # __slots__ is not sorted
122+
"SIM102", # use a single if statement instead of nested if statements
123+
"SIM103", # return the condition directly
124+
"SIM105", # use contextlib.suppress instead of try-except-pass
125+
"SIM108", # use ternary operator instead of if-else-block
126+
"SIM114", # combine if branches using logical or operator
127+
"SIM116", # use a dictionary instead of consecutive `if` statements
128+
"SIM300", # Yoda conditions
129+
"TD002", # missing author in TODO
130+
"TD003", # missing issue link on the line following this TODO
131+
]
132+
133+
[tool.ruff.lint.flake8-import-conventions]
134+
banned-from = ["numpy.linalg"] # avoids importing similar routines from numpy.linalg and scipy.linalg
135+
136+
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
137+
"scipy.linalg" = "spla"
138+
139+
[tool.ruff.lint.flake8-quotes]
140+
inline-quotes = "single"
141+
142+
[tool.ruff.lint.pycodestyle]
143+
max-doc-length = 100
144+
145+
[tool.ruff.lint.pydocstyle]
146+
convention = "numpy"

setup.cfg

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)