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.4-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf0595d9d0a9abcd4241c4f60f70dddf0058edba481e7608bc1a3674bec9a58b |
|
MD5 | 3132188a94b13759a4fc57cee6d9f301 |
|
BLAKE2b-256 | 6603a775e548073bd41138d278687f39d779b6e833ca34fb1a0524c3d56767ae |
Hashes for libqasm-0.6.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96af029d1165a7c9c31846530324f5a9d404d4f0a59dd425bb36a8a31157bb74 |
|
MD5 | d498db444962c7cc8bf7712716957f22 |
|
BLAKE2b-256 | ac30a30ffb471e84b9f50a163bedeec04e28a8d2a14d365ed72f2d88ad88854e |
Hashes for libqasm-0.6.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b49d40efb0606efca484f1ecb233f4f6580346fdf2f9bd3a9ee42e6daa5d118d |
|
MD5 | 15c7137711c685e9b3d170679d179206 |
|
BLAKE2b-256 | e98e70337987d33c3cfa404363f05762ab3757d10f198c0a79ada8e1fc60e5cb |
Hashes for libqasm-0.6.4-cp312-cp312-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 628800ba1ad83d13dd691442cdc0d94c03edf2c810a85719aeae688a8d52827a |
|
MD5 | e945faece59de81485310948034f972b |
|
BLAKE2b-256 | 95716ab9f65f692eba084164449d932ef79eade651ad6b61ffa16a1841970ea6 |
Hashes for libqasm-0.6.4-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b643aaba79bf00aec4b3ea98749bd0ff4bcfd144680daf148ca2ab17489ed9d |
|
MD5 | daaf94b8301175e5a5910eb2dbb78ec6 |
|
BLAKE2b-256 | 71c7d463e1812df5361591c9bfb4ee4444496dfea69a01a97620fbd0784cc87c |
Hashes for libqasm-0.6.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c81a076df618a52abc054e1a088177a82355d57be0b6fa75c7079ddf4f35608 |
|
MD5 | 3877099befcf0ee0f4ac377e56703f80 |
|
BLAKE2b-256 | 6c51efa6c2a3dc1d27ffad86e86b11e0a0df1cb0d0e1b3392e5ad47c7de01788 |
Hashes for libqasm-0.6.4-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8410cd3e9168a161073883b745508f70a7ee4a3c2b2ece91514220eedbb0c150 |
|
MD5 | cad7eb06721b9e8d882d1c8b25f5bdea |
|
BLAKE2b-256 | fe51d77ef49cb97cb7c2542697664a61394d3cc3d7c7dc7fea0280bad22ab7f9 |
Hashes for libqasm-0.6.4-cp311-cp311-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45eca97017e3547301caa478c2bcda56c968ef10e32aa6cb6cdf549a659c14f4 |
|
MD5 | 5b7a4e34da696945d9f60ddf3059e546 |
|
BLAKE2b-256 | 49d28739ed96c69f93ce4ac8214ef8380b2d6be435560108bdcce5e90ff58561 |
Hashes for libqasm-0.6.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3a49020ca02c9b0f3db43ccc6cfe380e4b6fa8767421e338618d520a4c06c19 |
|
MD5 | 38dd8be9e334c9885c72b4cd5c412c86 |
|
BLAKE2b-256 | 1ecb8f7cac2fb6ac328c49dda213db7e83d54de76efa036b75d787197f2ea4a2 |
Hashes for libqasm-0.6.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fb29f6e5c4b660a1a105187b4e1911ac86a6b774040c1f7e1d2d633c2ebddbc |
|
MD5 | ef716195b495fea29f61994a790419b5 |
|
BLAKE2b-256 | b670334ecaec9eb7cc80e5791daa9943be04afdec78fe5a48fd0acc3625cb2ca |
Hashes for libqasm-0.6.4-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 307a8b971867a728b258b822797f308835f136eab2c83ae6745509924999f7d4 |
|
MD5 | 355430e30da4bab41c26e1c64a7313ca |
|
BLAKE2b-256 | 0852825855c0a704fd6f8f5c440bb3deaacc406d84310a648bf6975bb0a02e32 |
Hashes for libqasm-0.6.4-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84f8c9c233f4674b8f02908a443676b7922e4704ccc84ca6757fe323a87ac256 |
|
MD5 | 635e0a536cd4350ff4cd33bead02b12b |
|
BLAKE2b-256 | 99747dd6cfef0196e11c0a8b859bc7049535c6d2d658890ecc7917209cce5385 |
Hashes for libqasm-0.6.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bba21b8f9162ef96a7b070a93468d9651ecc9effbdb6c140129123406b63c092 |
|
MD5 | e89d5b361bf4ef98328ea5a5f794daa1 |
|
BLAKE2b-256 | d1b57ef79a213d94e545b2161d6ee13c97b0b89006ccce683a2929a31a94b7f2 |
Hashes for libqasm-0.6.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a4af71f159db5b7027cb3cc248ea9df5c0bcd05c4426ac16c8157139bb43961 |
|
MD5 | cd8d239e4424348ecfc7abdd0f9452e7 |
|
BLAKE2b-256 | 1b054480d02aaf227704f61acb27ea52f088427f17170d443ce92a6ba3fba3e9 |
Hashes for libqasm-0.6.4-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08f9a23609c4def5d6b0f9ed2edd0c19e838921275ef9dff0aa4e83c13c1fd28 |
|
MD5 | 665b1a0439443ea4dee53ece9605518d |
|
BLAKE2b-256 | f6ffaeb41d1fd028fa26041dc975c75af9deae11c58e54b913006bfb0e19a03c |
Hashes for libqasm-0.6.4-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51582ce4dba4447232fdd6a07fbfaed82efd29112d1710f5ea5ab6226f667699 |
|
MD5 | 0fc91e98362863bbded0a75ac4d2e550 |
|
BLAKE2b-256 | 4443b91aa34d6af5a2a71528018a2ff856c31908957f8cff5f59712977a0f667 |
Hashes for libqasm-0.6.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58bce7e3aff9951d7a631dfb0dff1b320f68079b2e7934ea48976b8c9e72b4be |
|
MD5 | 18b1b2738527cf022bb46f916e50c0ff |
|
BLAKE2b-256 | 4d6643fb27a1cd812d99d3c05b877fc3d3249389d7b06a988be6bf1650482a3c |
Hashes for libqasm-0.6.4-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 576ec84e7b3d1b798c50cda1a18d10cce3b89384e0cbb3fdb3fd43482d3b3945 |
|
MD5 | b6dec63359188bacc3f4b92c1f18ab8a |
|
BLAKE2b-256 | 1955eef14a92ecc12c632b02b6896b4c7903b0e50c0e0b8e0ff90604b7ca899e |
Hashes for libqasm-0.6.4-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2ec0e5f6c01f0551a49154a840f9f3678d605e30dc66d77179f58fa069488b2 |
|
MD5 | 05d569199c12deb9468dfaac89dc6018 |
|
BLAKE2b-256 | afe53712b32aee1c7bb2f60c1d417f74b09207f07337cbc92ff49f65c7d49926 |
Hashes for libqasm-0.6.4-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7233bb3d0fe821b90ebfc4bb7b0d739a5980b5139f87ae68a37b0f6756d047f |
|
MD5 | 2d84fce75141cc59d09b597ff4e5a9b3 |
|
BLAKE2b-256 | a659e7fb1912507dcfae273fddd065bba59fe4f2a0b805e8b18c8c857518ad2f |