Skip to main content

PyQit

PyPI Python 3.11+ 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.2.0 is out now!

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

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

pyqit.set_seed(42)

X, y = make_moons(n_samples=200, noise=0.1, seed=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

Metadata

Release files for pyqit 0.2.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.2.0
File Size Uploaded Provenance Actions
pyqit-0.2.0.tar.gz 108.2 kB With provenance Details for pyqit-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 247.8 kB

Release files / pyqit-0.2.0.tar.gz

Download URL pyqit-0.2.0.tar.gz
Size 108.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a70970f5aa9824536481e6d7a5c7f1f2b8b2e25d091cdaf968d0b01ce2eb07b7
BLAKE2b-256 checksum
How to use checksums
d47a53bff7406d626f65748f0943861033d3e1801b45245ebd16daf94d4cc053
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 15, 2026.

Transparency log

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

Download URL pyqit-0.2.0-py3-none-any.whl
Size 139.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db3865e7d8ccf74e66a54aab3d7b0f345c2e3dfdf803a6de2187c4b49d80169a
BLAKE2b-256 checksum
How to use checksums
31d29e75b8341aad82076f6ee80186b48160cef53d147db7bf562abe60a31690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 15, 2026.

Transparency log

Security for pyqit 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyqit-0.2.0.tar.gz

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 Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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