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.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11376a9e9af6ecf57444153d05b47ed2c50634754e5d7a7ee94365cc193a7101 |
|
MD5 | 1981da38c251d8d2f635366a3fdbde15 |
|
BLAKE2b-256 | 850928bf5a7cd92625f531df0d181ee2b5ff8f40db66f003c459cc5721dad7af |
Hashes for libqasm-0.6.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9ccbf9568c371f03a8657f2f338cc570c2efda5b33af6edf02cb1c6140c7dd2 |
|
MD5 | 2e81a47efb23fedb2eee54d6eab50782 |
|
BLAKE2b-256 | 2460776e77862630304ffdefe969a2f1c79232b35f65eb13a03ed26457720f66 |
Hashes for libqasm-0.6.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca7a0b0a7dc0017d3aae1b56d1bbc741b2f2687e3bbf9e715678e2bde8907f21 |
|
MD5 | 7cfbd7b4a33d2dce841bdf791f0a0ab7 |
|
BLAKE2b-256 | 37a5b41d20c952ae8f4afdec106f6e01ff808cc05e3d972a5bc1e88fdf5b46a8 |
Hashes for libqasm-0.6.1-cp312-cp312-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 723f632a099bb7a185dc54ea1da903b8134688a83f819d86c640302fdd8f7598 |
|
MD5 | 5584fbcb9066ae0bb7497e4d735e3bd7 |
|
BLAKE2b-256 | b07ea416ca4c0de1a2eddda8efcdd57f4c3acf797db755c210fc4003fc650d65 |
Hashes for libqasm-0.6.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db197524e067707137173230f42995f8d81d0bb92e315762bc9fefafafec836e |
|
MD5 | 96b9248872488516a5b65c41301da5b2 |
|
BLAKE2b-256 | a75c9d7172da77676a7729f1b58d7f6e52f5e052eeb22199d117da375fa1ea5a |
Hashes for libqasm-0.6.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 578b74321ba501be839454ea3144eb887afc2afb5c386fe2987c7aae7b504c2e |
|
MD5 | 995546e8b5f17cf8880aec6a5990cb45 |
|
BLAKE2b-256 | 5e15188276f1cbef3bdcbc0fe26f071d4460563046c1f9ac8d2cea8c89f2a6c1 |
Hashes for libqasm-0.6.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9180038d73189660bd617f3fa5ea071942c767f80b867d1df423cccae5c866d2 |
|
MD5 | 9842c91e6607218c82dc4f5d5c2233a4 |
|
BLAKE2b-256 | 98d59ef89548d6ba221fb2cf3b48121dfc12a4b435b75b6f5a1c07b8c21f8073 |
Hashes for libqasm-0.6.1-cp311-cp311-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b47ab83e62af77dc0c9e3607412931aa3480d4ed24c050d0f1db0fd6f7d999c9 |
|
MD5 | c5e3b2ef588a4c6af7cc9eab45396645 |
|
BLAKE2b-256 | e3268e5c2e602e45497911dc464e5ce62582daf7c27b3e01366266e68785f4a3 |
Hashes for libqasm-0.6.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbf59f60728809a3ce4851aab41d939104fa1911661952da4043c35f78ad3a6e |
|
MD5 | 7b68a4c377e3b4917f4b414ca6203ac7 |
|
BLAKE2b-256 | 2cffb5e479734704711c6cce4e3c8adcaa80cf311ac189b81851603f8bbeb761 |
Hashes for libqasm-0.6.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a978b8bdb979df70418a21c38b6c9f90fdb6c7d727507f06023f12b5feb347a |
|
MD5 | 9eac5dea4bdf78811ba0d55603d18078 |
|
BLAKE2b-256 | 736c9204c9111a75474d6f48c29052536408f5847bcf9924cf2a1ce9d09e7d7e |
Hashes for libqasm-0.6.1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0528e408d6b9b8fd3560f7d619478f3c8245d5f9a03cb38a985c8167e6f6d6df |
|
MD5 | 7b4d6218cab9579b00dc9ed5a6076bb5 |
|
BLAKE2b-256 | de3cd50bec9462da28fe3da1309b7815ca57ce5cadb8d4b20481bf700305770f |
Hashes for libqasm-0.6.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b99b411c6b96e603df9ad1cbe10b6c84647b63cbd65a5d1b9785f4a177b0507c |
|
MD5 | 2be86b6e5ee14c2415786a8b95e2fe60 |
|
BLAKE2b-256 | f8a28888c5de6329c97ce1edd796d4c4f6c3a1bd0ca9cefdd883e4446d94929c |
Hashes for libqasm-0.6.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b218b8c68da59c1acb085a8486f1129b07caa2dbc30cf539156efdc721f15b3f |
|
MD5 | 2aefcefb90bcedf9fbe068ddccaf2382 |
|
BLAKE2b-256 | b94aa40b03f7945de1dffafa0b5fb222f5d88120c7690bfd1a0bc332aeb26155 |
Hashes for libqasm-0.6.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a4a821da74403ab6cd49156fb1272548ade41046b58e2e3f34a5ea9a522d64d |
|
MD5 | 9222d285e3292f7e4108d9b9ff01a5e5 |
|
BLAKE2b-256 | 062ad58d16a25bf72ab8361da33cda1f1bc5cee7a97c49f01340618702b39688 |
Hashes for libqasm-0.6.1-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b7e16cbba16d053b621535310d6aca5ce5b8d4ebed9c2ef50067bdbd66600e0 |
|
MD5 | a9c7a9180c70ae7ca79e696cd5f0aad8 |
|
BLAKE2b-256 | c5c24ade8a118ea2f2b768df91b15f3ba9f7e6de67c2d6410fd57680e8915dd2 |
Hashes for libqasm-0.6.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b044a3226dc8857712cf755ca766d8841fe60c4f72a5df947a353e3f08add728 |
|
MD5 | b852ea7855ac417ac96097b247a37381 |
|
BLAKE2b-256 | e898b933a0bfa757f538ced71b62fe7fa19f95a4861376f07c8b04be794021c4 |
Hashes for libqasm-0.6.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dabca47d08e4bf6e887507650851d57059bb3e0b6c4dbab582c02c4ec22baa31 |
|
MD5 | 0a841193de391c90e7afc629c9c4f81f |
|
BLAKE2b-256 | a2dd9ca10e3098ba352962a781dcc1025ddfb1b10b23c0191a7f4b2513426244 |
Hashes for libqasm-0.6.1-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b30cfd4014b9594bd191502869378083dcfc91c2f1153b8f69ba38eecb9d936 |
|
MD5 | b5e18d355022ae3fdf0cedff9a0a497f |
|
BLAKE2b-256 | 3ab6b92a280af5d667395037ccff46c665f5eeb676f3b08aff6412bf8aa21e3e |
Hashes for libqasm-0.6.1-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 248ffcc9bea69a6187ae8a4ccaaa4820c3126ee59fde0409a8b1b3c0fe17749b |
|
MD5 | 7849270a29848ae2186fd17a2f34e194 |
|
BLAKE2b-256 | 7cc9d0e5142859d8c0e8e8d29f1673a1df7c194f2406216bf66b1eeac271129e |
Hashes for libqasm-0.6.1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91d2ff9cf0895ac207b5b3ba2116c5c7075ce65fe9c1f71bebbdd939607cf4cd |
|
MD5 | d3d0df95edc27c66019ef5ef59727806 |
|
BLAKE2b-256 | 65c801ff8e4d6597cb70d91ba4576b6e8b82b7b5c2e98039b93d1df5a34405d4 |