-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathpyproject.toml
More file actions
330 lines (312 loc) · 11.7 KB
/
Copy pathpyproject.toml
File metadata and controls
330 lines (312 loc) · 11.7 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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
[build-system]
requires = ["setuptools>=68.0"]
build-backend = "setuptools.build_meta"
[project]
name = "amazon-braket-sdk"
dynamic = ["version"]
description = "An open source library for interacting with quantum computing devices on Amazon Braket"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">= 3.11"
authors = [{ name = "Amazon Web Services" }]
keywords = ["Amazon", "AWS", "Quantum"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"amazon-braket-schemas>=1.30.0",
"amazon-braket-default-simulator>=1.32.0",
"oqpy~=0.3.7",
"backoff",
"boltons",
"boto3>=1.28.53",
# SageMaker pinned cloudpickle==2.2.1
# see https://github.com/aws/sagemaker-python-sdk/issues/4871
"cloudpickle==2.2.1",
"nest-asyncio",
"networkx",
"numpy",
"openpulse",
"openqasm3",
"sympy",
]
[project.optional-dependencies]
test = [
"botocore",
"jsonschema==3.2.0",
"pytest",
"pytest-cov",
# https://github.com/pytest-dev/pytest-rerunfailures/issues/302
"pytest-rerunfailures<16.0",
"pytest-xdist[psutil]",
]
type-check = [
"mypy==2.3.0",
# numpy>=2.5 stubs use PEP 695 syntax, unsupported on Python 3.11
"numpy==2.4.6",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
"sphinxcontrib-apidoc",
"sphinx-autodoc-typehints",
]
[project.urls]
Homepage = "https://github.com/amazon-braket/amazon-braket-sdk-python"
[tool.setuptools.dynamic]
version = { attr = "braket._sdk._version.__version__" }
[tool.setuptools.packages.find]
where = ["src"]
exclude = ["test"]
[tool.setuptools.package-data]
"*" = ["*.json"]
[tool.coverage.run]
parallel = true
branch = true
source = ["src"]
omit = [
"**/braket/ir/*",
"**/braket/device_schema/*",
"**/braket/schema_common/*",
"**/braket/task_result/*",
"**/braket/simulator/*",
"*/site-packages/braket/*",
]
[tool.coverage.paths]
source = ["src", "*/site-packages/braket"]
[tool.coverage.report]
show_missing = true
ignore_errors = true
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"if TYPE_CHECKING:",
]
[tool.coverage.html]
directory = "build/coverage"
[tool.coverage.xml]
output = "build/coverage/coverage.xml"
[tool.pytest.ini_options]
xfail_strict = true
# https://pytest-xdist.readthedocs.io/en/latest/known-limitations.html
addopts = "--verbose -n logical --durations=0 --durations-min=1 --dist worksteal"
testpaths = ["test/unit_tests"]
# Issue #557 in `pytest-cov` (currently v4.x) has not moved for a while now,
# but once a resolution has been adopted we can drop this "ignore".
# Ref: https://github.com/pytest-dev/pytest-cov/issues/557
filterwarnings = [
"ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning",
]
norecursedirs = [
".tox",
".git",
"*/migrations/*",
"*/static/*",
"docs",
"venv",
"*/{{cookiecutter.project_slug}}/*",
]
[tool.ruff]
target-version = "py311"
line-length = 100
format.preview = true
format.docstring-code-line-length = 100
format.docstring-code-format = true
lint.select = ["ALL"]
lint.ignore = [
"A001", "A002", # This will be refactored out later
"ANN202", "ARG001", "ARG002", # TODO after onboarding
"ANN002", # Missing type annotation for `*args` in method
"ANN003", # Missing type annotation for `**kwargs` in method
"ANN204", # Special functions don't need return types
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `arg`
"B008", # Logger definition rework
"B026", # Accepted pattern to unpack after keyword args
"BLE001", # This needs to be cleaned up later.
"COM812", # conflicts with formatter
"CPY", # No copyright header
"D", # ignore documentation for now
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"DOC201", # no restructuredtext support yet
"DOC502", # Exceptions are documented in top level functions and not in the private methods
"DOC501", # broken with sphinx docs
"EM", # error string messages are fine
"ERA001", # This is used to capture math
"FBT", # Booleans in methods are fine
"FIX", # Allow TODO statements for now.
"FURB101", # Same as PTH
"FURB103", # Same as PTH
"G004", # Let f strings in logger
"INP001", # no implicit namespaces here
"ISC001", # conflicts with formatter
"N802", # Function names are set now
"N803", # Allow uppercase
"N806", # Vars will break this rule based on technical names.
"N815", # Allowing reviewers to do a per case basis
"PLC2701", # Allow private function access in code
"PLR0904", # Too many public methods
"PLR0911", # Too many return statements
"PLR0913", # Too many variables in function
"PLR0914", # Too many local variables
"PLR0917", # Too many positional arguments
"PLR6301", # Ignore for dispatch functions
"PLR2004", # Allow magic values
"PLW1510", # Subprocess implicitly uses this
"PLW0603", # Allow usage of global vars
"PLW1641", # Object with equal and not __hash__
"PTH", # Prefer builtin path
"PYI034", # Return class type hint here instead of self
"RUF105", # Preview rule; keep standard `# noqa`, not ruff-only `ruff:ignore`
"S104", # Possible binding to all interfaces
"S403", # Pickle is used
"S404", # Using subprocess is alright.
"S603", # Using subprocess is alright.
"S607", # Partial path
"SLF", # Private methods are allowed for access
"T201", # Print statements are used in some places. Later this should be moved inline.
"TCH", # This is good to look into later on. TODO
"TD", # Allow TODO Statements
"TRY003", # Longer messages are fine.
]
lint.per-file-ignores."test/**/*.py" = [
"D", # don't care about documentation in tests
"FBT", # don't care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
"S101", # asserts allowed in tests...
"S603", # `subprocess` call: check for execution of untrusted input
]
lint.isort = { known-first-party = ["amazon-braket-sdk", "tests"] }
lint.preview = true
lint.pyupgrade.keep-runtime-typing = true
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-annotations]
mypy-init-return = false
[tool.ruff.lint.flake8-builtins]
builtins-allowed-modules = ["operator"]
[tool.mypy]
python_version = "3.11"
mypy_path = "src"
files = ["src/braket"]
namespace_packages = true
explicit_package_bases = true
ignore_missing_imports = true
warn_redundant_casts = true
warn_unused_configs = true
# The modules below have pre-existing type errors and are temporarily exempted.
# Burn the list down over time (fix a module, then remove it here); don't add new
# modules — new code must type-check.
[[tool.mypy.overrides]]
module = [
"braket.ahs.analog_hamiltonian_simulation",
"braket.ahs.atom_arrangement",
"braket.ahs.canvas",
"braket.ahs.driving_field",
"braket.ahs.field",
"braket.ahs.local_detuning",
"braket.ahs.pattern",
"braket.aws.aws_device",
"braket.aws.aws_quantum_job",
"braket.aws.aws_quantum_task_batch",
"braket.aws.aws_quantum_task",
"braket.aws.aws_session",
"braket.circuits.angled_gate",
"braket.circuits.basis_state",
"braket.circuits.braket_program_context",
"braket.circuits.circuit_helpers",
"braket.circuits.circuit",
"braket.circuits.compiler_directive",
"braket.circuits.compiler_directives",
"braket.circuits.gate_calibrations",
"braket.circuits.gate",
"braket.circuits.gates",
"braket.circuits.instruction",
"braket.circuits.measure",
"braket.circuits.moments",
"braket.circuits.noise_helpers",
"braket.circuits.noise_model.circuit_instruction_criteria",
"braket.circuits.noise_model.criteria_input_parsing",
"braket.circuits.noise_model.criteria",
"braket.circuits.noise_model.gate_criteria",
"braket.circuits.noise_model.noise_model",
"braket.circuits.noise_model.observable_criteria",
"braket.circuits.noise_model.qubit_initialization_criteria",
"braket.circuits.noise",
"braket.circuits.noises",
"braket.circuits.observable",
"braket.circuits.observables",
"braket.circuits.quantum_operator",
"braket.circuits.result_type",
"braket.circuits.result_types",
"braket.circuits.text_diagram_builders.ascii_circuit_diagram",
"braket.circuits.text_diagram_builders.text_circuit_diagram_utils",
"braket.circuits.text_diagram_builders.text_circuit_diagram",
"braket.circuits.text_diagram_builders.unicode_circuit_diagram",
"braket.devices.device",
"braket.devices.local_simulator",
"braket.emulation._standardization",
"braket.emulation.device_emulator_properties",
"braket.emulation.emulator",
"braket.emulation.local_emulator",
"braket.emulation.pass_manager",
"braket.emulation.passes._device_emulator_validators",
"braket.emulation.passes.circuit_passes.connectivity_validator",
"braket.emulation.passes.circuit_passes.gate_connectivity_validator",
"braket.emulation.passes.circuit_passes.gate_validator",
"braket.emulation.passes.circuit_passes.measurement_transformation",
"braket.emulation.passes.circuit_passes.not_implemented_validator",
"braket.emulation.passes.circuit_passes.qubit_count_validator",
"braket.emulation.passes.circuit_passes.result_type_validator",
"braket.emulation.passes.circuit_passes.verbatim_transformation",
"braket.emulation.passes.generic.program_set_validator",
"braket.emulation.passes.generic.specification_validator",
"braket.emulation.passes.passes",
"braket.experimental_capabilities.iqm.classical_control",
"braket.jobs.config",
"braket.jobs.environment_variables",
"braket.jobs.hybrid_job",
"braket.jobs.local.local_job_container_setup",
"braket.jobs.local.local_job_container",
"braket.jobs.local.local_job",
"braket.jobs.logs",
"braket.jobs.metrics_data.cwl_insights_metrics_fetcher",
"braket.jobs.metrics_data.definitions",
"braket.jobs.metrics_data.log_metrics_parser",
"braket.jobs.quantum_job_creation",
"braket.parametric.free_parameter_expression",
"braket.parametric.free_parameter",
"braket.program_sets.circuit_binding",
"braket.program_sets.parameter_sets",
"braket.program_sets.program_set",
"braket.pulse.ast.approximation_parser",
"braket.pulse.ast.free_parameters",
"braket.pulse.frame",
"braket.pulse.port",
"braket.pulse.pulse_sequence",
"braket.pulse.waveforms",
"braket.quantum_information.pauli_string",
"braket.quantum_information.pauli_sum",
"braket.tasks.analog_hamiltonian_simulation_quantum_task_result",
"braket.tasks.annealing_quantum_task_result",
"braket.tasks.gate_model_quantum_task_result",
"braket.tasks.local_quantum_task_batch",
"braket.tasks.local_quantum_task",
"braket.tasks.photonic_model_quantum_task_result",
"braket.tasks.program_set_quantum_task_result",
"braket.tasks.quantum_task",
"braket.timings.time_series",
"braket.tracking.pricing",
"braket.tracking.tracker",
"braket.tracking.tracking_context",
]
ignore_errors = true