Skip to content

qucat/jcircuit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jcircuit: Jupyter Circuit Designer

Jupyter Notebook widget for creating and exporting quantum circuits using the QuCAT Circuit generator. Built with AnyWidget and esbuild.

Users' Documentation

You can install jcircuit with pip:

pip install jcircuit

Open a Jupyter Notebook and run:

from jcircuit import JCircuitWidget

my_widget = JCircuitWidget()
my_widget

Once you have created your QuCAT circuit, you can click on the Export circuit button. Only then can you view the netlist elements in the Jupyter Notebook with:

my_widget.circuitElements

See example.ipynb.

Developers' Documentation

Overview

This Python Jupyter Notebook widget is built with AnyWidget and uses esbuild to bundle the JavaScript code.

You can change the QuCAT Circuit Generator version in the dependencies section of package.json. This file defines the npm dependencies and the build scripts needed for the JavaScript code.

The JavaScript code is in src/widget.js. This has to be kept in sync with gui-circuit-generator/src/gui/main.js and just enough of gui-circuit-generator/src/gui/gui.html, converted to JavaScript.

The JavaScript build process creates a jcircuit/static directory with the bundled JavaScript code and other static files needed for the widget.

You can change the (Test)PyPI version number in pyproject.toml. This file defines the Python package metadata and dependencies.

The Python code is in jcircuit/__init__.py.

The environment.yml file defines the conda environment with the necessary dependencies for development.

The Python build process creates a Python package in the dist directory, which can be uploaded to TestPyPI or PyPI.

Conda Environment

You can create a conda environment with:

conda env create -y -f environment.yml

Activate the environment with:

conda activate jcircuit

Javascript part

You can create and activate an npm environment with:

nodeenv node_env
# source node_env/bin/activate  # linux
# Windows is more complicated, but these 2 lines should work:
export NODE_VIRTUAL_ENV=${PWD}/node_env
export PATH=${NODE_VIRTUAL_ENV}/Scripts:${PATH}

Install the npm dependencies with:

npm install

Build the Javascript module with:

npm run build

Python part

Build the Python package with:

python -m build

Upload to TestPyPI with:

python -m twine upload --repository testpypi dist/*

Upload to PyPI (production) with:

python -m twine upload dist/*

About

JupyterLab widget for QuCAT GUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published