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.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5222d34211ecba4881c46bd4be1de2c6df6c6865aa3f681c95221b1fc604072 |
|
MD5 | 1c9e8284dc61df8e9874ac5c38c03628 |
|
BLAKE2b-256 | cedfd084a82b3a812f2d6d08b8d5fc90fbf7093770cd1397d8fa4916dfc9f3f0 |
Hashes for libqasm-0.6.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 836a88306be6a6e486522e40622f66c5b4156d6f3a1e3169d3b0383c1d0b8f69 |
|
MD5 | 9887616e7df7c2adf2da2f197299d0ee |
|
BLAKE2b-256 | a227d1809ea79cb72f7503fcf6bf182e2f62fe4033d341f590d2ba8ada869efa |
Hashes for libqasm-0.6.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec819d77cc3d8b2b7ebe665d48cbe8af420e167442db45def6c9781d5e3b6ea2 |
|
MD5 | 293cca19d4ed38731ad78d2102267a85 |
|
BLAKE2b-256 | 64005db51e4b4c2657494e49d7bc7c3571e45c55d4a4e822fb170a13cd67900c |
Hashes for libqasm-0.6.0-cp312-cp312-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae98fc78c462a4a51fae96539c6e8cda4013f7eed69ae71eb989c6961b4c60d |
|
MD5 | 3b993dfebb0653f29ba65d72413684ea |
|
BLAKE2b-256 | e4f4371610d99a1513133cfd197c9f3273d84dd6babfdab2494f240fe55c47f4 |
Hashes for libqasm-0.6.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d43d1f00e07171a6fba71026b774efd3775783841e1c5a0975dccd6d4a7afea4 |
|
MD5 | 605b76a64f9fcc5de53852e86fafa954 |
|
BLAKE2b-256 | 6c31a11d40c9352d21479627d00ae86411eeb0e6f3f8e3544ff80ad3b9295409 |
Hashes for libqasm-0.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f667e4264d1abff90fd8b2bebd75f17a4ee85916fb8179d6d2516f6ac314ce2b |
|
MD5 | 372e8f82095114e9020ca9f8590d3bfd |
|
BLAKE2b-256 | e85d5b2b6280bbc28a7221f52fcbddf7f79a111963618c3c469d695f493c05a2 |
Hashes for libqasm-0.6.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bfd6cbd343892d743a2cee2829f6a8e8b84efb74ee35f3c584dc3e04e025c49 |
|
MD5 | ee1523c73ee5fa6f571d20122be63f80 |
|
BLAKE2b-256 | 8ce915283884666b2962a8359984734f5eb394d4dd62840895fb10e0a42f4939 |
Hashes for libqasm-0.6.0-cp311-cp311-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d0aa77e7cd3a8b115b368772dd194f8cff5b9e8f018d14c7f1d5ffc0ff7b714 |
|
MD5 | a1bf05e2879c77916b705acd49d17cba |
|
BLAKE2b-256 | a1c6585062701b64ba212e0190e6a69cdf00e01dffee8692df4bf03f7619edb2 |
Hashes for libqasm-0.6.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ac083c334a2594f5f8cd2147b829d0c7564d4c7a9628772db5bef1a437c3175 |
|
MD5 | a77692667913bfc0f0d913374f203bbe |
|
BLAKE2b-256 | 83a7be0f5acc76f0c7a468d07627f67eb651b8b3d7a15eb8154fa27693b67b46 |
Hashes for libqasm-0.6.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4265d339c5f3f95da2b61ecc5ccdd5a6723f4b1d76a13c413448595de154fd04 |
|
MD5 | 476257519bb24199e3210840d6c2ac51 |
|
BLAKE2b-256 | 7baafa7ef22ce45b4e29b721e9a298b0a4585c04e889fb8870d2abb388c38e1c |
Hashes for libqasm-0.6.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33a50a94331bcb97ae84a365317f3768946ff479b2fa3746db39097bdbe3c1fe |
|
MD5 | eedcb793f29040b456d2d5e044947962 |
|
BLAKE2b-256 | cd72e1e0377e24dd454701d206c936b4ea5be1fb8f03bcc891a691f59e192cd8 |
Hashes for libqasm-0.6.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ae670bbebc87c9b5829a7a14ff60b20bf89c49d0b6cfcde754a2d96a3dace4c |
|
MD5 | 54a4741c4e77372efd8d507cd1ea8e14 |
|
BLAKE2b-256 | 8757fff4e18ae843b55f7f50c788bb12fe11bf9b712a360ca888477325dfa705 |
Hashes for libqasm-0.6.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9974052d6049fdd38c73e04aec539b5130fbb7440f39678407392209cfc683b |
|
MD5 | b3a9e3d7549e0daa35d87e5f914a3523 |
|
BLAKE2b-256 | 572fa989ba4a932b4874738904954575633f1735f6b03b0b21953be17a274da4 |
Hashes for libqasm-0.6.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d1db3363023d8675769aabaa0286c957fba7961e3745941fc86b831dddbe35 |
|
MD5 | 7cb4a8c390f8f2e03a7910355b3ed445 |
|
BLAKE2b-256 | d66bb11a61e88f88e99ad9155cc58fcdd0ebd35ae1952399838a17a155461aec |
Hashes for libqasm-0.6.0-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57ff9fb2fd70aff81bfba3964d95509ee46c55b66067876520ae63c2d177542f |
|
MD5 | e40e62d136a7ed5a1d47aa9de1903a3d |
|
BLAKE2b-256 | 032423e2a08df71db9ce6efd452d81f9cbbc27229b6d9311216b08681209c354 |
Hashes for libqasm-0.6.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51cc5651d10c32499f21ac0a82f2600a0a13fbe0eb9c35e702e87b62b7f41a90 |
|
MD5 | 9845387e4a69cfeeb4a98811b13c8fd4 |
|
BLAKE2b-256 | 5984b7ce6daa9410de9abfaafd5826f394af8b959d3e27605ba13b8344835b08 |
Hashes for libqasm-0.6.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8374e8b0a0978a96f9b7fa82a6b7fccfebb67a6868af8384970a0a3080a2ff5b |
|
MD5 | 1df3fe894a830acb427b55e6b8e9b90d |
|
BLAKE2b-256 | 2ba5315ce45407478d5b8c7369933053651c611a349cea8424c9903c9a621b13 |
Hashes for libqasm-0.6.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a21e3104c966d773e426d7607691fdc3cb7b35979c75d6d4fb0cd496d2518d7 |
|
MD5 | c1e5779dcdd912944127d602483a2304 |
|
BLAKE2b-256 | 145c9f3d52b0009139107001ac84a98deb5627d86599f53c35a411c5f4bb9b7d |
Hashes for libqasm-0.6.0-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 986efde8502f8bff36a9e52490cc19a58eb88643285066bde50fc66c8070d957 |
|
MD5 | b3b0fb5903a4e82c1642e7c2ac530973 |
|
BLAKE2b-256 | d445497ce680b690264f42f423466f30c58b084634903e9b94bc038f3a0282c1 |
Hashes for libqasm-0.6.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2418a36e4cee7caeaa872a0cc4d5b59cec271e2af35a345b025570846b88ee2c |
|
MD5 | 73afd1b570043707ef214ca207291a5f |
|
BLAKE2b-256 | a6ce0c4d320015e42467a3f3b62c617bc4d21a7697fbc4bb9a6f699967b39b36 |