Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Tergite

PyPI version license CI PyPI pyversions

The SDK in the Tergite software stack for connecting to the Swedish quantum computer.

It includes:

This project is developed by a core group of collaborators. Chalmers Next Labs AB (CNL) takes on the role of managing and maintaining this project.

Version Control

The tergite stack is developed on a separate version control system and mirrored on Github. If you are reading this on GitHub, then you are looking at a mirror: its pull requests and issues are not read. Please get in touch via email contact.quantum@chalmersnextlabs.se instead.

Installation

Install using pip

pip install tergite

For pulse-level jobs written with oqpy, and a backend's frames as oqpy frames, install the pulse extra:

pip install 'tergite[pulse]'

Dependencies

Provider Setup

  • Ensure you have Python 3.13+ installed.

  • Create an account with QAL 9000 if you haven't already. (Or you can have your own tergite Frontend running)

  • With the credentials received from Tergite, create and save a provider account by calling Tergite.use_provider_account(..., save=True).

from tergite import Tergite

provider = Tergite.use_provider_account(
    service_name="MY_SERVICE_NAME",
    url="https://api.qal9000.se",  # or the URL to your own tergite MSS,
    token="MY_API_TOKEN",
    save=True,
)

The code above stores your credentials in a configuration file called tergiterc, located in $HOME/.qiskit folder, $HOME being your home directory. Your token is stored in plain text, in a file only you can read (mode 600).

Once saved, you can retrieve this particular account using the SERVICE_NAME from anywhere in your code. From the provider, you can retrieve any backend you wish by name.

provider = Tergite.get_provider(service_name="MY_SERVICE_NAME")

# display list of backends
print(provider.backends())

# access the 'Loke' backend
backend = provider.get_backend("Loke")

Create a Throw-away Provider Account

  • Alternatively, you can create a provider account that won't be saved. This is useful in things like automated tests. Just call the Tergite.use_provider_account(account) without the save option.
from tergite import Tergite

# the account from before
provider = Tergite.use_provider_account( 
    service_name="MY_SERVICE_NAME",
    url="https://api.qal9000.se",  # or the URL to your own tergite MSS
    token="MY_API_TOKEN",
)

Use an Account from the Environment

  • Or set the environment variables TERGITE_API_URL and TERGITE_API_TOKEN, as Qiskit's IBM provider reads QISKIT_IBM_URL and QISKIT_IBM_TOKEN. They make an account named env, which is never saved, and which Tergite.get_provider() returns ahead of any saved account.
export TERGITE_API_URL="https://api.qal9000.se"
export TERGITE_API_TOKEN="MY_API_TOKEN"
from tergite import Tergite

provider = Tergite.get_provider()

On a Shared Computer

On a computer whose login others use too, such as a lab's guest account, anyone using that login can read a saved token and run jobs with it: Tergite.get_provider() would even pick it for them. There:

  • do not save your account: use a throw-away account or the environment variables above;
  • use an app token with a short lifespan, made for the session, and delete it in the dashboard when you are done.

Running Circuits

A backend runs circuits transpiled to it: transpile(circuit, backend) maps them to the device's qubits and to the gates its calibration provides, and backend.run() refuses a circuit with any other gate. The backend compiles each circuit to pulses from its latest calibration.

from qiskit import QuantumCircuit, transpile

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])

job = backend.run(transpile(qc, backend), shots=1000)
print(job.result().get_counts())

backend.run() takes a circuit or a list of circuits, run as one job, and these options, which backend.set_options() sets for every job:

Option Default Values
shots 2000 the shots of each circuit
meas_level 2 2 for counts, 1 for each shot's IQ points (job.result().get_memory())
meas_return "single" at meas_level=1, "single" for each shot's points or "avg" for their average

Pulse schedules are no longer accepted, as Qiskit 2 has no qiskit.pulse: pulses are written in OpenQASM 3's OpenPulse instead, below. OpenPulseBackend and OpenQASMBackend are deprecated names of TergiteBackend.

Running Pulses

A project an admin has allowed pulse-level jobs, in the dashboard, may send pulses to a device that takes them, within the limits its operators set. They are OpenPulse, written by hand or with oqpy, on the frames the device publishes, e.g. q00_drive, q00_readout and q00_q01_coupler; the backend checks each against the device's limits and refuses it with the reason.

backend.frames gives those frames as oqpy frames, by name, and backend.calibrations the defcals of the device's gates, by gate and physical qubits, which play exactly what the gates do:

import oqpy

frames = backend.frames
print(backend.calibrations[("x", (0,))])   # defcal x $0 { ... }

backend.run(circuits, calibrations=[...]) runs a job's gates with defcals of its own, as text or an oqpy program, e.g. a gentler x on qubit 0:

defcals = oqpy.Program()
gaussian = oqpy.declare_waveform_generator(
    "gaussian", [("amp", oqpy.complex128), ("d", oqpy.duration), ("sigma", oqpy.duration)]
)
with oqpy.defcal(defcals, oqpy.PhysicalQubits[0], "x"):
    defcals.play(frames["q00_drive"], gaussian(0.15, 40e-9, 10e-9))

