-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathpyproject.toml
More file actions
257 lines (221 loc) · 6.03 KB
/
Copy pathpyproject.toml
File metadata and controls
257 lines (221 loc) · 6.03 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = 'qualtran'
dynamic = ["version"]
authors = [
{ name = "The Qualtran Developers", email = "qualtran-dev@googlegroups.com" }
]
maintainers = [
{ name = "Google Quantum AI", email = "quantum-oss-maintainers@google.com" }
]
description = "Software for fault-tolerant quantum algorithms research."
readme = "README.md"
requires-python = ">=3.12"
license = { text = "Apache-2.0" }
dependencies = [
# core dependencies
"attrs>=23.2.0",
"cachetools>=5.3",
"typing_extensions>=4.10.0",
"networkx",
"numpy>=1.26,<3.0",
"sympy",
"cirq-core~=1.4",
"fxpmath",
"galois",
# drawing
"notebook",
"nbconvert",
"nbformat",
"pydot",
"ipython",
"matplotlib",
"ipywidgets",
# ui
"dash",
"plotly",
# quimb simulation
"quimb",
# qsharp resource estimator interop
"qsharp",
"qsharp-widgets",
# qref bartiq interop
"qref==0.11.0",
"bartiq==0.12.1",
# pyzx interop
"pyzx",
# Pennylane interop
"pennylane",
# serialization
"protobuf",
# rotation_synthesis
"mpmath",
]
[tool.hatch.version]
path = "qualtran/_version.py"
[dependency-groups]
dev = [
{ include-group = "test"},
{ include-group = "typing"},
{ include-group = "lint"},
{ include-group = "format"},
{ include-group = "doc"},
]
test = [
"pytest",
"pytest-asyncio",
"pytest-cov",
"pytest-xdist",
# test executing notebooks
"ipykernel",
"filelock",
# chemistry resource estimates
"openfermion[resources]",
]
typing = [
"mypy~=1.14",
"mypy-protobuf",
"sympy",
]
lint = [
"ruff~=0.15.0",
# for checking _test.py files
"pytest",
"openfermion[resources]",
# dev tools
"tensorflow-docs",
"sphinx",
"filelock",
"griffe",
"mdit-py-plugins",
]
format = [
"flynt~=0.60",
"black~=26.3.1",
"isort~=5.10.1",
"ruff~=0.15.0",
]
doc = [
"ipywidgets",
"nbconvert",
"nbformat",
"sphinx",
"sphinx-autobuild",
"pydata-sphinx-theme",
"myst-nb",
"tensorflow-docs~=2023.5.24",
"griffe~=1.0",
]
[tool.black]
line-length = 100
skip-string-normalization = true
skip-magic-trailing-comma = true
exclude = "qualtran/protos/*"
target-version = ["py312"]
[tool.ruff]
line-length = 100
target-version = "py312"
exclude = [
"qualtran/protos/*",
"*_pb2.py",
"*.ipynb",
]
# Recursively exclude notebooks and generated protos across all subdirectories
extend-exclude = [
"*.ipynb",
"*_pb2.py",
]
[tool.ruff.lint]
# Preview mode is required for CPY001 (flake8-copyright); explicit-preview-rules limits
# preview behaviors to explicitly selected rules rather than all enabled linters.
preview = true
explicit-preview-rules = true
select = [
"E", # pycodestyle
"F", # pyflakes
# "I", # isort (disabled until we switch formatters)
"W", # pycodestyle warnings
"PL", # pylint
"CPY001", # missing-copyright-notice
]
ignore = [
# From the default ruleset:
"E741", # ambiguous variable name 'l', 'O', or 'I'
"E743", # ambiguous function definition
"E731", # assigning a lambda expression to a variable
# Handled by the formatter
"E501", # line too long (let ruff format handle this)
"W291", # trailing whitespace
"W293", # blank line contains whitespace
# We productively use these
"PLC0415", # import outside top-level
"PLW2901", # loop variable overwritten
"PLC0206", # Extracting value from dictionary without calling .items()
"PLW0406", # Module import itself
# Pylint 'refactor' rules
"PLR0913", # Too many arguments
"PLR0912", # Too many branches
"PLR0915", # Too many statements
"PLR0914", # Too many local variables
"PLR2004", # Magic value used in comparison
"PLR0911", # Too many return statements
"PLR1704", # Redefining argument with the local name
"PLR1714", # Consider merging multiple comparisons
"PLR1730", # replace if with min, max. Can be enabled.
# Might be enabled at some point
"PLR0402" # Prevalent in the rotation_synthesis submodule.
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
# Ruff wants us to redundantly re-export symbols in __init__.py files, but the
# automated fix isn't in the stable release yet.
"F401", # Unused import
]
# Preview mode flags parent module & unused imports in these files
"qualtran/serialization/resolver_dict.py" = ["F401"]
"dev_tools/qualtran_dev_tools/notebook_specs.py" = ["F401"]
[tool.ruff.lint.flake8-copyright]
notice-rgx = '(?i)Copyright (\d{4}|\d{4}-\d{4}|20XX) Google LLC'
min-file-size = 10
[tool.ruff.lint.isort]
order-by-type = false
force-to-top = []
split-on-trailing-comma = false
[tool.ruff.format]
quote-style = "preserve"
skip-magic-trailing-comma = true
[tool.isort]
profile = 'black'
order_by_type = false
line_length = 100
remove_redundant_aliases = true
skip_glob = ["qualtran/protos/*"]
[tool.pytest.ini_options]
filterwarnings = [
'ignore::DeprecationWarning:quimb.linalg.approx_spectral:',
'ignore:.*standard platformdirs.*:DeprecationWarning:jupyter_client.*'
]
# we define classes like TestBloq etc. which pytest tries to collect,
# so if you really want to collect a class as a test use '*TestSuite'.
# (but please stick to the convention of test_* functions)
python_classes = '*TestSuite'
addopts = '--strict-markers'
markers = [
"slow: slow tests.",
"notebook: unit tests that execute a notebook."
]