humemdb 0.2.0.dev0__cp311-abi3-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.
- humemdb/__init__.py +62 -0
- humemdb/_humemdb.pyd +0 -0
- humemdb/_humemdb.pyi +211 -0
- humemdb/py.typed +0 -0
- humemdb-0.2.0.dev0.dist-info/METADATA +56 -0
- humemdb-0.2.0.dev0.dist-info/RECORD +9 -0
- humemdb-0.2.0.dev0.dist-info/WHEEL +4 -0
- humemdb-0.2.0.dev0.dist-info/licenses/LICENSE +201 -0
- humemdb-0.2.0.dev0.dist-info/sboms/humemdb-python.cyclonedx.json +2456 -0
humemdb/__init__.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""HumemDB: an embedded database for agent memory, over one SQLite file.
|
|
2
|
+
|
|
3
|
+
Pre-release: everything here is unstable and will change.
|
|
4
|
+
|
|
5
|
+
``humemdb.connect(path)`` returns a ``Connection`` that follows PEP 249 for SQL in SQLite's
|
|
6
|
+
autocommit, runs ``with conn.transaction():`` blocks in one transaction, and answers Cypher with
|
|
7
|
+
``conn.cypher(query, params)``. Connections to one file in a process share one database.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from importlib.metadata import version as _version
|
|
11
|
+
|
|
12
|
+
from ._humemdb import (
|
|
13
|
+
Connection,
|
|
14
|
+
Counters,
|
|
15
|
+
Cursor,
|
|
16
|
+
DatabaseError,
|
|
17
|
+
DataError,
|
|
18
|
+
Error,
|
|
19
|
+
IntegrityError,
|
|
20
|
+
InterfaceError,
|
|
21
|
+
InternalError,
|
|
22
|
+
NotSupportedError,
|
|
23
|
+
OperationalError,
|
|
24
|
+
ProgrammingError,
|
|
25
|
+
Record,
|
|
26
|
+
Result,
|
|
27
|
+
Transaction,
|
|
28
|
+
Warning,
|
|
29
|
+
apilevel,
|
|
30
|
+
connect,
|
|
31
|
+
paramstyle,
|
|
32
|
+
sqlite_version,
|
|
33
|
+
threadsafety,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
__version__ = _version("humemdb")
|
|
37
|
+
"""The version of the installed package, the one in its metadata (PEP 440: `0.2.0.dev0`)."""
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"Connection",
|
|
41
|
+
"Counters",
|
|
42
|
+
"Cursor",
|
|
43
|
+
"DatabaseError",
|
|
44
|
+
"DataError",
|
|
45
|
+
"Error",
|
|
46
|
+
"IntegrityError",
|
|
47
|
+
"InterfaceError",
|
|
48
|
+
"InternalError",
|
|
49
|
+
"NotSupportedError",
|
|
50
|
+
"OperationalError",
|
|
51
|
+
"ProgrammingError",
|
|
52
|
+
"Record",
|
|
53
|
+
"Result",
|
|
54
|
+
"Transaction",
|
|
55
|
+
"Warning",
|
|
56
|
+
"__version__",
|
|
57
|
+
"apilevel",
|
|
58
|
+
"connect",
|
|
59
|
+
"paramstyle",
|
|
60
|
+
"sqlite_version",
|
|
61
|
+
"threadsafety",
|
|
62
|
+
]
|
humemdb/_humemdb.pyd
ADDED
|
Binary file
|
humemdb/_humemdb.pyi
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Type stubs of the extension module, kept by hand (#19). Pre-release and unstable.
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
import os
|
|
5
|
+
from collections.abc import Iterable, Iterator, Mapping, Sequence
|
|
6
|
+
from types import TracebackType
|
|
7
|
+
from typing import Any, Final, Literal, TypeAlias, overload
|
|
8
|
+
|
|
9
|
+
# What a parameter may be. A date or a datetime binds as its isoformat() text; in Cypher it is a
|
|
10
|
+
# date, a datetime (with a time zone) or a local datetime (naive), and a str is a string, which never equals one. A list or a dict goes
|
|
11
|
+
# to SQL as JSON text.
|
|
12
|
+
Param: TypeAlias = (
|
|
13
|
+
None
|
|
14
|
+
| bool
|
|
15
|
+
| int
|
|
16
|
+
| float
|
|
17
|
+
| str
|
|
18
|
+
| bytes
|
|
19
|
+
| bytearray
|
|
20
|
+
| datetime.date
|
|
21
|
+
| datetime.datetime
|
|
22
|
+
| list[Any]
|
|
23
|
+
| tuple[Any, ...]
|
|
24
|
+
| dict[str, Any]
|
|
25
|
+
)
|
|
26
|
+
# What a SQL row holds: the five SQLite types.
|
|
27
|
+
SqlValue: TypeAlias = None | int | float | str | bytes
|
|
28
|
+
# What a Cypher record holds. A node is a dict of its properties with "_labels", a relationship
|
|
29
|
+
# one with "_type". A node that is a whole column of the result (`RETURN n`) has "_labels" or
|
|
30
|
+
# "_type" first and then its properties that are not null in the order of the mapping; a node
|
|
31
|
+
# inside a list or a map has its keys in alphabetical order.
|
|
32
|
+
CypherValue: TypeAlias = (
|
|
33
|
+
None
|
|
34
|
+
| bool
|
|
35
|
+
| int
|
|
36
|
+
| float
|
|
37
|
+
| str
|
|
38
|
+
| bytes
|
|
39
|
+
| datetime.date
|
|
40
|
+
| datetime.datetime
|
|
41
|
+
| list[Any]
|
|
42
|
+
| dict[str, Any]
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
apilevel: Final[str]
|
|
46
|
+
threadsafety: Final[int]
|
|
47
|
+
paramstyle: Final[str]
|
|
48
|
+
sqlite_version: Final[str]
|
|
49
|
+
|
|
50
|
+
class Warning(Exception): ...
|
|
51
|
+
class Error(Exception): ...
|
|
52
|
+
class InterfaceError(Error): ...
|
|
53
|
+
class DatabaseError(Error): ...
|
|
54
|
+
class DataError(DatabaseError): ...
|
|
55
|
+
class OperationalError(DatabaseError): ...
|
|
56
|
+
class IntegrityError(DatabaseError): ...
|
|
57
|
+
class InternalError(DatabaseError): ...
|
|
58
|
+
class ProgrammingError(DatabaseError): ...
|
|
59
|
+
class NotSupportedError(DatabaseError): ...
|
|
60
|
+
|
|
61
|
+
def connect(
|
|
62
|
+
database: str | os.PathLike[str],
|
|
63
|
+
*,
|
|
64
|
+
readers: int | None = None,
|
|
65
|
+
cache_entries: int | None = None,
|
|
66
|
+
mapping: Mapping[str, Any] | None = None,
|
|
67
|
+
) -> Connection:
|
|
68
|
+
"""Open a handle on the database of a file, or a new one for ":memory:".
|
|
69
|
+
|
|
70
|
+
Connecting again to a file open in this process shares its database. `readers` is the most
|
|
71
|
+
read-only connections beside the writer (4), `cache_entries` the most compiled Cypher
|
|
72
|
+
programs kept (256), and `mapping` declares node and relationship sources in place of the
|
|
73
|
+
inferred mapping (unstable): {"nodes": [{"table": "event", "labels": ["Event"],
|
|
74
|
+
"key": ["id"], "properties": {"name": "string", "day": "date", "at": "datetime"}}],
|
|
75
|
+
"relationships": [{"type": "FOLLOWS", "table": "follows", "key": ["src", "dst"],
|
|
76
|
+
"from": {"table": "event", "columns": ["src"]},
|
|
77
|
+
"to": {"table": "event", "columns": ["dst"]}}]}. A relationship with "type", "table", and
|
|
78
|
+
"to" only is a foreign key of the node table "table". An end may name the node columns it
|
|
79
|
+
references in "referenced" (the node's key when left out). A
|
|
80
|
+
"date", "datetime", or "localdatetime" column holds one standard text form; a statement
|
|
81
|
+
that compares it is refused until the SQL its message names has run (README, "Dates and
|
|
82
|
+
datetimes").
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
class Connection:
|
|
86
|
+
@property
|
|
87
|
+
def in_transaction(self) -> bool: ...
|
|
88
|
+
def cursor(self) -> Cursor: ...
|
|
89
|
+
def execute(self, sql: str, parameters: Sequence[Param] | None = None) -> Cursor: ...
|
|
90
|
+
def executemany(self, sql: str, seq_of_parameters: Iterable[Sequence[Param]]) -> Cursor:
|
|
91
|
+
"""Run the statement once per parameter sequence, all in one transaction."""
|
|
92
|
+
def executescript(self, sql_script: str) -> Cursor:
|
|
93
|
+
"""Inside a block, a script with a transaction statement raises ProgrammingError."""
|
|
94
|
+
def commit(self) -> None:
|
|
95
|
+
"""Nothing to do outside a block (autocommit); ProgrammingError inside one."""
|
|
96
|
+
def rollback(self) -> None:
|
|
97
|
+
"""Nothing to do outside a block (autocommit); ProgrammingError inside one."""
|
|
98
|
+
def close(self) -> None: ...
|
|
99
|
+
def transaction(self) -> Transaction:
|
|
100
|
+
"""`with conn.transaction():` commits when the block ends and rolls back when it raises."""
|
|
101
|
+
def __enter__(self) -> Connection:
|
|
102
|
+
"""`with conn:` is `with conn.transaction():`."""
|
|
103
|
+
def __exit__(
|
|
104
|
+
self,
|
|
105
|
+
exc_type: type[BaseException] | None,
|
|
106
|
+
exc: BaseException | None,
|
|
107
|
+
tb: TracebackType | None,
|
|
108
|
+
) -> Literal[False]: ...
|
|
109
|
+
def cypher(
|
|
110
|
+
self,
|
|
111
|
+
query: str,
|
|
112
|
+
parameters: Mapping[str, Param] | None = None,
|
|
113
|
+
**kwparameters: Param,
|
|
114
|
+
) -> Result: ...
|
|
115
|
+
def explain(
|
|
116
|
+
self,
|
|
117
|
+
query: str,
|
|
118
|
+
parameters: Mapping[str, Param] | None = None,
|
|
119
|
+
**kwparameters: Param,
|
|
120
|
+
) -> dict[str, Any]:
|
|
121
|
+
"""What a Cypher statement would do, without running it: access, parameters, columns,
|
|
122
|
+
steps (kind, tables, sql, parameters), and notices (among them the ON DELETE actions of
|
|
123
|
+
tables outside the graph that a delete may start)."""
|
|
124
|
+
@property
|
|
125
|
+
def checksums(self) -> bool:
|
|
126
|
+
"""Whether the file keeps and verifies a checksum on each page (a file that HumemDB
|
|
127
|
+
creates does; a database in memory and an older file do not)."""
|
|
128
|
+
def enable_checksums(self) -> None:
|
|
129
|
+
"""Give a file with no page checksums one on every page: VACUUM rewrites the file, so it
|
|
130
|
+
needs room for a second copy; run it with no other statement running."""
|
|
131
|
+
|
|
132
|
+
class Transaction:
|
|
133
|
+
def __enter__(self) -> Connection: ...
|
|
134
|
+
def __exit__(
|
|
135
|
+
self,
|
|
136
|
+
exc_type: type[BaseException] | None,
|
|
137
|
+
exc: BaseException | None,
|
|
138
|
+
tb: TracebackType | None,
|
|
139
|
+
) -> Literal[False]: ...
|
|
140
|
+
|
|
141
|
+
class Cursor:
|
|
142
|
+
arraysize: int
|
|
143
|
+
@property
|
|
144
|
+
def description(
|
|
145
|
+
self,
|
|
146
|
+
) -> tuple[tuple[str, None, None, None, None, None, None], ...] | None: ...
|
|
147
|
+
@property
|
|
148
|
+
def rowcount(self) -> int: ...
|
|
149
|
+
@property
|
|
150
|
+
def lastrowid(self) -> int | None: ...
|
|
151
|
+
@property
|
|
152
|
+
def connection(self) -> Connection: ...
|
|
153
|
+
def execute(self, sql: str, parameters: Sequence[Param] | None = None) -> Cursor: ...
|
|
154
|
+
def executemany(self, sql: str, seq_of_parameters: Iterable[Sequence[Param]]) -> Cursor: ...
|
|
155
|
+
def fetchone(self) -> tuple[SqlValue, ...] | None: ...
|
|
156
|
+
def fetchmany(self, size: int | None = None) -> list[tuple[SqlValue, ...]]: ...
|
|
157
|
+
def fetchall(self) -> list[tuple[SqlValue, ...]]: ...
|
|
158
|
+
def close(self) -> None: ...
|
|
159
|
+
def setinputsizes(self, sizes: Any) -> None: ...
|
|
160
|
+
def setoutputsize(self, size: Any, column: Any = None) -> None: ...
|
|
161
|
+
def __iter__(self) -> Cursor: ...
|
|
162
|
+
def __next__(self) -> tuple[SqlValue, ...]: ...
|
|
163
|
+
def __arrow_c_stream__(self, requested_schema: object | None = None) -> object:
|
|
164
|
+
"""The rows not fetched yet as an Arrow C stream (a PyCapsule); the cursor is then exhausted."""
|
|
165
|
+
|
|
166
|
+
class Record:
|
|
167
|
+
@overload
|
|
168
|
+
def __getitem__(self, key: str) -> CypherValue: ...
|
|
169
|
+
@overload
|
|
170
|
+
def __getitem__(self, key: int) -> CypherValue: ...
|
|
171
|
+
def get(self, key: str | int, default: Any = None) -> Any: ...
|
|
172
|
+
def keys(self) -> list[str]: ...
|
|
173
|
+
def values(self) -> list[CypherValue]: ...
|
|
174
|
+
def items(self) -> list[tuple[str, CypherValue]]: ...
|
|
175
|
+
def data(self) -> dict[str, CypherValue]: ...
|
|
176
|
+
def __len__(self) -> int: ...
|
|
177
|
+
def __iter__(self) -> Iterator[CypherValue]: ...
|
|
178
|
+
|
|
179
|
+
class Counters:
|
|
180
|
+
"""What a Cypher write changed, as Neo4j counts it."""
|
|
181
|
+
|
|
182
|
+
@property
|
|
183
|
+
def nodes_created(self) -> int: ...
|
|
184
|
+
@property
|
|
185
|
+
def nodes_deleted(self) -> int: ...
|
|
186
|
+
@property
|
|
187
|
+
def relationships_created(self) -> int: ...
|
|
188
|
+
@property
|
|
189
|
+
def relationships_deleted(self) -> int: ...
|
|
190
|
+
@property
|
|
191
|
+
def properties_set(self) -> int: ...
|
|
192
|
+
@property
|
|
193
|
+
def contains_updates(self) -> bool: ...
|
|
194
|
+
def __eq__(self, other: object) -> bool: ...
|
|
195
|
+
|
|
196
|
+
class Result:
|
|
197
|
+
@property
|
|
198
|
+
def records(self) -> list[Record]: ...
|
|
199
|
+
@property
|
|
200
|
+
def notices(self) -> list[str]: ...
|
|
201
|
+
@property
|
|
202
|
+
def counters(self) -> Counters | None:
|
|
203
|
+
"""What a write changed; None for a statement that is not a write."""
|
|
204
|
+
def keys(self) -> list[str]: ...
|
|
205
|
+
def data(self) -> list[dict[str, CypherValue]]: ...
|
|
206
|
+
def single(self, strict: bool = False) -> Record | None:
|
|
207
|
+
"""The one record, None for none; the first with a warning for more (strict raises)."""
|
|
208
|
+
def __len__(self) -> int: ...
|
|
209
|
+
def __iter__(self) -> Iterator[Record]: ...
|
|
210
|
+
def __arrow_c_stream__(self, requested_schema: object | None = None) -> object:
|
|
211
|
+
"""Every record as an Arrow C stream (a PyCapsule), typed from the compiled query."""
|
humemdb/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: humemdb
|
|
3
|
+
Version: 0.2.0.dev0
|
|
4
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: Programming Language :: Rust
|
|
7
|
+
Classifier: Topic :: Database
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Summary: An embedded database for agent memory: one SQLite file, SQL and Cypher in the same transactions (pre-alpha, unstable API)
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
13
|
+
Project-URL: Repository, https://github.com/humemai/humemdb
|
|
14
|
+
|
|
15
|
+
# humemdb (Python)
|
|
16
|
+
|
|
17
|
+
The Python binding of HumemDB, built in Rust with PyO3 and maturin as one abi3 wheel per platform for CPython 3.11 and later. Pre-alpha: the first release is prepared and not published yet, and the API will change ([#19](https://github.com/humemai/humemdb/issues/19)).
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
import humemdb
|
|
21
|
+
|
|
22
|
+
conn = humemdb.connect("memory.db")
|
|
23
|
+
conn.execute("CREATE TABLE IF NOT EXISTS person(id INTEGER PRIMARY KEY, name TEXT)")
|
|
24
|
+
with conn.transaction():
|
|
25
|
+
conn.execute("INSERT INTO person(name) VALUES (?)", ("Ada",))
|
|
26
|
+
for record in conn.cypher("MATCH (p:person) RETURN p.name AS name"):
|
|
27
|
+
print(record["name"])
|
|
28
|
+
|
|
29
|
+
# a cursor and a Cypher result are Arrow streams; pyarrow and polars are optional
|
|
30
|
+
import pyarrow
|
|
31
|
+
table = pyarrow.table(conn.execute("SELECT * FROM person"))
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The first release is `0.2.0.dev0`, not published yet; from the release on it installs with `uv add --prerelease allow humemdb` (a pre-release is installed only when asked; once a version without `dev` is the newest, `uv add humemdb` is enough). CI builds the abi3 wheel for manylinux_2_28 (x86-64 and arm64), musllinux_1_2 (x86-64), macOS (arm64 and x86-64), and Windows (x86-64).
|
|
35
|
+
|
|
36
|
+
See the top-level README for the API and `examples/quickstart.py` for a runnable example.
|
|
37
|
+
|
|
38
|
+
## Speed
|
|
39
|
+
|
|
40
|
+
`bench/bench.py` measures what a call and a value cost against `sqlite3` in one process, and what the pieces of one call cost (an interpreter-lock round trip, a cursor, the engine call, a parameter, a fetch). Build the wheel, then run it from this directory (untimed: the ratios are what it is for, the official timed run is [#161](https://github.com/humemai/humemdb/issues/161)):
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv build --wheel -o dist
|
|
44
|
+
uv run --no-project --with dist/humemdb-*.whl --with pyarrow python -I bench/bench.py all
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Where the binding stands against the targets of the plan, and what the misses are, is in [the research note](../../docs/research/python-binding.md#where-the-binding-stands-against-the-targets). Those figures are an untimed screening on one laptop; the timed run on a quiet lane is the study.
|
|
48
|
+
|
|
49
|
+
Ctrl-C stops a long statement: a `KeyboardInterrupt` ends it within 100 ms (3 ms in a screening), the statement's transaction rolls back, and the connection goes on. SQLite calls a check every 10,000 instructions of a statement, and the check looks for a signal at most every 10 ms; it costs about 35 ns for each statement that runs.
|
|
50
|
+
|
|
51
|
+
The release profile of the workspace builds with one codegen unit and fat link-time optimisation. The binding is a cdylib over the engine, and without it the cost of a call moved by 4 to 5 percent between builds that changed only code off its path; with it a trivial call, a lookup and a node value are 6 to 15 percent cheaper (#161).
|
|
52
|
+
|
|
53
|
+
SQL statements go through a per-connection cache of 128 prepared statements, as in `sqlite3`: a statement that SQLite's authorizer noted something on (a temp object, an attached database, a `PRAGMA`, `last_insert_rowid()`) is not cached, since a cached run would not note it again.
|
|
54
|
+
|
|
55
|
+
A database in memory (`":memory:"`) is a `memdb` file to SQLite, so its pages are copied into the page cache when read. Its connections take a page cache of up to 128 MiB (SQLite's default is 2 MB), which grows only with what is read, so that a random read of a larger table does not evict and copy again. A file keeps SQLite's default.
|
|
56
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
humemdb/__init__.py,sha256=-7wyi3lRokQ3RC3fYmqgGpjclvPzh4ITL9eWQMd2z08,1456
|
|
2
|
+
humemdb/_humemdb.pyd,sha256=uWWqfGa5sg5AQJpudWm3u7A6blgLqgd0RPVkAgZcdQA,6923264
|
|
3
|
+
humemdb/_humemdb.pyi,sha256=WtoyeG8eikcDAyvaUpqnRwshcRfW52BwcpebWeZQvhA,8699
|
|
4
|
+
humemdb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
humemdb-0.2.0.dev0.dist-info/METADATA,sha256=0Z6h-Ub3J6eMIh92z5R1VeARvpe3C4tKUCHOkq6TAfc,3965
|
|
6
|
+
humemdb-0.2.0.dev0.dist-info/WHEEL,sha256=DRguzO_JHkJTcrXDweuHyM66sVwM00caBYZ3J_zMn0w,96
|
|
7
|
+
humemdb-0.2.0.dev0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
8
|
+
humemdb-0.2.0.dev0.dist-info/sboms/humemdb-python.cyclonedx.json,sha256=q-JCZDBhU3LMFDuXOYJcm-hC_5JWAv_zOCkZ8jPiLiU,76143
|
|
9
|
+
humemdb-0.2.0.dev0.dist-info/RECORD,,
|
|
@@ -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.
|