Bosonic Qiskit
NQI C2QA project to simulate hybrid boson-qubit systems within QisKit.
Installation
Virtual Environment
It is recommended to install bosonic-qiskit in a virtual environment:
python3 -m venv venv
source venv/bin/activate
PyPi Installation
The easiest way to install bosonic-qiskit is through PyPi:
pip install bosonic-qiskit
Development
Source code installation of bosonic-qiskit for development is possible with the install-dependencies.sh convenience script:
git clone https://github.com/C2QA/bosonic-qiskit.git
cd bosonic-qiskit
./install-dependencies.sh
The above script does the following:
- Creates a virtual environment with the name
venvand activates it. - The bosonic-qiskit library is installed in editable mode with developer requirements from
requirements_dev.txtwhich include tools such asflake8,black, andpre-committo aid in satisfying code style and format requirements. - The tool
pre-commitis installed which automatically runsflake8andblackupon thegit commitcommand.
Code Style Requirements
Any changes or additions to bosonic-qiskit must be black and flake8 compliant. These tools can be run manually, however with pre-commit these tools automatically check for code style compliance when commiting code.
If black shows non-compliant code formatting, changes must be be manually made and altered files must be recommitted.
Dependency Version Compatibility
The Bosonic Qiskit software has not been extensively tested with different versions of its dependencies; however, some success has been achieved with both newer and older versions of Qiskit. Do note that some features require newer versions. For example, the noise modelling requires Qiskit v0.34.2+. Using older versions will cause ModuleNotFoundError at runtime.
Tutorials
Jupyter Notebook tutorials can be found in the tutorials folder. JupyterLab is a dependency found in requirements.txt, so after installing and activating the virtual environment, to run the tutorials simply start Jupyter with jupyter lab and then navigate to the desired tutorial.
See our paper presented at IEEE HPEC 2022 on arXiv for more information on using bosonic-qiskit.
How to add gates
The code is structured to separate generation of the operator matrices from creating instances of QisKit Gate.
The first step in adding a new gate is to develop software to build a unitary operator matrix. These matrices must be unitary in order for QisKit to simulate them. Non unitary matrices will fail during simulation. Existing operator matrices are built in the CVOperators class found in operators.py. Included in CVOperators are functions to build the bosonic creation and annihilation operators based on a provided cutoff. The order of the data in your operators must match the order of the qumodes (QisKit qubits) sent in as QisKit gate parameters found in circuit.py, as described next.
Once you've written software to build the operator matrix, a new function is added to the CVCircuit class found in circuit.py. This class extends the QisKit QuantumCircuit class to add the bosonic gates available in this library. The previously defined operators are parameterized by user input, as needed, and appended to the QuantumCircuit as unitary gates. The CVCircuit class includes functions to easily make your new gates conditional based on a control qubit.
See examples of software building new gates in the previously mentioned operators.py and circuit.py. Examples using the library's gates can be found in both the PyTest test cases and Jupyter Notebook tutorials folders
Available Gates
Current gates available for simulation are documented at https://c2qa.github.io/bosonic-qiskit/bosonic_qiskit.CVCircuit.html
Metadata
Release files for bosonic-qiskit 15.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bosonic_qiskit-15.1.tar.gz | 57.3 kB | With provenance | Details for bosonic_qiskit-15.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bosonic_qiskit-15.1-py3-none-any.whl | Python 3 | none | any | Details for bosonic_qiskit-15.1-py3-none-any.whl |
Total release size: 101.1 kB
Release files / bosonic_qiskit-15.1.tar.gz
| Download URL | bosonic_qiskit-15.1.tar.gz |
|---|---|
| Size | 57.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8110f71d43f98700fd174cbe9dfee5c15c3a074d0e018dc5605918d95cec12af
|
|
BLAKE2b-256 checksum How to use checksums |
24d5956719f86026bf6f3f0569c7bc4ef76c19ba82331547fdaf58b861162c75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Dec 9, 2025.
Transparency logRelease files / bosonic_qiskit-15.1-py3-none-any.whl
| Download URL | bosonic_qiskit-15.1-py3-none-any.whl |
|---|---|
| Size | 43.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25eeb9eecacb8e9d600d19031b0500c440268097612a34b44913854812db6b60
|
|
BLAKE2b-256 checksum How to use checksums |
dfa589fb87a76015826be47eaac0377e1467f98faa4ce308e79206b951d6c81d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Dec 9, 2025.
Transparency logSecurity for bosonic-qiskit 15.1
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for bosonic_qiskit-15.1.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 Dec 9, 2025.
Transparency logA 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.