job = backend.run(transpile(qc, backend), calibrations=[defcals])

backend.run() also takes programs of their own, as OpenQASM 3 text or an oqpy program, beside circuits; a program's cal blocks play and capture_v1 into classical bits. A job with a program that does not measure runs at meas_level=1, its captures as IQ points, unless given another:

program = oqpy.Program()
constant = oqpy.declare_waveform_generator(
    "constant", [("amp", oqpy.complex128), ("d", oqpy.duration)]
)
capture = oqpy.declare_extern("capture_v1", [("frame", oqpy.frame), ("d", oqpy.duration)], oqpy.bit)
c = oqpy.BitVar(name="c", size=1)
with oqpy.Cal(program):
    program.play(frames["q00_readout"], constant(0.1, 400e-9))
    program.set(c[0], capture(frames["q00_readout"], 400e-9))

job = backend.run(program, shots=1000)
print(job.result().get_memory())          # each shot's IQ point

Migrating from Pulse Schedules

A qiskit.pulse schedule that ran on the previous SDK is written again in oqpy, each channel on the frame of the same name in backend.frames:

Channel Frame
DriveChannel(i) the drive of the i-th qubit by the number in its id, e.g. q00_drive
MeasureChannel(i), AcquireChannel(i) that qubit's readout, e.g. q00_readout
ControlChannel(k) the coupler the device names u{k}, e.g. q00_q01_coupler
# before, with Qiskit 1.x
with pulse.build() as schedule:
    pulse.play(pulse.Drag(40, 0.2, 10, 2.0), pulse.DriveChannel(0))
    pulse.shift_phase(0.5, pulse.DriveChannel(0))
    pulse.acquire(1000, pulse.AcquireChannel(0), pulse.MemorySlot(0))
job = backend.run(schedule)

# now
frames = backend.frames
drag = oqpy.declare_waveform_generator(
    "drag",
    [("amp", oqpy.complex128), ("d", oqpy.duration), ("sigma", oqpy.duration), ("beta", oqpy.float64)],
)
c = oqpy.BitVar(name="c", size=1)
program = oqpy.Program()
with oqpy.Cal(program):
    program.play(frames["q00_drive"], drag(0.2, 40e-9, 10e-9, 2e-9))
    program.shift_phase(frames["q00_drive"], 0.5)
program.measure(oqpy.PhysicalQubits[0], c[0])
job = backend.run(program)
  • Durations are in seconds, not samples: a sample is 1 ns, and a Drag's beta, which qiskit counts in samples, is in seconds too.

  • Waveforms are OpenPulse's constant, gaussian, gaussian_square, drag, sech and sine, or arrays of samples (oqpy.WaveformVar(samples)), which reproduce any qiskit pulse exactly from its get_waveform().samples; qiskit lifts its Gaussians so their ends are zero, OpenPulse's do not.

  • An acquisition becomes measure, with the device's calibrated readout, as above; or, for raw IQ points, a capture_v1 in the cal block, which runs after a readout pulse on the same frame rather than alongside it.

  • A phase or frequency change takes 4 ns of its frame, which qiskit counts as none.

  • examples/scripts/pulse_level.py runs a gate with a defcal of its own and a cal block that captures, and the examples folder has more samples.

Examples and demos

To find out how to use the library, please take a look into the notebooks and scripts inside the examples folder.

ToDo

  • Add docs and doc generation

Contribution Guidelines

If you would like to contribute to tergite, please have a look at our contribution guidelines

Authors

This project is a work of many contributors.

Special credit goes to the authors of this project as seen in the CREDITS file.

ChangeLog

To view the changelog for each version, have a look at the CHANGELOG.md file.

License

Apache 2.0 License

Acknowledgements

This project was sponsored by:

Metadata

Release files for tergite 2026.11.0rc2

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

Source distribution (sdist)

Source distribution for tergite 2026.11.0rc2
File Size Uploaded Provenance Actions
tergite-2026.11.0rc2.tar.gz 209.5 kB Without provenance Details for tergite-2026.11.0rc2.tar.gz

Built distribution (wheel)

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

Total release size: 257.3 kB

Release files / tergite-2026.11.0rc2.tar.gz

Download URL tergite-2026.11.0rc2.tar.gz
Size 209.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8aa92e0bfacf4278f108e4128c6b95a3bd474c0edec1aa0ca624e73206c0848a
BLAKE2b-256 checksum
How to use checksums
850134081554a72597b7f0067063085867bac3d14b21a06b6771d17ac4f08dd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tergite-2026.11.0rc2-py3-none-any.whl

Download URL tergite-2026.11.0rc2-py3-none-any.whl
Size 47.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a60d534208faddcc6fc862a6d987b8fc7fe712882665f4468b5d93a2ae2c3673
BLAKE2b-256 checksum
How to use checksums
cb0e33e3449f4f76bcb7a70159c7ef4ee12c3f2010f22c959e4bfa9004a7d895
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for tergite 2026.11.0rc2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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