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.2-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c350257f52eee655b05978da0ccda05490458412e15412ef4dfe507c7bb7e79 |
|
MD5 | eb9bcdfa62c1570263168d0607e34109 |
|
BLAKE2b-256 | d7f5798c8d000959d7f7aacfa81c00cda4ee18f5d2de46022839aae776963ee4 |
Hashes for libqasm-0.6.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c74b6c3b4e747e725aa6e9910a7b12d4a7b6dc2c1a9af0b84017a828aa667729 |
|
MD5 | 0945cfe0dc0f819c9ce985d5c7543191 |
|
BLAKE2b-256 | f5ca133b78d421794b7f6a267020903df47265f41027de5af5d0ad19ee70c53e |
Hashes for libqasm-0.6.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 831ef10ebc7afaa6e171d56e3df9dd6bf8ded7b712b9b061656d2359a611b1f9 |
|
MD5 | b4a59c0a17577c3b8c09d59345b187e5 |
|
BLAKE2b-256 | 9c985e47f6383eb4e2c47272ec4bd002f893146d967e7642252546938a83cdda |
Hashes for libqasm-0.6.2-cp312-cp312-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d544cb9c407b82e2127d482cfc5abc80908e301aa441404d7b7610a6d3d897ba |
|
MD5 | 1a5dc524a9712791c478b1fe9c137a1d |
|
BLAKE2b-256 | bfd905ffc3d9189695e3ded0195b5d66d4eca16b27324e5f81df63461a45672a |
Hashes for libqasm-0.6.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0afedc8c7421432d18ad02077f8e6aa1740c05c2f384ec7ee8f5b09d07a95705 |
|
MD5 | 40fe540857c60909349215d6e990123a |
|
BLAKE2b-256 | 8a5f5fad14073071af1a27a55192c6d0a0e24b85c7d9442550cf61bc5cda3206 |
Hashes for libqasm-0.6.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d2956992c350d3d16361f269167249980206bd5481e8bbbac838bb5844db943 |
|
MD5 | 143bafa63e644f4340358d680ac38647 |
|
BLAKE2b-256 | 4d4c71f95cbb92c86ba529e40f49597de5091cf4d56e9dcbe9f0c701b1bd1c79 |
Hashes for libqasm-0.6.2-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4f9aae20379c7876919b93867ffc991746eacfc95673b55fc9898479bd72111 |
|
MD5 | db6fd54408136db15b4bfc3956ad52c2 |
|
BLAKE2b-256 | f21a434ac0208c840b7bf1caef5b8f308030385e0e2f82c259553a80a9da3c6b |
Hashes for libqasm-0.6.2-cp311-cp311-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49d5ae859985207ad1d66c361ce815491cc55b316e3f9269cfef4e16bf23570c |
|
MD5 | 0a42b4d9342a6b311323580f355777f1 |
|
BLAKE2b-256 | c8e8b5e9b66664cb67eccdea87a8a8361b188fc20f5f4e7abbd7c4c646efe482 |
Hashes for libqasm-0.6.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02dd64c4c82b0e6ccd0d21edfa73f74d9080a4b8783b5986c46c6a1e412dd625 |
|
MD5 | d704319770b318f38be8461cbb80d355 |
|
BLAKE2b-256 | 4632ed1bb9e73367999cd10776483055a73b0af3b39fc6c8196ac143fd63c326 |
Hashes for libqasm-0.6.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc3c71abf1f7f02b0548b61597efaf3b1e290a5aa8708fde226a946b16f9d4a7 |
|
MD5 | 6395cc10caf61c6e59247fce81a925d9 |
|
BLAKE2b-256 | 7e2af1f1a44d4de1b0565c5d3fa05878c15626e1624beb4db192be1134dd301d |
Hashes for libqasm-0.6.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b65afba5a74c3bfa8391965958534ce7012a5bf3fe5761ef7dcf12308ebffd |
|
MD5 | 977220db6c00c9a5a7543bccd8639109 |
|
BLAKE2b-256 | ca3f8ad9944fedad84b57ae2305948627b3e0fa408bf7cc3c1fadd8eda7c6d9c |
Hashes for libqasm-0.6.2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a228e7a516fc59b5ae4ac6bbf02d28b121d5514d1a72fa9503e5dff488a79bc |
|
MD5 | 42ad6f40fd11de745c50c02f4c4930d1 |
|
BLAKE2b-256 | 730a1d304a645de0f08390db4197c339b5a7d79d538f113dfb0ee5aac4629b79 |
Hashes for libqasm-0.6.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61c6d444c082daa4fcf8d852b144ef2bd9567257a13b7720c55222e604ca75b1 |
|
MD5 | 1d76a462a0a4566a1a5e76e5eeced88f |
|
BLAKE2b-256 | ddbf8cab67b37e9323efe9182dd47bb816d223255ea2d05630fac5528cb5f6c5 |
Hashes for libqasm-0.6.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 851b8a10587088a0a4d98862469aa29400d81f008d054500a2bf59c3e97658a5 |
|
MD5 | 5002cddaa769317462b76bbdad6db120 |
|
BLAKE2b-256 | f2263a6639841478693f7736f5b2fa7e7d9afc7a4ee32fe598038a030d67153d |
Hashes for libqasm-0.6.2-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6c62debba362a1ea4bbd4ec663528ed97217cc3f6fc69e4640dd76a97f0490e |
|
MD5 | 15bd056a4921691cf280cf207636c80f |
|
BLAKE2b-256 | 73751bbc770d8cb38b512b052728cb13588238bc853b8eb59ab7a7ce5fa2e946 |
Hashes for libqasm-0.6.2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7898c9e5c10d33268476667a8b195ff9eb44eb46eef6049c8350aa4b50b1f6c9 |
|
MD5 | ae27bebc7d35f0ed5f81e8f5406a0ebd |
|
BLAKE2b-256 | 0e6539a12fa769b560374df354afc4f2704048c4c18247c8cec4c3c365e851dd |
Hashes for libqasm-0.6.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 516572719b73c7027726e237dbd8b74fdfb62efee5184ae9aaf17c451cb372b7 |
|
MD5 | 4a545819f9a4b3dd6441f07564d0a5d4 |
|
BLAKE2b-256 | 9ba4564568c635d11ccb910e1d28b8d12aac8ee5d86bcc4cd3e8acd812bc605d |
Hashes for libqasm-0.6.2-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea0aa03cc3bb52df6922b10675c00e0e8ef6f6d055d4f363de1ef5d23957c43c |
|
MD5 | f14bee56ffc35dd05ab9d96851ce110b |
|
BLAKE2b-256 | b69a3e796d0eb4883af12a8a37d1375a1524057e2cffa7d17b6911e0c1bc5217 |
Hashes for libqasm-0.6.2-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b89acef1b095d6e7546c3d968c4f351fdb532867e14828c0c1874c583992c18 |
|
MD5 | e78c7f85c3eb83d6ab4c01ff20703395 |
|
BLAKE2b-256 | fadd557683f544fe8f4dd1f2013a979cba9cabdd805202f5395d93542ef4a646 |
Hashes for libqasm-0.6.2-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59d888ec34d87e2ef9da77b89a6eebbc778aa66f0b64c4ed6c2bad20bf603291 |
|
MD5 | 8fa5aa5309c322aff148c0032e09ee70 |
|
BLAKE2b-256 | 7eb22304dc646b47b2a4d0c986e9c22e581445c129c34634695b0cdfc8e1b089 |