qilisdk 0.1.0__py3-none-any.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.
Files changed (47) hide show
  1. qilisdk/__init__.py +47 -0
  2. qilisdk/__init__.pyi +30 -0
  3. qilisdk/_optionals.py +105 -0
  4. qilisdk/analog/__init__.py +17 -0
  5. qilisdk/analog/algorithms.py +111 -0
  6. qilisdk/analog/analog_backend.py +43 -0
  7. qilisdk/analog/analog_result.py +114 -0
  8. qilisdk/analog/exceptions.py +19 -0
  9. qilisdk/analog/hamiltonian.py +706 -0
  10. qilisdk/analog/quantum_objects.py +486 -0
  11. qilisdk/analog/schedule.py +311 -0
  12. qilisdk/common/__init__.py +20 -0
  13. qilisdk/common/algorithm.py +17 -0
  14. qilisdk/common/backend.py +16 -0
  15. qilisdk/common/model.py +16 -0
  16. qilisdk/common/optimizer.py +136 -0
  17. qilisdk/common/optimizer_result.py +110 -0
  18. qilisdk/common/result.py +17 -0
  19. qilisdk/digital/__init__.py +66 -0
  20. qilisdk/digital/ansatz.py +143 -0
  21. qilisdk/digital/circuit.py +106 -0
  22. qilisdk/digital/digital_algorithm.py +20 -0
  23. qilisdk/digital/digital_backend.py +90 -0
  24. qilisdk/digital/digital_result.py +145 -0
  25. qilisdk/digital/exceptions.py +31 -0
  26. qilisdk/digital/gates.py +989 -0
  27. qilisdk/digital/vqe.py +165 -0
  28. qilisdk/extras/__init__.py +13 -0
  29. qilisdk/extras/cuda/__init__.py +18 -0
  30. qilisdk/extras/cuda/cuda_analog_result.py +19 -0
  31. qilisdk/extras/cuda/cuda_backend.py +398 -0
  32. qilisdk/extras/cuda/cuda_digital_result.py +19 -0
  33. qilisdk/extras/qaas/__init__.py +13 -0
  34. qilisdk/extras/qaas/keyring.py +54 -0
  35. qilisdk/extras/qaas/models.py +57 -0
  36. qilisdk/extras/qaas/qaas_backend.py +154 -0
  37. qilisdk/extras/qaas/qaas_digital_result.py +20 -0
  38. qilisdk/extras/qaas/qaas_settings.py +23 -0
  39. qilisdk/py.typed +0 -0
  40. qilisdk/utils/__init__.py +27 -0
  41. qilisdk/utils/openqasm2.py +215 -0
  42. qilisdk/utils/serialization.py +128 -0
  43. qilisdk/yaml.py +71 -0
  44. qilisdk-0.1.0.dist-info/METADATA +237 -0
  45. qilisdk-0.1.0.dist-info/RECORD +47 -0
  46. qilisdk-0.1.0.dist-info/WHEEL +4 -0
  47. qilisdk-0.1.0.dist-info/licenses/LICENCE +201 -0
