libQasm Python Package
Project description
libQASM: Library to parse cQASM v3.0 files
File organization
For development, see:
include
: public headers.src
: source files.test
: test files.python
: SWIG interface.res
: resource files, for testing.
For build process, continuous integration, and documentation:
conan
: Conan profiles.emscripten
: bindings and test for the emscripten binaries.scripts
: helper scripts used during the build process..github
: GitHub Actions configuration files.doc
: documentation.
Build outputs may go into:
build/<build type>
: the C++ library output files generated by Conan.pybuild
: the Python library output files generated bysetup.py
.
Dependencies
- C++ compiler with C++20 support (gcc 11, clang 14, msvc 17)
CMake
>= 3.12git
Python
3.x pluspip
, with the following package:conan
>= 2.0
ARM specific dependencies
We are having problems when using the zulu-opendjk
Conan package on an ARMv8 architecture.
zulu-openjdk
provides the Java JRE required by the ANTLR generator.
So, for the time being, we are installing Java manually for this platform.
Java JRE
>= 11
Build
This version of libqasm
can only be compiled via the Conan package manager.
You'll need to create a default profile before using it for the first time.
The installation of dependencies, as well as the compilation, can be done in one go.
git clone https://github.com/QuTech-Delft/libqasm.git
cd libqasm
conan profile detect
conan build . -pr:a=conan/profiles/tests-debug -b missing
Notice:
- the
conan profile
command only has to be run only once, and not before every build. - the
conan build
command is buildinglibqasm
in Debug mode with tests using thetests-debug
profile. - the
-b missing
parameter asksconan
to build packages from sources in case it cannot find the binary packages for the current configuration (platform, OS, compiler, build type...).
Build profiles
A group of predefined profiles is provided under the conan/profiles
folder.
They follow the [tests-](debug|release)[-compat]
naming convention. For example:
release
is a Release build without tests and compatibility with the original API.tests-debug-compat
is a Debug build with tests and compatibility enabled.
All the profiles set the C++ standard to 20. All the tests
profiles enable Address Sanitizer.
Build options
Profiles are a shorthand for command line options. The command above could be written as well as:
conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=Debug -o libqasm/*:build_tests=True -o libqasm/*:asan_enabled=True -b missing
These are the list of options that could be specified whether in a profile or in the command line:
libqasm/*:asan_enabled={True,False}
: enables Address Sanitizer.libqasm/*:build_tests={True,False}
: builds tests or not.libqasm/*:build_type={Debug,Release}
: builds in debug or release mode.libqasm/*:shared={True,False}
: builds a shared object library instead of a static library, if applicable.
Install
From Python
Install from the project root directory as follows:
python3 -m pip install --verbose .
You can test if it works by running:
python3 -m pytest
From C++
The CMakeLists.txt
file in the root directory includes install targets:
conan create --version 0.5.2 . -pr=tests-debug -b missing
You can test if it works by doing:
cd test/Debug
ctest -C Debug --output-on-failure
Use from another project
From Python
After installation, you should be able to use the bindings for the original API by just import libQasm
.
The new API doesn't have Python bindings yet.
From C++
The easiest way to use libqasm
in a CMake project is to fetch the library and then link against it.
include(FetchContent)
FetchContent_Declare(cqasm
GIT_REPOSITORY https://github.com/QuTech-Delft/libqasm.git
GIT_TAG "<a given cqasm git tag>"
)
FetchContent_MakeAvailable(cqasm)
target_include_directories(<your target> SYSTEM PRIVATE "${cqasm_SOURCE_DIR}/include")
target_link_libraries(<your target> PUBLIC cqasm)
Note that the following dependency is required for libqasm
to build:
Java JRE
>= 11
The original API headers are not included by default.
To enable those, pass -o libqasm/*:compat=True
as a build option to Conan.
Docker
This tests the library in a container with the bare minimum requirements for libqasm
.
docker build .
Note for Windows users: The above might fail on Windows to the autocrlf transformation that git does. If you are having trouble with this just create new clone of this repository using:
git clone --config core.autocrlf=input git@github.com:QuTech-Delft/libqasm.git
Emscripten
The generation of emscripten binaries has been tested as a cross-compilation from an ubuntu/x64 platform.
conan build . -pr=conan/profiles/emscripten -pr:b=conan/profiles/release -b missing
The output of this build lives in build/Release/emscripten
:
cqasm_emscripten.js
.cqasm_emscripten.wasm
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for libqasm-0.6.5-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebdf826ad1d27530ce05d580abcbd05a46718f72ff466d0958e3c8cd9ccd9da6 |
|
MD5 | 581b2bc90397034f5ef02ea34ec3fbd6 |
|
BLAKE2b-256 | 667f7a7e2df159a37ba1f438cfcd439c4a88f4d8929cb5c7cd4cd0ed1ba01cce |
Hashes for libqasm-0.6.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b61d615e28c1f0a98d2e78742b3fdd35deee0e5c384dc359c56b70ba12b06142 |
|
MD5 | 2dcb635730b5553fd9d18c929c5b40ff |
|
BLAKE2b-256 | 31dfa794b78ff6e14aa1fe9dee5ce64d7343f0b2575c536438db137eee8afc51 |
Hashes for libqasm-0.6.5-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3af5c9340268c55f68d4c811af68beb24bdb055e7e316965eb4eaacfaa64a6a5 |
|
MD5 | f4746dce71e98fcbb15a511d4423b79c |
|
BLAKE2b-256 | 68d7b722affe90e66f774f7345267e04a967c8aa43055d8ecd694257eeee5bfe |
Hashes for libqasm-0.6.5-cp312-cp312-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56d0945bccbcb8054a9cbfef9d54f8eade565b606a0b104d65d1add1a50f87b8 |
|
MD5 | d01c2765a8aa897a21e700ed1c58bf26 |
|
BLAKE2b-256 | fa0970ca1a0bc0661b9ee608c261521eb56df7aa3e3b98d7072a19e0870a47db |
Hashes for libqasm-0.6.5-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 314b34d851a2597b4b16d82c762725beb6e740374d47cd345870f458b4324684 |
|
MD5 | ffe3883b9c830fe53dc96d34f0a79255 |
|
BLAKE2b-256 | 4ef0b8508b82cf1f957dd0a61f9a443f8383d112e488a53d20f023cd0320c068 |
Hashes for libqasm-0.6.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f13c922ce229bc9c990cca058691e3aa538eb26ad1f93291d1129e832a815ea5 |
|
MD5 | e0f1b56e3dffe70f3802e493ec62a443 |
|
BLAKE2b-256 | dffa40ddc61e19304279e856989cd5648ccf912f77314a6a602ae6c5ded29708 |
Hashes for libqasm-0.6.5-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4afe389e4fc0849ba7b6add5e49cd5e459ccc652db9e5730a8c300daceb4a94 |
|
MD5 | fbf794c128cc7b713d5b163cd6c519a5 |
|
BLAKE2b-256 | 9ddaf451bd7e15c2653f2b30e3ea11e48e81961940c7440e9f8d837a523d1df9 |
Hashes for libqasm-0.6.5-cp311-cp311-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d41f1a457d1acfc36a87cdc8b0fc3a1e1e49ea38d0028ae8bac85c7ab8f017b0 |
|
MD5 | c388e2e4bb8ac8b97d3347409949f988 |
|
BLAKE2b-256 | d9ba969c0ef3707d9adca5b7a0f07d97e4cee3b1d7c5e68d0624e058fc795b8b |
Hashes for libqasm-0.6.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38138777814f9d914b6eed8b48899d6e85f0a5194691d5a8ed7e9fdf2aa9d2f2 |
|
MD5 | af4a13b20b53faac16c52d018c6bc6ad |
|
BLAKE2b-256 | 867416d0b269fb69b02f8e2d683efa4bc5de67c56e0959c820a331a7875926a1 |
Hashes for libqasm-0.6.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f47cd551751cbd8f9b76459f387fab56762ca8ce9903ad6625ea1f3fe08af1d0 |
|
MD5 | 7f64147a0d0fdd33907f6b7fd64d5a93 |
|
BLAKE2b-256 | c30b9a2a5e2c9f820909e5562881bf83a6b5a42eed68d2e1c239dd471d0f0916 |
Hashes for libqasm-0.6.5-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bbb15bf73df98e9e7b6347e959f3863398e04392ab7ab0abfe35ba398afd655 |
|
MD5 | 74a77b9252e5b8600bc10ba327fbe3c4 |
|
BLAKE2b-256 | 2fa22242f3f286bd6cf478c7f92a5534a8b5ccc96f728bfcd39f6aaedf11881b |
Hashes for libqasm-0.6.5-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5446052b2fbc7a912a2fa867754f023b28442275c4c744887cc2523868f168b1 |
|
MD5 | 0d718515343ccfe46ef22c3fa5355b6a |
|
BLAKE2b-256 | bf2f841ca68c40773d3bb27526dcf131b53d8c00b09260d1c2e4eac52f794eff |
Hashes for libqasm-0.6.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9228d794311fa4b08bf432d14a965ba40ecd3c3e266416ddd273219c27606071 |
|
MD5 | fb47878579d923bbaf2b1f171b4c497f |
|
BLAKE2b-256 | 18dc4f39428bb224ebc0715e9c575d63db8e845f6a2f3342c45598e23aebf699 |
Hashes for libqasm-0.6.5-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d817bff81fbf9dc90252c7fbae346577fd329ccd1a2328ae7df811be2e8b93b |
|
MD5 | 8b465e017e4bdb1a6f8360b71ba73050 |
|
BLAKE2b-256 | 4e984b0f90eb5fe90b20d50dd0a67c06b5808780ca599e41066055bff465a3f0 |
Hashes for libqasm-0.6.5-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd1934516ead4de6693bf3bed271ff675a77f2980cd84924c2412f853baacf8d |
|
MD5 | 324579bfe7456a78249546c5db3c718f |
|
BLAKE2b-256 | ee85e6de4de336ad03988db192f571eca69e73aeec3337be3209481a6f06c8f1 |
Hashes for libqasm-0.6.5-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30f5477ea327d4461ab43867fa2d9e806b155f6b14d36c40cda13621cd15692b |
|
MD5 | 7f0aa67e23ce4bd659422eef82bd7614 |
|
BLAKE2b-256 | 8e2e12dfaeb479833b029013956f0179f2770e747d539fcf885add14ef84b1b2 |
Hashes for libqasm-0.6.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 607766991a084a546a57064fb82b2cb6329e8372ec75643f8e7973aaf0dbd189 |
|
MD5 | 526895e786d9c0f4897395705ba87c22 |
|
BLAKE2b-256 | 6f619607c6c9f058f28b19f4cdb05dfb179ce7795caf895729ed31fcce8ee717 |
Hashes for libqasm-0.6.5-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5d655edbe69e405bf5097f292a164554279bc971f8adea00bdaff5d5dfc4261 |
|
MD5 | 924b466d347ea888452c7948b344253c |
|
BLAKE2b-256 | 21c403d6e73c5ac9da5fb60668369fee692c61d6df5c5d2225b179629b3103c8 |
Hashes for libqasm-0.6.5-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5dd8c324579235f751cf62fa52c049bf56516e2b53ebfea0073a3b7399aa552 |
|
MD5 | 98ea3e42a3937f0235514a8b8af7a5bb |
|
BLAKE2b-256 | 0bbf92d45686e539d06d9d88c0b963089b18a27998a59890c0f91c4b4223e6a7 |
Hashes for libqasm-0.6.5-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9661e0cf6edec1550b65239911c243d5c2ca9f43835ae50e59b1cdf4ae2f4782 |
|
MD5 | 2a40bd06e1ef7c9321e9448ba67a04a5 |
|
BLAKE2b-256 | e8ad92b07929d1d0fe4adb1a35c94392ad7a9606eef8de6f1dd9c57acb16814f |