libqasm 0.6.6__cp310-cp310-win_amd64.whl → 0.6.8__cp310-cp310-win_amd64.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.
Binary file
libqasm/libqasm.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file was automatically generated by SWIG (https://www.swig.org).
2
- # Version 4.1.1
2
+ # Version 4.2.1
3
3
  #
4
4
  # Do not make changes to this file unless you know what you are doing - modify
5
5
  # the SWIG interface file instead.
@@ -443,11 +443,6 @@ class ostream(ios):
443
443
 
444
444
  # Register ostream in _libqasm:
445
445
  _libqasm.ostream_swigregister(ostream)
446
- cin = cvar.cin
447
- cout = cvar.cout
448
- cerr = cvar.cerr
449
- clog = cvar.clog
450
-
451
446
  class istream(ios):
452
447
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
453
448
  __repr__ = _swig_repr
@@ -507,6 +502,11 @@ class iostream(istream, ostream):
507
502
 
508
503
  # Register iostream in _libqasm:
509
504
  _libqasm.iostream_swigregister(iostream)
505
+ cin = cvar.cin
506
+ cout = cvar.cout
507
+ cerr = cvar.cerr
508
+ clog = cvar.clog
509
+
510
510
  endl_cb_ptr = _libqasm.endl_cb_ptr
511
511
  endl = _libqasm.endl
512
512
  ends_cb_ptr = _libqasm.ends_cb_ptr
@@ -1046,8 +1046,8 @@ class V3xAnalyzer(object):
1046
1046
  _libqasm.V3xAnalyzer_swiginit(self, _libqasm.new_V3xAnalyzer(*args))
1047
1047
  __swig_destroy__ = _libqasm.delete_V3xAnalyzer
1048
1048
 
1049
- def register_instruction(self, *args):
1050
- return _libqasm.V3xAnalyzer_register_instruction(self, *args)
1049
+ def register_instruction(self, name, param_types):
1050
+ return _libqasm.V3xAnalyzer_register_instruction(self, name, param_types)
1051
1051
 
1052
1052
  @staticmethod
1053
1053
  def parse_file(file_name):
@@ -0,0 +1,128 @@
1
+ Metadata-Version: 2.1
2
+ Name: libqasm
3
+ Version: 0.6.8
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: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE.md
19
+ Requires-Dist: numpy
20
+
21
+ # libQASM
22
+
23
+ [![CI](https://github.com/QuTech-Delft/libqasm/workflows/Test/badge.svg)](https://github.com/qutech-delft/libqasm/actions)
24
+ [![Conan Center](https://img.shields.io/conan/v/libqasm)](https://conan.io/center/recipes/libqasm)
25
+ [![PyPI](https://badgen.net/pypi/v/libqasm)](https://pypi.org/project/libqasm/)
26
+ ![OS](https://img.shields.io/badge/os-emscripten%20%7C%20linux%20%7C%20macos%20%7C%20windows-blue?style=flat-square)
27
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
28
+
29
+ libQASM is a library to parse cQASM programs, developed by QuTech.
30
+ At the moment, libQASM only supports cQASM v3.0 programs
31
+ (see [cQASM-spec](https://qutech-delft.github.io/cQASM-spec/latest/) for the language specification).
32
+
33
+ It performs lexical, syntactic, and semantic analysis of an input program received via a file or a string.
34
+ It produces one of the following results:
35
+
36
+ - A syntactic or semantic AST (Abstract Syntax Tree) object. Depending on if we are parsing or analysing.
37
+ - A list of parsing or analysing errors. In case the input program was malformed.
38
+ - A JSON representation of either the AST or the list of errors.
39
+
40
+ It can be used from:
41
+
42
+ - C++ projects (as a [Conan package](https://conan.io/center/recipes/libqasm)).
43
+ - Python projects (as a [Python package](https://pypi.org/project/libqasm/)).
44
+ - Emscripten projects (via a Typescript frontend).
45
+
46
+ Check out [QX simulator](https://github.com/QuTech-Delft/qx-simulator)
47
+ and [OpenSquirrel](https://github.com/QuTech-Delft/OpenSquirrel) compiler
48
+ for an example of use in a C++ and a Python project, respectively.
49
+
50
+ ## Getting started
51
+
52
+ Given a cQASM program `example.cq`.
53
+
54
+ ```cQASM
55
+ version 3.0
56
+
57
+ qubit[2] q
58
+ bit[2] b
59
+
60
+ H q[0]
61
+ CNOT q[0], q[1]
62
+ b = measure q
63
+ ```
64
+
65
+ We can parse or analyze this circuit, using libQASM through the following programming language:
66
+
67
+ ### C++
68
+
69
+ ```cpp
70
+ #include "libqasm/v3x/cqasm-python.hpp"
71
+
72
+ int main() {
73
+ auto parse_result = V3xAnalyzer::parse_file("example.cq");
74
+
75
+ auto analyzer = V3xAnalyzer();
76
+ auto analysis_result = analyzer.analyze_file("example.cq");
77
+ }
78
+ ```
79
+
80
+
81
+ ### Emscripten
82
+
83
+ The emscripten API only allows to input a cQASM program as a string.
84
+
85
+ ```typescript
86
+ import { default as wrapper } from 'cqasm_emscripten.mjs';
87
+
88
+ wrapper().then(function(result: any) {
89
+ let analyzer = new result["EmscriptenWrapper"]()
90
+ let program = `
91
+ version 3
92
+ qubit[2] q
93
+ bit[2] b
94
+ H q[0]
95
+ CNOT q[0], q[1]
96
+ b = measure q
97
+ `
98
+ let output = analyzer.parse_string_to_json(program)
99
+ analyzer.delete()
100
+ }).catch((error: any) => {
101
+ console.error("unhandledRejection", error, "\n");
102
+ });
103
+ ```
104
+
105
+ ### Python
106
+
107
+ ```python
108
+ from libqasm import Analyzer
109
+
110
+ if __name__ == "__main__":
111
+ parse_result = Analyzer.parse_file('example.cq')
112
+
113
+ analyzer = Analyzer()
114
+ analysis_result = analyzer.analyze_file('example.cq')
115
+ ```
116
+
117
+ ## Documentation
118
+
119
+ The [libQASM documentation](https://QuTech-Delft.github.io/libqasm/) is hosted through GitHub Pages.
120
+
121
+ ## License
122
+
123
+ libQASM is licensed under the Apache License, Version 2.0.
124
+ See [LICENSE](https://github.com/QuTech-Delft/libqasm/blob/master/LICENSE.md) for the full license text.
125
+
126
+ ## Authors
127
+
128
+ Quantum Inspire: [support@quantum-inspire.com](mailto:"support@quantum-inspire.com")
@@ -0,0 +1,16 @@
1
+ cqasm/__init__.py,sha256=_6Yl-eMBve0mGQA-aiFg4qvQ7GUCV5eGvIcoRf4mEPw,3
2
+ cqasm/v3x/__init__.py,sha256=s1r1kbfl9iGONOuB7V2HQ6llIbQ0CWiiGVytzjIRPng,4888
3
+ cqasm/v3x/ast.py,sha256=QeHMdDypm7BVatATNlR80G4aJ1rTEj29_V7m39ED0Mk,431365
4
+ cqasm/v3x/instruction.py,sha256=VAOqFpCH94CrutgMUZnQq8JXFIq_-C-ndTOjHLsg6_8,1219
5
+ cqasm/v3x/primitives.py,sha256=lkxg0gHMFba-O803cOh0QqOANFHsZDK0iHvIluFz-qI,2110
6
+ cqasm/v3x/semantic.py,sha256=5nd_aCdVkK6K06hBXf6i98rkv5fbAbFQoXaXHvs2uJs,117716
7
+ cqasm/v3x/types.py,sha256=krT1WB5URT0F7lhKTLwYAs_UtTCn9CZ7-M0WMGmxtU4,65070
8
+ cqasm/v3x/values.py,sha256=SfKw6zIjpMrXJggvN_QGPqsoZXDR7HwUjgUMOBnIzuo,63394
9
+ libqasm/__init__.py,sha256=X0G-HBFW9_uEcsaGROQ1nzxYfHzSuglOiXrpTpjF9_E,752
10
+ libqasm/_libqasm.cp310-win_amd64.pyd,sha256=RQMzHcQ4ycEVAJh8kUp4z2vuXAz50OSw9D0_kSokOhs,2363904
11
+ libqasm/libqasm.py,sha256=nLcGTD9njpy5FSPFp0ZPwvWjzjd6lqEjaa2w1WZZ8RI,31701
12
+ libqasm-0.6.8.dist-info/LICENSE.md,sha256=395F6Sje50f5Too7yWFAoS_owYO4aOtjbMeQd_go_sk,579
13
+ libqasm-0.6.8.dist-info/METADATA,sha256=hPrPSrGVnLqWCY2ta5EaMNgWHQ7G8LCNkRIeJZanghg,4163
14
+ libqasm-0.6.8.dist-info/WHEEL,sha256=IqiWNwTSPPvorR7mTezuRY2eqj__44JKKkjOiewDX64,101
15
+ libqasm-0.6.8.dist-info/top_level.txt,sha256=iZ8PSLyg3lJwvSUCvWE8VCJGU-nmQY2YIrbMe7M7kLw,14
16
+ libqasm-0.6.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-cp310-win_amd64
5
5
 
@@ -1,224 +0,0 @@
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
- [![CI](https://github.com/QuTech-Delft/libqasm/workflows/Test/badge.svg)](https://github.com/qutech-delft/libqasm/actions)
20
- [![PyPI](https://badgen.net/pypi/v/libqasm)](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
- ```
@@ -1,16 +0,0 @@
1
- cqasm/__init__.py,sha256=_6Yl-eMBve0mGQA-aiFg4qvQ7GUCV5eGvIcoRf4mEPw,3
2
- cqasm/v3x/__init__.py,sha256=FlmtSTjj083f3t9kTkJBsgs3rQBcgVEkYBqcJ4aKmzs,2850
3
- cqasm/v3x/ast.py,sha256=snvmnaN80AU5_uJhUAaRsooakjFiMxUG5fUJshkjcVM,420170
4
- cqasm/v3x/instruction.py,sha256=VAOqFpCH94CrutgMUZnQq8JXFIq_-C-ndTOjHLsg6_8,1219
5
- cqasm/v3x/primitives.py,sha256=cR3SvCcG5lCzjSFMwHrMSRpf4Bj3Q1tkxUgaaltYJg8,1731
6
- cqasm/v3x/semantic.py,sha256=wN9awUdn76sNp1WlzV5P4R4Z54r-W0JC4D-xaDzQec4,88679
7
- cqasm/v3x/types.py,sha256=krT1WB5URT0F7lhKTLwYAs_UtTCn9CZ7-M0WMGmxtU4,65070
8
- cqasm/v3x/values.py,sha256=SfKw6zIjpMrXJggvN_QGPqsoZXDR7HwUjgUMOBnIzuo,63394
9
- libqasm/__init__.py,sha256=X0G-HBFW9_uEcsaGROQ1nzxYfHzSuglOiXrpTpjF9_E,752
10
- libqasm/_libqasm.cp310-win_amd64.pyd,sha256=gMZH-TNtrPu57dyaB0JSljQQA6VA10BQII9hO9EZh2s,2290688
11
- libqasm/libqasm.py,sha256=TBkHUGljxJ3aWcBoPqTRcftMXAF2cDkwbw6HLP7zZuM,31677
12
- libqasm-0.6.6.dist-info/LICENSE.md,sha256=395F6Sje50f5Too7yWFAoS_owYO4aOtjbMeQd_go_sk,579
13
- libqasm-0.6.6.dist-info/METADATA,sha256=Hi6F1jn1w0o-S3SzPjbXbDJUsIMUE5K1Bj3vtNDGzwc,6775
14
- libqasm-0.6.6.dist-info/WHEEL,sha256=lO6CqtLHCAi38X3Es1a4R1lAjZFvN010IMRCFo2S7Mc,102
15
- libqasm-0.6.6.dist-info/top_level.txt,sha256=iZ8PSLyg3lJwvSUCvWE8VCJGU-nmQY2YIrbMe7M7kLw,14
16
- libqasm-0.6.6.dist-info/RECORD,,