-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathpyproject.toml
More file actions
182 lines (170 loc) · 8.45 KB
/
Copy pathpyproject.toml
File metadata and controls
182 lines (170 loc) · 8.45 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
[build-system]
requires = [
"scikit-build-core >=0.11",
# Pinned exactly: pybind11 controls the type annotations baked into the
# extension, which tools/generate_stubs.py reads to produce the committed
# cytnx/cytnx/*.pyi stubs. A floating version silently rewrites those
# annotations (e.g. 3.0.1 -> 3.0.4 added `typing.SupportsIndex` to integer
# arguments), so the committed stubs only stay reproducible when the
# pybind11 version is fixed. When bumping this pin, regenerate the committed
# stubs in the same PR (see CONTRIBUTING.md, "Regenerating the Python type
# stubs"), and update the pybind11 version string in CMakeLists.txt's
# find_package(pybind11 ...) and the pybind11 pin in the `dev` extra to
# match.
"pybind11 ==3.0.4",
]
build-backend = "scikit_build_core.build"
[project]
dynamic = ["version"]
name = "cytnx"
maintainers = [
{ name = "Kai-Hsin Wu", email = "kaihsinwu@gmail.com" },
{ name = "Chang-Teng Lin" },
{ name = "Hsu Ke" },
]
description = "A tensor network library"
readme = "Readme.md"
license = "Apache-2.0"
license-files = ["LICENSE"]
# The committed cytnx/cytnx/*.pyi stubs are generated with the lowest
# supported interpreter (this floor) so their syntax stays parseable on every
# version the package supports. When raising this minimum, regenerate the
# stubs with the new floor in the same PR (see CONTRIBUTING.md, "Regenerating
# the Python type stubs"). See also CONTRIBUTING.md for the other places the
# minimum version is declared.
requires-python = ">=3.10"
keywords = ["tensor", "network", "physics"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering :: Mathematics",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
]
dependencies = ["numpy >=1.18", "beartype"]
[project.optional-dependencies]
# Renders Network diagrams via Network.Diagram(); only imported by
# `cytnx/Network_conti.py`, which degrades to a ModuleNotFoundError raised
# at call time (not import time) when this extra isn't installed.
viz = [
"graphviz",
]
# Runtime test runner used by `pytests/`.
test = [
"pytest",
"pytest-cov",
]
# Tooling for collecting C++ coverage from the build directory. Pure
# Python and works against any GCC/Clang-produced .gcno/.gcda pair.
coverage = [
"gcovr",
]
# Convenience aggregate for contributors and CI:
# pip install --editable .[dev]
# pulls everything needed to build, run the test suite, collect both
# Python and C++ coverage, and regenerate the committed PEP 561 type
# stubs with `tools/generate_stubs.py`. The isolated wheel build gets
# scikit-build-core and pybind11 from `[build-system].requires`; pybind11 is
# also listed below so it is present for CMake builds run outside that
# isolation.
dev = [
"cytnx[viz]",
"cytnx[test]",
"cytnx[coverage]",
# Must match the pybind11 version pinned in [build-system].requires above.
"pybind11 ==3.0.4",
# Pinned exactly, alongside pybind11 above: pybind11-stubgen is the tool
# that walks the built extension and renders cytnx/cytnx/*.pyi, so a
# floating version can reformat the committed stubs on an unrelated
# regen (new enum handling, changed overload ordering, etc.). When bumping
# this pin, regenerate the committed stubs in the same PR (see
# CONTRIBUTING.md, "Regenerating the Python type stubs").
"pybind11-stubgen ==2.5.5",
# Validates the committed stubs against the runtime module (see
# CONTRIBUTING.md's stub regeneration section); not itself version-locked
# since it only reads/reports and does not affect the stubs' content.
"mypy",
]
docs = [
"sphinx>=7.4.7",
"sphinxcontrib-bibtex>=2.6.2",
"sphinxcontrib-jquery>=4.1",
"sphinxbootstrap4theme>=0.6.0",
"furo>=2024.8.6",
]
[dependency-groups]
# Build / release helpers (e.g. tools/prepare_nightly_release.py,
# which rewrites this file to stamp a nightly version). Declared as a
# PEP 735 dependency-group rather than under
# `[project.optional-dependencies]` because these tools are needed at
# *build pipeline* time only, not at install or run time of cytnx
# itself. `pip install --group release-tools` installs the listed
# packages without invoking scikit-build-core to compile the project,
# which `pip install .[release-tools]` would have forced.
release-tools = ["tomlkit"]
[project.urls]
Documentation = "https://cytnx-dev.github.io/Cytnx/"
Repository = "https://github.com/Cytnx-dev/Cytnx.git"
Issues = "https://github.com/Cytnx-dev/Cytnx/issues"
[tool.scikit-build]
minimum-version = "0.11"
wheel.packages = ["cytnx"]
cmake.args = [
# Use the default preset defined in CMakePresets.json
"--preset=openblas-cpu",
]
# Only install the "libraries" CMake COMPONENT (the compiled pycytnx
# extension module and the small runtime .tmp files cytnx/__init__.py reads)
# into the wheel. This skips the "Development"/"headers" components - the
# static libraries, C++ headers, and CMake export files - none of which
# the installed Python package uses. Those C++-consumer artifacts remain
# available through a plain `cmake --install` (see
# ci-downstream-find-package.yml), which performs an unfiltered install
# of every component.
install.components = ["libraries"]
[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
input = "version.cmake"
regex = '''
set\(\w+?VERSION_MAJOR\s+(?P<major>\d+)\)
set\(\w+?VERSION_MINOR\s+(?P<minor>\d+)\)
set\(\w+?VERSION_PATCH\s+(?P<patch>\d+)\)
'''
result = "{major}.{minor}.{patch}"
[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux_2_28"
before-build = "python ./tools/cibuildwheel_before_build.py"
[tool.cibuildwheel.config-settings]
"build-dir" = "build"
[tool.cibuildwheel.linux]
before-all = "bash ./tools/cibuildwheel_before_all.sh"
# CMAKE_PREFIX_PATH/LD_LIBRARY_PATH point at the conda-forge environment
# tools/cibuildwheel_before_all.sh creates on manylinux; musllinux still
# installs boost/openblas/arpack system-wide via apk, so both paths are
# simply unused (and harmless) there. CMAKE_INCLUDE_PATH stays pointed at
# EPEL's openblas-devel layout for the musllinux/apk fallback path -- Alpine's
# own openblas-dev headers were never confirmed to need it, but removing it
# is unverified and this is a no-op wherever it isn't needed.
environment = { CMAKE_PREFIX_PATH = "/opt/cytnx-deps", LD_LIBRARY_PATH = "/opt/cytnx-deps/lib", CMAKE_INCLUDE_PATH = "/usr/include/openblas", CCACHE_DEBUG = "true", CCACHE_DEBUGLEVEL = "1", CCACHE_LOGFILE = "/tmp/cytnx-ccache.log" }
# SKBUILD_CMAKE_DEFINE carries the per-architecture HPTT ISA option the
# release workflows set (see release_pypi.yml); it has to cross into the
# manylinux/musllinux container, where the wheel is actually configured.
environment-pass = ["CMAKE_C_COMPILER_LAUNCHER", "CMAKE_CXX_COMPILER_LAUNCHER", "CMAKE_CUDA_COMPILER_LAUNCHER", "CCACHE_COMPILERCHECK", "CCACHE_MAXSIZE", "CCACHE_DIR", "CCACHE_BASEDIR", "CCACHE_DEBUG", "CCACHE_DEBUGLEVEL", "CCACHE_LOGFILE", "CYTNX_VERSION_TAG", "SKBUILD_CMAKE_DEFINE"]
[tool.cibuildwheel.macos]
before-all = "bash ./tools/cibuildwheel_before_all_macos.sh"
# `/tmp/cytnx-deps` and `/tmp/cytnx-build-tools` are the fixed prefixes
# tools/cibuildwheel_before_all_macos.sh installs conda-forge's
# arpack/openblas/boost/llvm-openmp and ccache into, respectively (rather
# than Homebrew's) -- kept in separate prefixes (see that script for why)
# and referenced here as plain literals, no discovery step needed.
#
# `.cibw_macos_deployment_target.txt` is generated by that same script,
# probing the installed dylibs' minos. MACOSX_DEPLOYMENT_TARGET reads it
# back through a file (rather than a literal, since the value is only known
# after that probing step) via a Path.exists() check, not a bare `cat`:
# cibuildwheel evaluates this whole table -- including to build before-all's
# own subprocess environment -- before before-all has run and created the
# file at all, and `cat` on a missing file exits non-zero and aborts the
# before-all step outright.
# Keep compiler selection stable across Python versions for reproducible builds and better ccache reuse.
environment = { CC = "clang", CXX = "clang++", CMAKE_PREFIX_PATH = "/tmp/cytnx-deps", PATH = "/tmp/cytnx-build-tools/bin:$PATH", MACOSX_DEPLOYMENT_TARGET = "$(python -c 'from pathlib import Path; p=Path(\".cibw_macos_deployment_target.txt\"); print(p.read_text().strip() if p.exists() else \"10.9\")')", CCACHE_DEBUG = "true", CCACHE_DEBUGLEVEL = "1", CCACHE_LOGFILE = "/tmp/cytnx-ccache.log" }