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.3-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bd8ffe1cecf1dd0b11d3cec1562f5bffcf7d2f832a99e19411dc18d75186bba |
|
MD5 | 1d874340d07b95d39a4831c474f2ebb0 |
|
BLAKE2b-256 | 9f7a8e294361218dbe45ce32af46e408496b3dba29091107359840e7ef3a62dc |
Hashes for libqasm-0.6.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dd988a9e6da3f43b75f22b8cd7fb7812dcf8bf6f7b16b09f68f201692578566 |
|
MD5 | c438e1ed2a626a0c4d2021302b5004fc |
|
BLAKE2b-256 | 03f1732d70d8f71b7ddb0759a66c9ca4abf397af4a2a68634476aa145c894c93 |
Hashes for libqasm-0.6.3-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea74096877fcacaf181f99cd03d8f7333b2ec77c03fe8357e68392a587d2caaa |
|
MD5 | d4cb24625066beebc6cd75a58e479b3a |
|
BLAKE2b-256 | 4ca3de3bd945d54ead2cf70973ebb010b8e89c60defc4761fb2c56c4033ff8c3 |
Hashes for libqasm-0.6.3-cp312-cp312-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c3b4cbc18789a742108e20af590e0acd1535c3c31153a52c685f82ef9bc4bf9 |
|
MD5 | c1ab8778c06f23634a0f3dd7fed3dc19 |
|
BLAKE2b-256 | a94352c9b2d49af1d415e1886a4c2463b2b141c7222aea2aa6d13bcc62639251 |
Hashes for libqasm-0.6.3-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 328039857c4a05062b5b80ab4e11c70a914aac94f5a9e0161b8681fec14b0835 |
|
MD5 | d4e13591bd092c703ee5931e2eadac65 |
|
BLAKE2b-256 | e93a3e5ee98ca3d7d06c1e6a5bde79bae75553ba833f7a2ca1afdbf25e0323e1 |
Hashes for libqasm-0.6.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0c51f99b5b22c80a67bddceeaff437b6257aa1d10b37d0ee8aa979d5039a77 |
|
MD5 | 0ee18a4e11417c6b1a030eb419f1b2cb |
|
BLAKE2b-256 | e8964e9755a173ea63990cd0afe989aca8b2d5460e13112427472de501033c8e |
Hashes for libqasm-0.6.3-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8874d9e3d011a61b6708c1b1ae41d96f5c1599ad6ff58c046f7b1873cec2abb9 |
|
MD5 | 6fc47adf57268385d6a3d54cc93f5dc8 |
|
BLAKE2b-256 | 033be5220e0d9ae10b079a5d361696c517af043cbb5e6075bea8be6720804d2b |
Hashes for libqasm-0.6.3-cp311-cp311-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c35a1701b05bd057e92a114b4cd98ffbb0ff41e57affeb7d12313a60eacb9d89 |
|
MD5 | f1b2c92fae681bf932fec31f65b9e4c9 |
|
BLAKE2b-256 | 0f813af7a8d237b1959e171d9728da11da10072dccb3293ae60cf72315dd275c |
Hashes for libqasm-0.6.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64677c8b59492021aecb506c4af2c7f655ae7c45a3dbc5d4c93f1c82d146d05e |
|
MD5 | ff521312983f2b34aa645d6417b42851 |
|
BLAKE2b-256 | c003a32ca5fcf34db8e129bb57428c9a9bfbf42eaea2199a8334065ca9494d9b |
Hashes for libqasm-0.6.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 731d095a721977d938cf4663907b742f699f8a877ab4b0ff97bb9f12c82fc886 |
|
MD5 | b0fc78166cb67a60f48ebd85b35ebe53 |
|
BLAKE2b-256 | 0f80202188cc45443ea2f1c727fec008de2a9da0146a8b8e79360cb3315ed894 |
Hashes for libqasm-0.6.3-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10c76843ddea523ec964bd5b5ad15463b4c9541158c8f44fd05680707149b3b6 |
|
MD5 | a98f97b8813f42b020c1292c10e36452 |
|
BLAKE2b-256 | 1e25bbb203dd736656c3411d404e89259a98cd5d2c4acf54f4a9ac35494b06ef |
Hashes for libqasm-0.6.3-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 429fab60a9c9fa9bfdc5f5873ae45365be28749427542e66d634b236949b2c75 |
|
MD5 | 0b4091d568c62def86d4b003d266760f |
|
BLAKE2b-256 | 2d3e5287ae05d5450aef61617ebcce89fadb95a984bbfaac900f2438884e6e5b |
Hashes for libqasm-0.6.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ddc2c9276788ec70f25ff158d962b8aa58397a51e3b73a60a3c708fcbbb90db |
|
MD5 | 19c1fc6568439fc5a197b1aaa6b7dbda |
|
BLAKE2b-256 | 9dad371c8bcd16988cd5f9847afe39d4ac766b91d27277862bc50c0a46976552 |
Hashes for libqasm-0.6.3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f4c25c09421c86cbda1bbe640ec95c2fd75dd0d5fe2741526e5452120a79814 |
|
MD5 | 012023bbb1da0a0d7bb37b32d7ab7d4e |
|
BLAKE2b-256 | 8bb30b3267b5422d836b163e8d37dccccaaa9fd9f16791d2fddcff53bd95330b |
Hashes for libqasm-0.6.3-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 321896621deb16e2dc71ec425169a4ce6d165a34fc729c09aeaa2b4a91a0630d |
|
MD5 | 5cd68999c37863c88a0277bd5d276daa |
|
BLAKE2b-256 | d13bc8611e372845b4c615843cdd13327f07b1916ce84802d865615277ac4ea5 |
Hashes for libqasm-0.6.3-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b609a573588881b924811967f8e5f3baeed349314d4743eb63c0e580d94f212 |
|
MD5 | cb817dbebd159f427892dd61e92873ad |
|
BLAKE2b-256 | e7e5700db9269a0919f5f3c42b06527e6eea163b6588c0b9d03d61b2708586bc |
Hashes for libqasm-0.6.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d81ea170fef7459e59422e3c6e5d635ec9eb17f99886bf2bc6db0288528897cd |
|
MD5 | ed685e30a943a684e34cd6eb59c497d7 |
|
BLAKE2b-256 | 5075c871576f138ad968cf5b6e2dbb4e76fc26e7770052aa8c73dc42ed5edd50 |
Hashes for libqasm-0.6.3-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b651e790006b8feba30d13470ee3e7e9a989a14e3e2bcfce54453a7c4ef45af9 |
|
MD5 | 702dd275b7277d8c32d518dced24ff73 |
|
BLAKE2b-256 | 1c7c2e8f5e6b12da07501c712bbdae77d586147907c33a57e07eb480a837312c |
Hashes for libqasm-0.6.3-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5c8109cc797b5fd188bfcf2516b12855fe1cb984cb09734270e3e2345b75b18 |
|
MD5 | 9fef03c0855603ddfc59cc3cdd64eee9 |
|
BLAKE2b-256 | efe93cc3d0e8b73267460c1b36d7927059ac4c928a62ccbf5bc5333a0824eeaf |
Hashes for libqasm-0.6.3-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43f6f3f477d209063bdcce02eab2194b7025cda3e0b2a286dd1ad15756e6f9c9 |
|
MD5 | ddca2b5101d57d5b2fc92556d7f9cf5c |
|
BLAKE2b-256 | 5ae04f95e0018f0cafeb3f52da81740d08b39a0141ccd355cce2cd279a5cdd4a |