Skip to main content

PyQit

PyPI Python 3.10+ Status: Active Development Docs Code style: ruff Build Status

PyQit is a quantum machine learning framework built on PennyLane. It puts a Trainer, a DataModule and model classes on top of PennyLane QNodes, so training a variational circuit is a fit call rather than an optimizer loop you write yourself. PyTorch and PyTorch Lightning are optional. Install them and the same code trains through PyTorch Lightning instead of autograd. That is the PyTorch project, not PennyLane's lightning.qubit simulator, which is a device and works on either backend.

Version 0.1.0.

The documentation has the tutorials, the API reference and the design notes. This page is the short version.

Installation

pip install pyqit                 # pennylane and numpy
pip install "pyqit[pytorch]"      # adds torch and pytorch lightning
pip install "pyqit[all_extras]"   # adds matplotlib and rich as well
pip install "pyqit[qiskit]"       # adds the PennyLane-Qiskit plugin

With uv, uv add pyqit or uv pip install "pyqit[pytorch]" takes the same extras. There is no conda package. Inside a conda environment, use pip.

all_extras covers torch, lightning, matplotlib and rich. The Qiskit plugin is not part of it, because it needs Python 3.11 or newer. Install it through the qiskit extra on its own.

Quickstart

from sklearn.datasets import make_moons

import pyqit
from pyqit.ansatzes import SELAnsatz
from pyqit.core import AngleEmbedding
from pyqit.models import VQCClassifier

pyqit.set_seed(42)

X, y = make_moons(n_samples=200, noise=0.1, random_state=0)

# Nothing is split, normalized or prescaled until the Trainer calls setup().
dm = pyqit.DataModule(X, y, normalize="minmax", batch_size=16)

model = VQCClassifier(
    n_qubits=4,
    n_layers=3,
    ansatz=SELAnsatz,
    encoder=AngleEmbedding,
)

trainer = pyqit.Trainer(max_epochs=30, learning_rate=0.05)
history = trainer.fit(model, dm)

print(history.best_epoch, history.best_score)   # 22 0.0947
preds = trainer.predict(model, dm)              # runs on the test split

fit returns a TrainingHistory with one entry per epoch for train and validation loss and accuracy. The model draws its weights and reads the backend in __init__, so seed and pick the backend before you build it.

What is in the box

Each item links to its page in the docs.

  • Backends. pyqit.set_backend("torch") moves training to PyTorch Lightning. Same model, same callbacks, same history. PyTorch Lightning settings go through Trainer(backend_kwargs=...).
  • DataModule. Nothing runs until the Trainer asks. It splits, fits normalization on the train split only, and prescales inputs for the model's embedding.
  • Callbacks. EarlyStopping and ModelCheckpoint work on both backends. Your own is a BaseCallback with up to three methods.
  • Losses. mse, hinge, cross_entropy, or any callable.
  • Barren-plateau check. Trainer(check_bp=True) samples gradients at random weights before training and tells you whether their variance sits above the theoretical floor.
  • Pipelines. QuantumPipeline chains models or runs them as an ensemble.
  • Devices. device= takes any PennyLane device name, plugins included. The PennyLane-Qiskit plugin is tested, and Trainer(verbose=2) prints which differentiation method a device gets.

Tutorials walk through a VQC end to end, callbacks and checkpoints and barren plateaus.

Contributing

Issues and pull requests are welcome. The contributing guide has the conventions.

pip install -e ".[dev,all_extras]"
python -m pytest -n auto
pre-commit run --all-files

Release files for pyqit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyqit 0.1.0
File Size Uploaded
pyqit-0.1.0.tar.gz 95.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyqit 0.1.0
File Interpreter ABI Platform
pyqit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 219.9 kB

Release files / pyqit-0.1.0.tar.gz

Download URL pyqit-0.1.0.tar.gz
Size 95.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f2e72d8b3f7fef037fbc8ea44fa1e693f700c55bfc46b951276bb8e5b617d276
BLAKE2b-256 checksum
How to use checksums
cdb8d74c372f85d535b2c284cb4d4aaa1fe6b20264904ab78eb38fbee1884bca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / pyqit-0.1.0-py3-none-any.whl

Download URL pyqit-0.1.0-py3-none-any.whl
Size 124.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59de010844b1c643324527e12d2ed5a8a41f6f3a184de8d30659ff4dcf4ce81f
BLAKE2b-256 checksum
How to use checksums
5c601b5a5b8e289af5cb7eb10d7829f7713d7ee0d2fae4b93b0ab11be678e990
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page