Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
184 lines (163 loc) · 5.94 KB
/
Copy pathpyproject.toml
File metadata and controls
184 lines (163 loc) · 5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
[build-system]
requires = ["scikit-build-core>=1.0"]
build-backend = "scikit_build_core.build"
[project]
name = "ogs"
dynamic = ["version", "scripts"]
description = "OpenGeoSys Python wheel"
readme = "README.md"
license = { file = "LICENSE.txt" }
authors = [{ email = "info@opengeosys.org" }, { name = "OpenGeoSys Community" }]
requires-python = ">=3.11"
dependencies = []
[project.urls]
homepage = "https://opengeosys.org"
documentation = "https://www.opengeosys.org/docs"
repository = "https://gitlab.opengeosys.org/ogs/ogs"
changelog = "https://gitlab.opengeosys.org/ogs/ogs/-/blob/master/CHANGELOG.md"
[dependency-groups]
dev = ["pytest", "numpy", "lxml", "typing_extensions", "pandas"]
dev-all = [
{ include-group = "dev" },
# Use no-X11 version on Linux:
"gmsh==4.13.1.dev1; platform_system == 'Linux'",
"gmsh>=4.12.0; platform_system != 'Linux'",
"ogstools",
"glaciationBCs @ git+https://github.com/cbsilver/glaciationBCs.git@1a7feb2ce1e019e242fecd8d94d8633474042e97",
]
[tool.uv]
cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true } }]
[tool.uv.sources]
gmsh = { index = "gmsh-nox", marker = "platform_system == 'Linux'" }
[[tool.uv.index]]
name = "gmsh-nox"
url = "https://gmsh.info/python-packages-dev-nox"
explicit = true
[tool.scikit-build]
build-dir = "../build/_skbuild/{wheel_tag}"
cmake.args = ["--preset", "wheel"]
minimum-version = "build-system.requires"
ninja.make-fallback = false
wheel.packages = ["Applications/Python/ogs"]
sdist.exclude = ["Tests/Data", "web"]
sdist.include = ["web/data/versions.json"]
# Needs to be set to the version for which libomp (installed by homebrew) was build.
# Both env variable configurations required (one for build, one for delocate phase).
[tool.scikit-build.env]
MACOSX_DEPLOYMENT_TARGET = { env = "MACOSX_DEPLOYMENT_TARGET", default = "27.2" }
[tool.cibuildwheel.macos]
environment = { MACOSX_DEPLOYMENT_TARGET="27.2" }
[[tool.dynamic-metadata]]
provider = "scikit_build_core.metadata.setuptools_scm"
[[tool.dynamic-metadata]]
provider = { path = "scripts/python/scikit-build-plugins", module = "scripts" }
[tool.setuptools_scm]
write_to = "Applications/Python/_version.py"
write_to_template = '__version__ = "{version}"'
version_scheme = "guess-next-dev"
git_describe_command = 'git describe --dirty --tags --long --match "*[0-9]*" --abbrev=8'
# local_scheme should be node-and-date by default and no-local-version in CI.
# Unfortunately setting via env var does not work.
# See https://github.com/pypa/setuptools_scm/issues/455.
local_scheme = "no-local-version"
[tool.pytest.ini_options]
testpaths = ["Tests"]
python_files = ["test_*.py"]
addopts = "--strict-markers"
markers = [
"performance_test: These tests need an isolated environment such that time measurements are reasonable.",
"ogs_needs_serial_build: These test do not run with an OGS PETSc build.",
]
[tool.cibuildwheel]
archs = "auto64"
build = ["cp3{11,12,13,14}-*"]
skip = ["*musllinux*"]
test-groups = "dev-all"
test-command = "pytest {project}/Tests/Python"
build-verbosity = 1
build-frontend = "build[uv]"
[tool.cibuildwheel.linux]
# On Linux there is no X11 which requires gmsh-nox which comes from a custom
# source which is not respected during cibuildwheel testing. Therefore test
# without ogstools. See
# https://github.com/astral-sh/uv/issues/11989#issuecomment-2702122011
test-groups = "dev"
manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64"
before-all = "dnf install -y epel-release && dnf install -y ccache"
# See https://github.com/NixOS/patchelf/issues/446, wait for patchelf 0.19
# Uninstall first: `pipx install --force` fails in the manylinux image, which
# ships a pre-built patchelf venv that pipx refuses to recreate.
before-build = "pipx uninstall patchelf || true; pipx install 'patchelf<0.17'"
environment-pass = [
"SETUPTOOLS_SCM_LOCAL_SCHEME",
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OGS",
"CPM_SOURCE_CACHE",
"CCACHE_DIR",
"CCACHE_MAXSIZE",
"CMAKE_ARGS",
"OGS_VERSION",
]
[tool.cibuildwheel.linux.config-settings]
"cmake.define.OGS_CPU_ARCHITECTURE" = "sandybridge"
# testrunner does not link in manylinux_x image, there is no python library
"cmake.define.OGS_BUILD_TESTING" = "OFF"
# To prevent
# cc1plus: error: to generate dependencies you must specify either ‘-M’ or ‘-MM’
"cmake.define.CMAKE_CXX_SCAN_FOR_MODULES" = "OFF"
[tool.cibuildwheel.windows]
repair-wheel-command = "python {project}/scripts/python/repair_windows_wheel.py -w {dest_dir} {wheel}"
# maybe this should be moved to CMake logic, i.e. disabling both features on win
[tool.cibuildwheel.windows.config-settings]
"cmake.define.OGS_USE_MFRONT" = "OFF"
"cmake.args" = "-G;Ninja;--preset;wheel"
[tool.ruff]
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
exclude = ["scripts/doc", "*ci-skip*"]
line-length = 80
[tool.ruff.lint]
select = [
"E",
"F",
"W", # flake8
"B",
"B904", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
"NPY", # NumPy specific rules
"PD", # pandas-vet
]
extend-ignore = [
"PLR", # Design related pylint codes
"E501", # Line too long
# RUF005 should be disabled when using numpy, see
# https://github.com/charliermarsh/ruff/issues/2142:
"RUF005",
"PGH004", # blanket-noqa, used for file level exclusions
]
typing-modules = ["mypackage._compat.typing"]
unfixable = [
"T20", # Removes print statements
"F841", # Removes unused variables
]
flake8-unused-arguments.ignore-variadic-names = true
# allow en-dash
allowed-confusables = ["–"]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["T20"]
"*.ipynb" = ["E402"] # Top-level imports