qilisdk/yaml.py ADDED
@@ -0,0 +1,71 @@
1
+ # Copyright 2025 Qilimanjaro Quantum Tech
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.
14
+
15
+ # ruff: noqa: ANN001, ANN201 DOC201, S403
16
+
17
+ import base64
18
+ import types
19
+
20
+ import numpy as np
21
+ from dill import dumps, loads
22
+ from ruamel.yaml import YAML
23
+
24
+
25
+ def ndarray_representer(representer, data):
26
+ """Representer for ndarray"""
27
+ value = {"dtype": str(data.dtype), "shape": data.shape, "data": data.ravel().tolist()}
28
+ return representer.represent_mapping("!ndarray", value)
29
+
30
+
31
+ def ndarray_constructor(constructor, node):
32
+ """Constructor for ndarray"""
33
+ mapping = constructor.construct_mapping(node, deep=True)
34
+ dtype = np.dtype(mapping["dtype"])
35
+ shape = tuple(mapping["shape"])
36
+ data = mapping["data"]
37
+ return np.array(data, dtype=dtype).reshape(shape)
38
+
39
+
40
+ def function_representer(representer, data):
41
+ """Represent a non-lambda function by serializing it."""
42
+ serialized_function = base64.b64encode(dumps(data)).decode("utf-8")
43
+ return representer.represent_scalar("!function", serialized_function)
44
+
45
+
46
+ def function_constructor(constructor, node):
47
+ """Reconstruct a function from the serialized data."""
48
+ serialized_function = base64.b64decode(node.value)
49
+ return loads(serialized_function) # noqa: S301
50
+
51
+
52
+ def lambda_representer(representer, data):
53
+ """Represent a lambda function by serializing its code."""
54
+ serialized_lambda = base64.b64encode(dumps(data)).decode("utf-8")
55
+ return representer.represent_scalar("!lambda", serialized_lambda)
56
+
57
+
58
+ def lambda_constructor(constructor, node):
59
+ """Reconstruct a lambda function from the serialized data."""
60
+ # Decode the base64-encoded string and load the lambda function
61
+ serialized_lambda = base64.b64decode(node.value)
62
+ return loads(serialized_lambda) # noqa: S301
63
+
64
+
65
+ yaml = YAML(typ="unsafe")
66
+ yaml.representer.add_representer(np.ndarray, ndarray_representer)
67
+ yaml.constructor.add_constructor("!ndarray", ndarray_constructor)
68
+ yaml.representer.add_representer(types.FunctionType, function_representer)
69
+ yaml.constructor.add_constructor("!function", function_constructor)
70
+ yaml.representer.add_representer(types.LambdaType, lambda_representer)
71
+ yaml.constructor.add_constructor("!lambda", lambda_constructor)
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: qilisdk
3
+ Version: 0.1.0
4
+ Summary: qilisdk is a Python framework for writing digital and analog quantum algorithms and executing them across multiple quantum backends. Its modular design streamlines the development process and enables easy integration with a variety of quantum platforms.
5
+ Author-email: Qilimanjaro Quantum Tech <info@qilimanjaro.tech>
6
+ License-File: LICENCE
7
+ Keywords: analog quantum computing,digital quantum computing,qilimanjaro,quantum computing
8
+ Classifier: Development Status :: 1 - Planning
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Scientific/Engineering :: Physics
20
+ Classifier: Topic :: Scientific/Engineering :: Quantum Computing
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: dill>=0.3.9
23
+ Requires-Dist: numpy>=2.2.4
24
+ Requires-Dist: ruamel-yaml>=0.18.10
25
+ Requires-Dist: scipy>=1.15.1
26
+ Provides-Extra: cuda
27
+ Requires-Dist: cudaq==0.9.1; extra == 'cuda'
28
+ Provides-Extra: qaas
29
+ Requires-Dist: httpx>=0.28.1; extra == 'qaas'
30
+ Requires-Dist: keyring>=25.6.0; extra == 'qaas'
31
+ Requires-Dist: pydantic-settings>=2.8.0; extra == 'qaas'
32
+ Requires-Dist: pydantic>=2.10.6; extra == 'qaas'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # qilisdk
36
+
37
+ [![Python Versions](https://img.shields.io/pypi/pyversions/qilisdk.svg)](https://pypi.org/project/qilisdk/)
38
+ [![PyPI Version](https://img.shields.io/pypi/v/qilisdk.svg)](https://pypi.org/project/qilisdk/)
39
+ [![License](https://img.shields.io/pypi/l/qilisdk.svg)](#license)
40
+
41
+ **qilisdk** is a Python framework for writing digital and analog quantum algorithms and executing them across multiple quantum backends. Its modular design streamlines the development process and enables easy integration with a variety of quantum platforms.
42
+
43
+ > **Note**: The instructions below focus on developing and contributing to qilisdk. For installation and usage as an end user, see the [Usage](#usage) section (placeholder).
44
+
45
+ ---
46
+
47
+ ## Table of Contents
48
+ - [qilisdk](#qilisdk)
49
+ - [Table of Contents](#table-of-contents)
50
+ - [Development](#development)
51
+ - [Prerequisites](#prerequisites)
52
+ - [Setup \& Dependency Management](#setup--dependency-management)
53
+ - [Testing](#testing)
54
+ - [Linting \& Formatting](#linting--formatting)
55
+ - [Type Checking](#type-checking)
56
+ - [Changelog Management](#changelog-management)
57
+ - [Contributing](#contributing)
58
+ - [Usage](#usage)
59
+ - [License](#license)
60
+ - [Acknowledgments](#acknowledgments)
61
+
62
+ ---
63
+
64
+ ## Development
65
+
66
+ This section covers how to set up a local development environment for qilisdk, run tests, enforce code style, manage dependencies, and contribute to the project. We use a number of tools to maintain code quality and consistency:
67
+
68
+ - **[uv](https://pypi.org/project/uv/)** for dependency management and packaging.
69
+ - **[ruff](https://beta.ruff.rs/docs/)** for linting and code formatting.
70
+ - **[mypy](http://mypy-lang.org/)** for static type checking.
71
+ - **[towncrier](https://github.com/twisted/towncrier)** for automated changelog generation.
72
+
73
+ ### Prerequisites
74
+
75
+ - Python **3.10+** (we test against multiple versions, but 3.10 is the minimum for local dev).
76
+ - [Git](https://git-scm.com/) for version control.
77
+ - [uv](https://pypi.org/project/uv/) for dependency management.
78
+
79
+ ### Setup & Dependency Management
80
+
81
+ 1. **Clone the repository**:
82
+ ```bash
83
+ git clone https://github.com/qilimanjaro-tech/qilisdk.git
84
+ cd qilisdk
85
+ ```
86
+
87
+ 2. **Install [uv](https://pypi.org/project/uv/) globally** (if not already):
88
+ ```bash
89
+ curl -LsSf https://astral.sh/uv/install.sh | sh
90
+ ```
91
+
92
+ 3. **Sync dependencies**:
93
+ - We maintain a `pyproject.toml` listing all dev and optional requirements.
94
+ - To install the dev environment locally, run:
95
+ ```bash
96
+ uv sync
97
+ ```
98
+ This sets up a virtual environment and installs all pinned dependencies (including `ruff`, `mypy`, `towncrier`, etc.).
99
+ - To install extra dependencies such as `qibo-backend`, run:
100
+ ```bash
101
+ uv sync --extra qibo-backend -extra ...
102
+ ```
103
+ This sets up a virtual environment and installs all pinned dependencies (previous), plus the specified extras.
104
+
105
+ 4. **Activate the virtual environment**:
106
+ - uv typically creates and manages its own environment, e.g., `.venv/`.
107
+ - Run:
108
+ ```bash
109
+ source .venv/bin/activate
110
+ ```
111
+ *(Exact command can vary depending on your shell and OS.)*
112
+
113
+ Now you can run all development commands (tests, linting, etc.) within this environment.
114
+
115
+ ### Testing
116
+
117
+ TODO: to_be_filled
118
+
119
+ ### Linting & Formatting
120
+
121
+ We enforce code style and best practices using [**ruff**](https://beta.ruff.rs/docs/). ruff handles:
122
+
123
+ - Lint checks (similar to flake8, pylint).
124
+ - Formatting (similar to black or isort).
125
+ - Automated fixes for certain issues.
126
+
127
+ To check linting:
128
+
129
+ ```bash
130
+ ruff check
131
+ ```
132
+
133
+ To automatically fix lint issues (where possible):
134
+
135
+ ```bash
136
+ ruff check --fix
137
+ ```
138
+
139
+ To automatically format your code:
140
+
141
+ ```bash
142
+ ruff format
143
+ ```
144
+
145
+ *(We recommend running `ruff check --fix` and `ruff format` before committing any changes.)*
146
+
147
+ ### Type Checking
148
+
149
+ We use [**mypy**](http://mypy-lang.org/) for static type checking. This helps ensure our code is type-safe and maintainable.
150
+
151
+ ```bash
152
+ mypy qilisdk
153
+ ```
154
+
155
+ If you have extra modules or tests you want type-checked, specify them:
156
+
157
+ ```bash
158
+ mypy qilisdk tests
159
+ ```
160
+
161
+ *(We encourage developers to annotate new functions, classes, and methods with type hints.)*
162
+
163
+ ### Changelog Management
164
+
165
+ We manage our changelog using [**towncrier**](https://github.com/twisted/towncrier). Instead of editing `CHANGELOG.md` directly, **each pull request** includes a small *news fragment* file in the `changes/` directory describing the user-facing changes.
166
+
167
+ For example, if you create a PR with id #123 adding a new feature, you add:
168
+ ```
169
+ changes/123.feature.rst
170
+ ```
171
+ Inside this file, you briefly describe the new feature:
172
+ ```rst
173
+ Added a new `cool_feature` in the `qilisdk.extras` module.
174
+ ```
175
+ Instead of manually creating the file, you can run:
176
+ ```bash
177
+ towncrier create --no-edit
178
+ ```
179
+ When we cut a new release, we update the version in `pyproject.toml` file and run:
180
+ ```bash
181
+ towncrier
182
+ ```
183
+ This aggregates all the news fragments into the `CHANGELOG.md` under the new version and removes the used fragments.
184
+
185
+ ### Contributing
186
+
187
+ We welcome contributions! Here’s the workflow:
188
+
189
+ 1. **Fork** this repository and create a feature branch.
190
+ 2. **Write** your changes (code, docs, or tests).
191
+ 3. **Add a news fragment** (if applicable) in `changes/` describing the user-facing impact.
192
+ 4. **Run** the following checks locally:
193
+ ```bash
194
+ ruff check --fix
195
+ ruff format
196
+ mypy qilisdk
197
+ pytest tests
198
+ ```
199
+ 5. **Commit** and push your branch to your fork. `pre-commit` will also run the checks automatically.
200
+ 6. **Open a Pull Request** against the `main` branch here.
201
+
202
+ Our CI will run tests, linting, and type checks. Please make sure your branch passes these checks before requesting a review.
203
+
204
+ ---
205
+
206
+ ## Usage
207
+
208
+ *(Placeholder for end users. Provide a brief snippet on how to install qilisdk and use its main features. For example:)*
209
+
210
+ ```bash
211
+ pip install qilisdk
212
+ ```
213
+
214
+ ```python
215
+ from qilisdk import core_feature
216
+
217
+ result = core_feature.do_something()
218
+ print(result)
219
+ ```
220
+
221
+ ---
222
+
223
+ ## License
224
+
225
+ This project is licensed under the [Apache License](LICENSE).
226
+
227
+ ---
228
+
229
+ ## Acknowledgments
230
+
231
+ - Thanks to all the contributors who help develop qilisdk!
232
+ - [uv](https://pypi.org/project/uv/) for making dependency management smoother.
233
+ - [ruff](https://beta.ruff.rs/docs/), [mypy](http://mypy-lang.org/), and [towncrier](https://github.com/twisted/towncrier) for their amazing tooling.
234
+
235
+ ---
236
+
237
+ Feel free to open [issues](https://github.com/qilimanjaro-tech/qilisdk/issues) or [pull requests](https://github.com/qilimanjaro-tech/qilisdk/pulls) if you have questions or contributions. Happy coding!
@@ -0,0 +1,47 @@
1
+ qilisdk/__init__.py,sha256=O3tFo8LdNtcDjkgP5uoEc9V8cxMzCeMbY-FBFSXJfdk,1823
2
+ qilisdk/__init__.pyi,sha256=oiX2eVc8cHCGuip0Too3tnN7OD48H5QnGbatryFQHMs,1008
3
+ qilisdk/_optionals.py,sha256=gl6yZ2sROY-USvNkXy6964OBOrDNKJAIyBU8D2H13z4,3594
4
+ qilisdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ qilisdk/yaml.py,sha256=HX-erLJnHfZK8WQrNPhzZAfJDP93L0eKtlzd1S4_Q18,2701
6
+ qilisdk/analog/__init__.py,sha256=44Z3QEELqCjm1BDAAE9i16_pZoo8zaGLkbTIsPo4TOw,685
7
+ qilisdk/analog/algorithms.py,sha256=OiQma6y5ueNE1buXXbNexme1k1aQaIg1A00C6mX10JQ,4621
8
+ qilisdk/analog/analog_backend.py,sha256=GRCqlCslo8F0iB8N6Mn-_0IFJos6xRbadwVvk3lYilc,1753
9
+ qilisdk/analog/analog_result.py,sha256=pi4TOvBbBpt1_8PrRRzS2iYByQy-qUXwpNeBf2RqEwM,4698
10
+ qilisdk/analog/exceptions.py,sha256=66nF1b3God6LgJ1IQd0thC3iyr6z1iMcZTfmDsSr4LE,686
11
+ qilisdk/analog/hamiltonian.py,sha256=ELQXIauk_foOQbOChTFIV4fYzTwqHhSP1tMw8PwytaQ,25126
12
+ qilisdk/analog/quantum_objects.py,sha256=_M7hkZOD-NW0FjoTtkrFFDVICxQ2cH7OP0xlfqjtuTE,18833
13
+ qilisdk/analog/schedule.py,sha256=AHpiBPN1YZb9J2WNw6MyRPjRWAyqLVIiGFj5y_rwDmA,12807
14
+ qilisdk/common/__init__.py,sha256=Djp6uVxpw9U5pBRGcUD0C1EvU_MRo2fhodeGgXV0pmo,798
15
+ qilisdk/common/algorithm.py,sha256=_MBdMHIJogTPnR8QRCvpf364lxQNDqGWWyZpsgplcyI,636
16
+ qilisdk/common/backend.py,sha256=dPzjqplkDTfCbLvY68M5z0ALxmgugWeCjVLuG_EqW70,609
17
+ qilisdk/common/model.py,sha256=lwK0xW_sitLj7bw7aNh5xrMWVE2HoKIk2irkGpsc8as,607
18
+ qilisdk/common/optimizer.py,sha256=jIBntTMw5qw03RRp5gzQe4BO9bh_z3Oeh_qfwbot0bI,5860
19
+ qilisdk/common/optimizer_result.py,sha256=Xqrej4QfuDofya-MpyfXm-FIlJqrCu7worio5oqb3rQ,3990
20
+ qilisdk/common/result.py,sha256=wgNCC_M0eQMArWl5nmDc0-1N5IvW1sxSnIZa7_OllCE,633
21
+ qilisdk/digital/__init__.py,sha256=PW29pvoLPt4OgESbiW-hgcH9FLbwuWfwrpoeSo94WWo,1268
22
+ qilisdk/digital/ansatz.py,sha256=lKiEo8PXG5QoxXB7b2Sp0oF3JL2meHrew66d9iOwWMk,5830
23
+ qilisdk/digital/circuit.py,sha256=ruE1bJJkJrCKQgbBYU0-sNHWwEI1QKiUbK76owjb32M,3628
24
+ qilisdk/digital/digital_algorithm.py,sha256=ncrmqd_y__1aaOA5ttOLlwCNyIBNdEpBazLapVa54-w,744
25
+ qilisdk/digital/digital_backend.py,sha256=PH514eEEjPAo3R_JnzsG4DVrwssIMzWHJFjcpT440TU,3393
26
+ qilisdk/digital/digital_result.py,sha256=0f1h4JHWRPkKEBCerYptmLN7yG5_IN4YchUPNEH6ZOY,5286
27
+ qilisdk/digital/exceptions.py,sha256=21RnaSBkzZOuQWcIWVB303F4nyU1ABOykhAYow4m7lA,871
28
+ qilisdk/digital/gates.py,sha256=Ylf9iwDNONaatzIrrPpXi6H59C7bMvrq-tWyIK5ZykU,29614
29
+ qilisdk/digital/vqe.py,sha256=ynEL2oTTDZayeR3nDxV3vI4J0SCQQ_qY4uZcDUbTimo,6627
30
+ qilisdk/extras/__init__.py,sha256=LDSTo7NstSbHMvvqvx7ZLxh0HFTEXg1O_B76SyEEHk8,588
31
+ qilisdk/extras/cuda/__init__.py,sha256=hesw7M0_AoWBaeW4iGb-rq5eD16b7aP7VKI_oE7ACN0,726
32
+ qilisdk/extras/cuda/cuda_analog_result.py,sha256=0IoBZpkPfxS5CDps1Z6uRH1ATWG689klYR1RvGyUhBU,737
33
+ qilisdk/extras/cuda/cuda_backend.py,sha256=71hDYkl04WSNkwvEodAq9S-pT_qxAz7bWONdkQ59G0w,16382
34
+ qilisdk/extras/cuda/cuda_digital_result.py,sha256=bgHCrmcUVCBngo443PhfLkMxAT8Kk24FRubU3bJsdsQ,742
35
+ qilisdk/extras/qaas/__init__.py,sha256=LDSTo7NstSbHMvvqvx7ZLxh0HFTEXg1O_B76SyEEHk8,588
36
+ qilisdk/extras/qaas/keyring.py,sha256=xjJj6wrRALj31foctYTGZ07wgusVyIGuzeKxU-MNAA0,1774
37
+ qilisdk/extras/qaas/models.py,sha256=EfNX1DSRAUaanYjdmIXkktduxoKWvXrJnobFQs-HXBM,1584
38
+ qilisdk/extras/qaas/qaas_backend.py,sha256=u69Jl-LPvDw3BV_gQGZAwLeTKVhqyBUM_YgoLZmbfB8,5831
39
+ qilisdk/extras/qaas/qaas_digital_result.py,sha256=9EaZujlXvdmqdfVD-laDJq_I8YO5bc3XHRvEobOYR1U,743
40
+ qilisdk/extras/qaas/qaas_settings.py,sha256=Vl-OPs0ijht7GqxjztY-Id3nEinfE48j_J-d9mJ4Ctk,935
41
+ qilisdk/utils/__init__.py,sha256=cFdezrFwesp9azZEBG_CWq3_Qp1yH8do_PyJbIIdSkU,920
42
+ qilisdk/utils/openqasm2.py,sha256=QGQi2rrkYB_cqRgCyp3V3uDyfnVvcdMxykIiK0-sqXM,8316
43
+ qilisdk/utils/serialization.py,sha256=vp-q2SZ9cBq3NX-gfT3ZDt0tzF3KnxkhV0cM7imJ2zo,3870
44
+ qilisdk-0.1.0.dist-info/METADATA,sha256=2n4gy_pBnb3rf9NhpUX52zoKMP3LrmpU8dMydImZsYI,8161
45
+ qilisdk-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
46
+ qilisdk-0.1.0.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
+ qilisdk-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.