qcs 0.27.0

High level interface for running Quil on a QPU
Documentation
[project]
name = "qcs-sdk-python"
version = "0.27.0"
description = "Python interface for the QCS Rust SDK"
authors = [
    { name = "Rigetti QPU Software", email = "qpu-software@rigetti.com" },
]
requires-python = ">=3.10,<4"
readme = "README-py.md"
license = { text = "Apache-2.0" }
classifiers = [
    "Development Status :: 3 - Alpha",
    "License :: OSI Approved :: Apache Software License",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Operating System :: OS Independent",
]
dependencies = [
    "quil>=0.37.1,<0.38.0",
    "qcs-api-client-common>=0.19.0,<0.20.0",
]

[dependency-groups]
dev = [
    "griffe>=2,<=3",
    "black>=24.8.0",
    "opentelemetry-sdk==1.25.0",
    "pytest>=8.1.1",
    "pytest-asyncio>=0.23.6",
    "pytest-mock>=3.14.0",
    "pytest-sugar>=1.0.0",
    "pytest-clarity>=1.0.1",
    "syrupy>=4.0.0",
    "maturin>=1.9.4",
    "numpy>=1.24.1",
    "pdoc>=16.0.0",
    "ruff>=0.3.5",
    "mypy>=1.14.1",
    "pyo3_linter",
]

[tool.maturin]
features = ["python", "pyo3/extension-module"]
bindings = "pyo3"
include = ["README-py.md", "THIRDPARTY.yaml"]
python-source = "python"
module-name = "qcs_sdk._qcs_sdk"
sdist-include = ["README-py.md", "THIRDPARTY.yaml"]
compatibility = "linux"

[tool.uv]
package = false
default-groups = "all"

[tool.uv.sources]
pyo3_linter = { git = "https://github.com/rigetti/rigetti-pyo3.git", branch = "feat-pyo3-linter", subdirectory = "pyo3_linter" }

[tool.pyo3-stub-gen]
# Generate an `__init__.py` for every module with a `reexport_module_members!`
# declaration in `src/python/mod.rs`. Note that this *overwrites* those files on
# every run, so they must not be edited by hand.
generate-init-py = true

[build-system]
requires = ["maturin>=1.9.4,<2.0.0"] # coordinate this with .github/workflows/release-python.yml
build-backend = "maturin"

[tool.black]
line-length = 120
target-version = ['py310', 'py311', 'py312', 'py313']
include = '\.pyi?$'

[tool.pyright]
# This diagnostic is raised when a type stub is found without a corresponding source file. This is
# necessarily the case for a pure Rust pyo3 module, so disabling it.
reportMissingModuleSource = false

[tool.pytest.ini_options]
addopts = [
    "--ignore=scripts",
]

[tool.ruff]
exclude = [
    ".bzr",
    ".direnv",
    ".eggs",
    ".git",
    ".git-rewrite",
    ".hg",
    ".ipynb_checkpoints",
    ".mypy_cache",
    ".nox",
    ".pants.d",
    ".pyenv",
    ".pytest_cache",
    ".pytype",
    ".ruff_cache",
    ".svn",
    ".tox",
    ".venv",
    ".vscode",
    "__pypackages__",
    "_build",
    "buck-out",
    "build",
    "dist",
    "node_modules",
    "site-packages",
    "venv",
]
line-length = 120
indent-width = 4
target-version = "py39"

[tool.ruff.lint]
# Don't lint generated files: the type stubs and the `__init__.py` files that pyo3_stub_gen
# generates alongside them, plus the `_tracing_subscriber` package generated by
# pyo3-tracing-subscriber-build. This is a lint-only exclusion rather than a top-level one so
# that `ruff format` still reaches them; `generate-stubs` formats them after writing them.
exclude = [
    "python/qcs_sdk/**/*.pyi",
    "python/qcs_sdk/**/__init__.py",
]
select = ["D", "E4", "E7", "E9", "F", "I", "B", "S", "W"]
ignore = [
    "E741" # "Ambiguous" variable names like "I" aren't ambiguous in this contex.
]
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.per-file-ignores]
"quil/**/*.py" = [
    "F403", # * imports allowed in extension module glue.
    "D100", # docstrings belong in type stubs
    "D104",
]
"tests_py/**/*.py" = [
    "D",    # docstrings are not enforced in tests
    "S101", # asserts are allowed in tests
    "S301", # we need to test pickling
]
"make_docs.py" = [ "D" ]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.lint.pydocstyle]
convention = "google"