libqasm 0.6.6__cp311-cp311-macosx_11_0_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cqasm/__init__.py +1 -0
- cqasm/v3x/__init__.py +65 -0
- cqasm/v3x/ast.py +10963 -0
- cqasm/v3x/instruction.py +42 -0
- cqasm/v3x/primitives.py +67 -0
- cqasm/v3x/semantic.py +2367 -0
- cqasm/v3x/types.py +1742 -0
- cqasm/v3x/values.py +1714 -0
- libqasm/__init__.py +25 -0
- libqasm/_libqasm.cpython-311-darwin.so +0 -0
- libqasm/libqasm.py +1082 -0
- libqasm-0.6.6.dist-info/LICENSE.md +13 -0
- libqasm-0.6.6.dist-info/METADATA +224 -0
- libqasm-0.6.6.dist-info/RECORD +16 -0
- libqasm-0.6.6.dist-info/WHEEL +5 -0
- libqasm-0.6.6.dist-info/top_level.txt +2 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright [2018] [QCA Lab, QuTech, TU Delft]
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
@@ -0,0 +1,224 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: libqasm
|
3
|
+
Version: 0.6.6
|
4
|
+
Summary: libqasm Python Package
|
5
|
+
Home-page: https://github.com/QuTech-Delft/libqasm
|
6
|
+
Author: QuTech, TU Delft
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
9
|
+
Classifier: Operating System :: MacOS
|
10
|
+
Classifier: Operating System :: Microsoft :: Windows
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
12
|
+
Classifier: Topic :: Scientific/Engineering
|
13
|
+
Description-Content-Type: text/markdown
|
14
|
+
License-File: LICENSE.md
|
15
|
+
Requires-Dist: numpy
|
16
|
+
|
17
|
+
# libQASM: Library to parse cQASM v3.0 files
|
18
|
+
|
19
|
+
[](https://github.com/qutech-delft/libqasm/actions)
|
20
|
+
[](https://pypi.org/project/libqasm/)
|
21
|
+
|
22
|
+
## File organization
|
23
|
+
|
24
|
+
For development, see:
|
25
|
+
|
26
|
+
- `include`: public headers.
|
27
|
+
- `src`: source files.
|
28
|
+
- `test`: test files.
|
29
|
+
- `python`: SWIG interface.
|
30
|
+
- `res`: resource files, for testing.
|
31
|
+
|
32
|
+
For build process, continuous integration, and documentation:
|
33
|
+
|
34
|
+
- `conan`: Conan profiles.
|
35
|
+
- `emscripten`: bindings and test for the emscripten binaries.
|
36
|
+
- `scripts`: helper scripts used during the build process.
|
37
|
+
- `.github`: GitHub Actions configuration files.
|
38
|
+
- `doc`: documentation.
|
39
|
+
|
40
|
+
Build outputs may go into:
|
41
|
+
|
42
|
+
- `build/<build type>`: the C++ library output files generated by Conan.
|
43
|
+
- `pybuild`: the Python library output files generated by `setup.py`.
|
44
|
+
|
45
|
+
## Dependencies
|
46
|
+
|
47
|
+
* C++ compiler with C++20 support (gcc 11, clang 14, msvc 17)
|
48
|
+
* `CMake` >= 3.12
|
49
|
+
* `git`
|
50
|
+
* `Python` 3.x plus `pip`, with the following package:
|
51
|
+
* `conan` >= 2.0
|
52
|
+
|
53
|
+
### ARM specific dependencies
|
54
|
+
|
55
|
+
We are having problems when using the `zulu-opendjk` Conan package on an ARMv8 architecture.
|
56
|
+
`zulu-openjdk` provides the Java JRE required by the ANTLR generator.
|
57
|
+
So, for the time being, we are installing Java manually for this platform.
|
58
|
+
|
59
|
+
* `Java JRE` >= 11
|
60
|
+
|
61
|
+
## Build
|
62
|
+
|
63
|
+
This version of `libqasm` can only be compiled via the Conan package manager.
|
64
|
+
You'll need to create a default profile before using it for the first time.
|
65
|
+
|
66
|
+
The installation of dependencies, as well as the compilation, can be done in one go.
|
67
|
+
|
68
|
+
```
|
69
|
+
git clone https://github.com/QuTech-Delft/libqasm.git
|
70
|
+
cd libqasm
|
71
|
+
conan profile detect
|
72
|
+
conan build . -pr:a=conan/profiles/tests-debug -b missing
|
73
|
+
```
|
74
|
+
|
75
|
+
Notice:
|
76
|
+
- the `conan profile` command only has to be run only once, and not before every build.
|
77
|
+
- the `conan build` command is building `libqasm` in Debug mode with tests using the `tests-debug` profile.
|
78
|
+
- the `-b missing` parameter asks `conan` to build packages from sources
|
79
|
+
in case it cannot find the binary packages for the current configuration (platform, OS, compiler, build type...).
|
80
|
+
|
81
|
+
### Build profiles
|
82
|
+
|
83
|
+
A group of predefined profiles is provided under the `conan/profiles` folder.<br/>
|
84
|
+
They follow the `[tests](-build_type)(-compiler)(-os)(-arch)[-shared]` naming convention:
|
85
|
+
- `tests`: if tests are being built.
|
86
|
+
- `build_type`: can be `debug` or `release`.
|
87
|
+
- `compiler`: `apple-clang`, `clang`, `gcc`, `msvc`.
|
88
|
+
- `os`: `emscripten`, `linux`, `macos`, `windows`.
|
89
|
+
- `arch`: `arm64`, `wasm`, `x64`.
|
90
|
+
- `shared`: if the library is being built in shared mode.
|
91
|
+
|
92
|
+
All the profiles set the C++ standard to 20.<br/>
|
93
|
+
All the `tests`, except for `linux-x64` profiles, enable Address Sanitizer.
|
94
|
+
|
95
|
+
### Build options
|
96
|
+
|
97
|
+
Profiles are a shorthand for command line options. The command above could be written, similarly, as:
|
98
|
+
|
99
|
+
```
|
100
|
+
conan build . -s:a compiler.cppstd=20 -s:a libqasm/*:build_type=Debug -o libqasm/*:build_tests=True -o libqasm/*:asan_enabled=True -b missing
|
101
|
+
```
|
102
|
+
|
103
|
+
This is the list of options that could be specified either in a profile or in the command line:
|
104
|
+
|
105
|
+
- `libqasm/*:asan_enabled={True,False}`: enables Address Sanitizer.
|
106
|
+
- `libqasm/*:build_type={Debug,Release}`: builds in debug or release mode.
|
107
|
+
- `libqasm/*:shared={True,False}`: builds a shared object library instead of a static library, if applicable.
|
108
|
+
|
109
|
+
Tests are enabled by default. To disable them, use `-c tools.build:skip_test=True`.
|
110
|
+
|
111
|
+
## Install
|
112
|
+
|
113
|
+
### From Python
|
114
|
+
|
115
|
+
Install from the project root directory as follows:
|
116
|
+
|
117
|
+
```
|
118
|
+
python3 -m pip install --verbose .
|
119
|
+
```
|
120
|
+
|
121
|
+
You can test if it works by running:
|
122
|
+
|
123
|
+
```
|
124
|
+
python3 -m pytest
|
125
|
+
```
|
126
|
+
|
127
|
+
### From C++
|
128
|
+
|
129
|
+
The `CMakeLists.txt` file in the root directory includes install targets:
|
130
|
+
|
131
|
+
```
|
132
|
+
conan create --version 0.6.6 . -pr:a=tests-debug -b missing
|
133
|
+
```
|
134
|
+
|
135
|
+
You can test if it works by doing:
|
136
|
+
|
137
|
+
```
|
138
|
+
cd test/Debug
|
139
|
+
ctest -C Debug --output-on-failure
|
140
|
+
```
|
141
|
+
|
142
|
+
## Use from another project
|
143
|
+
|
144
|
+
### From Python
|
145
|
+
|
146
|
+
The `libqasm` module should provide access to the `V3xAnalyzer` API:
|
147
|
+
- `parse_file`,
|
148
|
+
- `parse_string`,
|
149
|
+
- `analyze_file`, and
|
150
|
+
- `analyzer_string`.
|
151
|
+
|
152
|
+
The `cqasm.v3x` module is also available for a more fine-grained use of the library.
|
153
|
+
|
154
|
+
```
|
155
|
+
import cqasm.v3x.ast
|
156
|
+
import cqasm.v3x.instruction
|
157
|
+
import cqasm.v3x.primitives
|
158
|
+
import cqasm.v3x.semantic
|
159
|
+
import cqasm.v3x.types
|
160
|
+
import cqasm.v3x.values
|
161
|
+
```
|
162
|
+
|
163
|
+
### From C++
|
164
|
+
|
165
|
+
`libqasm` can be requested as a Conan package from a `conanfile.py`.
|
166
|
+
|
167
|
+
```
|
168
|
+
def build_requirements(self):
|
169
|
+
self.tool_requires("libqasm/0.6.5")
|
170
|
+
def requirements(self):
|
171
|
+
self.requires("libqasm/0.6.5")
|
172
|
+
```
|
173
|
+
|
174
|
+
And then linked against from a `CMakeLists.txt`:
|
175
|
+
|
176
|
+
```
|
177
|
+
target_link_libraries(<your target> PUBLIC libqasm::libqasm)
|
178
|
+
```
|
179
|
+
|
180
|
+
Note that the following dependency is required for `libqasm` to build:
|
181
|
+
|
182
|
+
* `Java JRE` >= 11
|
183
|
+
|
184
|
+
The header file `cqasm.hpp` should provide access to the following API:
|
185
|
+
- `cqasm::v3x::analyze_file`, and
|
186
|
+
- `cqasm::v3x::analyze_string`.
|
187
|
+
|
188
|
+
Again, other header files are available for a more fine-grained use of the library.
|
189
|
+
|
190
|
+
## Docker
|
191
|
+
|
192
|
+
This tests the library in a container with the bare minimum requirements for `libqasm`.
|
193
|
+
|
194
|
+
```
|
195
|
+
docker build .
|
196
|
+
```
|
197
|
+
|
198
|
+
**Note for Windows users:** The above might fail on Windows due to the `autocrlf` transformation that git does.
|
199
|
+
If you are having trouble with this just create new clone of this repository using:
|
200
|
+
|
201
|
+
```
|
202
|
+
git clone --config core.autocrlf=input git@github.com:QuTech-Delft/libqasm.git
|
203
|
+
```
|
204
|
+
|
205
|
+
## Emscripten
|
206
|
+
|
207
|
+
The generation of emscripten binaries has been tested as a cross-compilation from an ubuntu/x64 platform.
|
208
|
+
|
209
|
+
```
|
210
|
+
conan build . -pr=conan/profiles/release-clang-emscripten-wasm -pr:b=conan/profiles/release -b missing
|
211
|
+
```
|
212
|
+
|
213
|
+
The output of this build lives in `build/Release/emscripten`:
|
214
|
+
- `cqasm_emscripten.js`.
|
215
|
+
- `cqasm_emscripten.wasm`.
|
216
|
+
|
217
|
+
Note that `cqasm_emscripten.js` is an ES6 module. An example of how to use it would be:
|
218
|
+
|
219
|
+
```
|
220
|
+
cd build/Release/emscripten
|
221
|
+
mv cqasm_emscripten.js cqasm_emscripten.mjs
|
222
|
+
cd ../../../emscripten
|
223
|
+
deno run -A test_libqasm.ts
|
224
|
+
```
|
@@ -0,0 +1,16 @@
|
|
1
|
+
cqasm/__init__.py,sha256=MsSFjiLMLJZ7QhUPpVBWKiyDnCzryquRyr329NoCACI,2
|
2
|
+
cqasm/v3x/__init__.py,sha256=S2V6EAh1mNbDyNoA1tZfjZ-Pgykqry_LeA_KEhqTjZY,2785
|
3
|
+
cqasm/v3x/ast.py,sha256=Vng_gxnIBqbNrEa9ElHIUDLBWEEXQGCagddx6AnbgFc,409207
|
4
|
+
cqasm/v3x/instruction.py,sha256=AEOwKV2riafpyTiJvgq7azwOhyhhZfpKV12uWWJ5M2A,1177
|
5
|
+
cqasm/v3x/primitives.py,sha256=ESCsMHP1GeuKh2gHQSP0ha24Abp453U-I7JSGK9dZas,1664
|
6
|
+
cqasm/v3x/semantic.py,sha256=7JB7EU2QL6m4LZC8uPp-giGVRUa_RwKzlci1PA4LRIg,86312
|
7
|
+
cqasm/v3x/types.py,sha256=izXYdNmYvJUcRSZVLJ-blPnU2TmhOGR1Z3Rhtk8rTOQ,63328
|
8
|
+
cqasm/v3x/values.py,sha256=YY_41YQ7iU2te7FqtstGnQJd4W3CFH7LmkawSKh5e_A,61680
|
9
|
+
libqasm/__init__.py,sha256=liVJFi24VHbmUU-9lBA6hm-xPpF1DgzXMsZ0f1dqO3E,727
|
10
|
+
libqasm/_libqasm.cpython-311-darwin.so,sha256=chnYrigzn9eJYOSkhIutiASmdQCelK3ZyOeG8gaDtWs,4053544
|
11
|
+
libqasm/libqasm.py,sha256=io7NCBJdhdoguyRWGAWCKjc4fQnLL9Wngta4a9MXM9M,30595
|
12
|
+
libqasm-0.6.6.dist-info/LICENSE.md,sha256=duRlJgy46W8Cw_IQjOmud5xJUvgJkX6pkBmBJkoKi4I,566
|
13
|
+
libqasm-0.6.6.dist-info/METADATA,sha256=7v_psmJ26_kET6lU0_dLWtyG0HNzXZ21k9l1dEUmpDc,6551
|
14
|
+
libqasm-0.6.6.dist-info/WHEEL,sha256=glY0sLhbhKy3BH8OyUaaEklHTnmWvOLHk7hCrHyRQtY,115
|
15
|
+
libqasm-0.6.6.dist-info/top_level.txt,sha256=iZ8PSLyg3lJwvSUCvWE8VCJGU-nmQY2YIrbMe7M7kLw,14
|
16
|
+
libqasm-0.6.6.dist-info/RECORD,,
|