-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathpyproject.toml
More file actions
229 lines (203 loc) · 9.53 KB
/
pyproject.toml
File metadata and controls
229 lines (203 loc) · 9.53 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# NOTE: scikit-build-core doesn't use the root-level CMakeLists.txt file,
# instead we have it use src/python/CMakeLists.txt.
#
# There are 2 reasons for placing this at the root-level directory
# (rather than in src/python):
# 1. it ensures that the source-distribution of our source-directory and the
# SDist we'll eventually distribute via PyPI will have the same structure
# 2. it ensures that gracklepy can be installable by invoking
# pip install gracklepy @ git+https://github.com/grackle-project/grackle
[build-system]
requires=[
"cython",
"cython-cmake>=0.2",
# since tool.scikit-build.minimum-version is set to "build-system.requires",
# the minimum build-requirement for scikit-build-core controls some default
# behaviors when newer versions of scikit-build-core are installed
# (we should keep an eye on this and keep increasing it over time)
"scikit-build-core>=0.10"
]
build-backend = "scikit_build_core.build"
[project]
name = "gracklepy"
description = "A wrapper for the Grackle chemistry library"
readme = "README.rst"
# A simpler project could infer used to infer the version number from git:
# https://scikit-build-core.readthedocs.io/en/latest/configuration.html#dynamic-metadata
# but gracklepy can't (currently) do this since it lives in a "monorepo"
# https://github.com/pypa/setuptools_scm/issues/1056
version = "1.2.1.dev0"
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Astronomy",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Unix",
"Natural Language :: English",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
keywords=[
"simulation", "chemistry", "cooling", "astronomy", "astrophysics"
]
requires-python = ">=3.10"
dependencies = [
'h5py',
'numpy',
'matplotlib',
'yt>=4.0.2'
]
[project.license]
text = "BSD 3-Clause"
[project.urls]
Homepage = 'https://github.com/grackle-project/grackle'
Documentation = 'https://grackle.readthedocs.io/'
Source = 'https://github.com/grackle-project/grackle'
Tracker = 'https://github.com/grackle-project/grackle/issues'
[project.optional-dependencies]
# currently the next line duplicates the dependency-groups purely for
# historical reasons. We should delete the following entry in the near-future
# (since they are actually dependencies of the gracklepy-wheel).
dev = ['flake8', 'packaging', 'pytest', 'sphinx', 'sphinx-tabs', 'furo==2025.9.25']
[dependency-groups]
docs = [
'sphinx',
'sphinx-tabs',
# I think newer versions of furo may be incompatible with sphinx-tabs
# -> an argument could be made for swapping to 'sphinx-inline-tabs',
# which was created by the furo developer
'furo==2025.9.25'
]
test = ['pytest', 'packaging']
dev = ['flake8', {include-group = "docs"}, {include-group = 'test'}]
[tool.pytest.ini_options]
# settings inspired by: learn.scientific-python.org/development/guides/pytest/
# -ra: The -r tells pytest to report extra test summary info on the events
# corresponding to all characters following the r. Here, the "a"
# corresponds to "all" events (other than passing tests)
# --showlocals: directs pytest to show local variables in tracebacks
# --strict-markers: ensures we don't try to use an unspecified fixture
# --string-config: all configuration mistakes are reported as errors
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
# by default, we treat any test marked xfail that doesn't fail as an error
# (we can override this locally, if necessary)
xfail_strict = true
# limit the directories searched by pytests for the test files
testpaths = [
"src/python/tests",
]
[tool.scikit-build]
# redirect to the appropriate CMakeLists.txt file
cmake.source-dir = "./src/python"
# if the version of CMake (in {cmake.source-dir}/CMakeLists.txt) isn't found,
# scikit-build-core will download and use a compatible CMake-verison
cmake.version = "CMakeLists.txt"
# The build type to use when building the project. Valid options are: "Debug",
# "Release", "RelWithDebInfo", "MinSizeRel", "", etc.
cmake.build-type = "Release"
# since this is set, this provides a method for backward compatibility.
minimum-version = "build-system.requires"
# The following are all packaging-related and may require tweaking
# Files to exclude from the SDist (even if they're included by default).
# Supports gitignore syntax.
sdist.exclude = [
# exclude continuous integration:
".circleci", ".readthedocs.yml", ".github",
# exclude files related to creating precompiled wheels
"scripts/wheels",
# exclude data files since we want the sdist to follow the same rules as wheels
# when it comes to data file distribution (for simplicity).
# -> the main value of including the files would be if somebody wanted to download
# the sdist, untar it, and run tests. But, I would argue that they should be
# cloning the git repository for that purpose
# -> this would also make the sdist ~65 times bigger
"input", "grackle_data_files",
# if we aren't including data-files, there's no reason to include gracklepy-tests
# (all meaningful tests will currently fail)
"src/python/tests",
# if we aren't including data-files, there's no reason to include the gracklepy
# code examples (they currently require editable installations)
"src/python/examples",
# for consistency, we exclude the core-library tests and examples
"tests", "src/example",
# exclude miscellaneous classic-build-system machinery
"configure", "src/Makefile", "src/examples/Make*", "src/clib/Make*"
]
# A list of packages to auto-copy into the wheel.
wheel.packages = ["./src/python/gracklepy"]
# A set of patterns to exclude from the wheel. This is additive to the SDist
# exclude patterns.
wheel.exclude = [
# Per the discussion in gh-220, we have decided not to package pyd files
# (at least for right now)
"**.pyd",
# No need to package template files
"**.py.in"
]
[[tool.scikit-build.overrides]]
# we are using scikit-build-core's override-functionality to provide a detailed
# error message when a build from a sdist fails
if.from-sdist = true
# maybe we should move most of this message to the website and provide a link
# to the website
messages.after-failure = """
{bold.red}Your build of gracklepy from a sdist failed.{normal} (You should
ignore the rest of this message if you were explicitly want to install from an
sdist).
For more context:
- The sdist and wheel formats are the 2 modern standardized formats for python
package distribution. At a high-level, both of them handle a package's python
code in a similar manner. The largest differences occurs when packages (like
grackle) have extension modules, written in compiled languages (like C).
1. A sdist (source-distribution) includes the extension modules' source code.
When installing an sdist, your package manager (e.g. pip) directly compiles
the extension module & links it against dependencies, as part of process.
2. A wheel ships a precompiled copy of extension module (& copies of external
dependencies). During installation, your package manager copies the
precompiled extension module & any dependencies to the installation
- Since your package manager tried to install gracklepy from a sdist, that
probably means that a wheel isn't available for your current python version
on the {platform.platform} (with the {platform.machine}). If this is a common
Unix platform, please let the us (the Grackle developers know) and we can
consider adding wheels for this platform in the future.
- Your build probably failed because you are missing a compiler, your compiler
is too old, you are missing a dependency (e.g. hdf5), or the build-system
can't automatically infer some of this info.
- We recommend installing gracklepy directly from the git repository. We provide
detailed instructions on our website (https://grackle.readthedocs.io). If you
encounter further problems, please reach out.
"""
[tool.cibuildwheel]
build = "cp310-* cp311-* cp312-* cp313-*"
skip = ["*_i686", "*_ppc64le", "*_s390x", "*_universal2"]
# we compile high-level hdf5 api purely so we can run the test-command on musllinux
# -> h5py doesn't ship binary-wheels for that platform
# -> depending on how long h5py takes to compile, it may be better to simply use
# test-skip = "*-musllinux*"
before-build = "python {project}/scripts/wheels/cibw_before_build.py --compile-hl-h5 3rdparty {project}"
test-groups = "test" # <- this installs the test dependencies
test-command = "bash {project}/scripts/wheels/cibw_test_command.sh {project}"
[tool.uv]
# uv is an all-in-one python management tool (it can be used in place of a bunch of
# tools such as pip, pyenv, venv, ...). We define the cache-keys setting to instruct uv
# when it should trigger rebuilds, whenever a contributor is using uv to develop
# Grackle/Gracklepy (note: the cache-keys setting has no effect on downstream packages
# that consume Gracklepy)
cache-keys = [
{ git = { commit = true} },
{ file = "pyproject.toml" },
{ file = "CMakeLists.txt" },
{ file = "dependencies.cmake" },
{ file = "VERSION"},
{ file = "cmake/**" },
{ file = "scripts/query_version.py" },
{ file = "src/clib/**" },
{ file = "src/python/CMakeLists.txt" },
{ file = "src/python/gracklepy/*.pyx" },
{ file = "src/python/gracklepy/*.pxd" }
]