masterly 0.1.1__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.
- masterly/__init__.py +14 -0
- masterly/_client.py +89 -0
- masterly/_extract.py +122 -0
- masterly/_ingest.py +68 -0
- masterly/py.typed +0 -0
- masterly-0.1.1.dist-info/METADATA +78 -0
- masterly-0.1.1.dist-info/RECORD +9 -0
- masterly-0.1.1.dist-info/WHEEL +4 -0
- masterly-0.1.1.dist-info/licenses/LICENSE +202 -0
masterly/__init__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Masterly Python client — extract governed data products, ingest records.
|
|
2
|
+
|
|
3
|
+
A thin, typed wrapper over the stable ``/v1`` REST contract (the same API the GUI, MCP,
|
|
4
|
+
and stream channels ride). Built for notebook and pipeline use on Databricks, Microsoft
|
|
5
|
+
Fabric, and plain Python: sync calls, cursor paging handled for you, optional pandas.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from masterly._client import ApiError, Client
|
|
9
|
+
from masterly._extract import ChangeFeed, RowPages
|
|
10
|
+
from masterly._ingest import IngestReport
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.1"
|
|
13
|
+
|
|
14
|
+
__all__ = ["ApiError", "ChangeFeed", "Client", "IngestReport", "RowPages", "__version__"]
|
masterly/_client.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""The client shell: connection, auth, error mapping. Every call carries the bearer token
|
|
2
|
+
and the Environment header; errors surface the server's error envelope verbatim."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import contextlib
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
10
|
+
|
|
11
|
+
from masterly._extract import GoldenApi, ProductsApi
|
|
12
|
+
from masterly._ingest import SourcesApi
|
|
13
|
+
|
|
14
|
+
_TIMEOUT = httpx.Timeout(30.0, connect=10.0)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ApiError(Exception):
|
|
18
|
+
"""A non-2xx answer from the API, carrying the server's error code and message."""
|
|
19
|
+
|
|
20
|
+
def __init__(self, status_code: int, code: str, message: str) -> None:
|
|
21
|
+
self.status_code = status_code
|
|
22
|
+
self.code = code
|
|
23
|
+
self.message = message
|
|
24
|
+
super().__init__(f"{code} ({status_code}): {message}")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Client:
|
|
28
|
+
"""Connection to one Masterly Environment.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
base_url: The install's URL, e.g. ``https://app.example.com``.
|
|
32
|
+
token: A session or service-account bearer token.
|
|
33
|
+
environment: The Environment id, e.g. ``env_prod_eu``.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(
|
|
37
|
+
self,
|
|
38
|
+
base_url: str,
|
|
39
|
+
token: str,
|
|
40
|
+
environment: str,
|
|
41
|
+
*,
|
|
42
|
+
transport: httpx.BaseTransport | None = None,
|
|
43
|
+
) -> None:
|
|
44
|
+
from masterly import __version__
|
|
45
|
+
|
|
46
|
+
self._http = httpx.Client(
|
|
47
|
+
base_url=base_url.rstrip("/"),
|
|
48
|
+
headers={
|
|
49
|
+
"Authorization": f"Bearer {token}",
|
|
50
|
+
"X-Masterly-Environment": environment,
|
|
51
|
+
"User-Agent": f"masterly-python/{__version__}",
|
|
52
|
+
},
|
|
53
|
+
timeout=_TIMEOUT,
|
|
54
|
+
transport=transport,
|
|
55
|
+
)
|
|
56
|
+
self.products = ProductsApi(self)
|
|
57
|
+
self.sources = SourcesApi(self)
|
|
58
|
+
self.golden = GoldenApi(self)
|
|
59
|
+
|
|
60
|
+
def close(self) -> None:
|
|
61
|
+
self._http.close()
|
|
62
|
+
|
|
63
|
+
def __enter__(self) -> Client:
|
|
64
|
+
return self
|
|
65
|
+
|
|
66
|
+
def __exit__(self, *exc: object) -> None:
|
|
67
|
+
self.close()
|
|
68
|
+
|
|
69
|
+
# --- internal ---------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
def _request(
|
|
72
|
+
self,
|
|
73
|
+
method: str,
|
|
74
|
+
path: str,
|
|
75
|
+
*,
|
|
76
|
+
params: dict[str, Any] | None = None,
|
|
77
|
+
json: Any | None = None,
|
|
78
|
+
) -> Any:
|
|
79
|
+
response = self._http.request(method, path, params=params, json=json)
|
|
80
|
+
if response.status_code >= 400:
|
|
81
|
+
code, message = "HTTP_ERROR", response.text[:500]
|
|
82
|
+
with contextlib.suppress(Exception): # a non-JSON error body stays a plain HTTP error
|
|
83
|
+
envelope = response.json().get("error", {})
|
|
84
|
+
code = envelope.get("code", code)
|
|
85
|
+
message = envelope.get("message", message)
|
|
86
|
+
raise ApiError(response.status_code, code, message)
|
|
87
|
+
if response.status_code == 204 or not response.content:
|
|
88
|
+
return None
|
|
89
|
+
return response.json()
|
masterly/_extract.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Extract: data products (paged reads + the resumable change feed) and golden records.
|
|
2
|
+
|
|
3
|
+
Iterators own the cursor plumbing — a notebook writes ``for row in client.products.read(...)``
|
|
4
|
+
and never sees a page. ``to_pandas()`` is available wherever pandas is installed
|
|
5
|
+
(``pip install masterly[pandas]``); it is never imported unless asked for.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from collections.abc import Iterator
|
|
11
|
+
from typing import TYPE_CHECKING, Any
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING: # pandas stays optional at runtime
|
|
14
|
+
import pandas
|
|
15
|
+
|
|
16
|
+
from masterly._client import Client
|
|
17
|
+
|
|
18
|
+
_PAGE_SIZE = 200 # the API caps limit at 200
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _to_pandas(rows: Iterator[dict[str, Any]]) -> pandas.DataFrame:
|
|
22
|
+
try:
|
|
23
|
+
import pandas
|
|
24
|
+
except ImportError as exc: # pragma: no cover - environment-specific
|
|
25
|
+
raise ImportError(
|
|
26
|
+
"pandas is not installed — install the extra: pip install masterly[pandas]"
|
|
27
|
+
) from exc
|
|
28
|
+
return pandas.DataFrame(list(rows))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RowPages:
|
|
32
|
+
"""Iterates every row of a product (or golden listing), fetching pages lazily."""
|
|
33
|
+
|
|
34
|
+
def __init__(
|
|
35
|
+
self, client: Client, path: str, params: dict[str, Any] | None = None
|
|
36
|
+
) -> None:
|
|
37
|
+
self._client = client
|
|
38
|
+
self._path = path
|
|
39
|
+
self._params = params or {}
|
|
40
|
+
|
|
41
|
+
def __iter__(self) -> Iterator[dict[str, Any]]:
|
|
42
|
+
cursor: str | None = None
|
|
43
|
+
while True:
|
|
44
|
+
params: dict[str, Any] = {**self._params, "limit": _PAGE_SIZE}
|
|
45
|
+
if cursor:
|
|
46
|
+
params["cursor"] = cursor
|
|
47
|
+
page = self._client._request("GET", self._path, params=params)
|
|
48
|
+
yield from page.get("items", [])
|
|
49
|
+
cursor = page.get("next_cursor")
|
|
50
|
+
if not cursor:
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
def to_pandas(self) -> pandas.DataFrame:
|
|
54
|
+
"""All rows as a DataFrame. Loads everything — page manually for huge products."""
|
|
55
|
+
return _to_pandas(iter(self))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class ChangeFeed:
|
|
59
|
+
"""The product change feed with a **resumable cursor** (persist ``feed.cursor`` after a
|
|
60
|
+
run and pass it back next time — every change is delivered at least once)."""
|
|
61
|
+
|
|
62
|
+
def __init__(self, client: Client, path: str, cursor: str | None) -> None:
|
|
63
|
+
self._client = client
|
|
64
|
+
self._path = path
|
|
65
|
+
self.cursor = cursor
|
|
66
|
+
|
|
67
|
+
def __iter__(self) -> Iterator[dict[str, Any]]:
|
|
68
|
+
while True:
|
|
69
|
+
params: dict[str, Any] = {"limit": _PAGE_SIZE}
|
|
70
|
+
if self.cursor:
|
|
71
|
+
params["cursor"] = self.cursor
|
|
72
|
+
page = self._client._request("GET", self._path, params=params)
|
|
73
|
+
items = page.get("items", [])
|
|
74
|
+
yield from items
|
|
75
|
+
next_cursor = page.get("next_cursor")
|
|
76
|
+
if next_cursor:
|
|
77
|
+
self.cursor = next_cursor
|
|
78
|
+
if not next_cursor or not items:
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ProductsApi:
|
|
83
|
+
def __init__(self, client: Client) -> None:
|
|
84
|
+
self._client = client
|
|
85
|
+
|
|
86
|
+
def list(self) -> list[dict[str, Any]]:
|
|
87
|
+
"""Every data product visible to the caller."""
|
|
88
|
+
page = self._client._request("GET", "/v1/data-products")
|
|
89
|
+
items: list[dict[str, Any]] = page.get("items", [])
|
|
90
|
+
return items
|
|
91
|
+
|
|
92
|
+
def _resolve(self, product: str) -> str:
|
|
93
|
+
"""Accept a product id (``dp_…``) or its exact name."""
|
|
94
|
+
if product.startswith("dp_"):
|
|
95
|
+
return product
|
|
96
|
+
matches = [p for p in self.list() if p.get("name") == product]
|
|
97
|
+
if not matches:
|
|
98
|
+
raise LookupError(f"no data product named '{product}'")
|
|
99
|
+
product_id: str = matches[0]["product_id"]
|
|
100
|
+
return product_id
|
|
101
|
+
|
|
102
|
+
def read(self, product: str, **params: Any) -> RowPages:
|
|
103
|
+
"""Every row of a published product, cursor-paged behind the iterator."""
|
|
104
|
+
product_id = self._resolve(product)
|
|
105
|
+
return RowPages(self._client, f"/v1/consume/products/{product_id}", params)
|
|
106
|
+
|
|
107
|
+
def changes(self, product: str, cursor: str | None = None) -> ChangeFeed:
|
|
108
|
+
"""Changes since ``cursor`` (or from the beginning). Persist ``feed.cursor``."""
|
|
109
|
+
product_id = self._resolve(product)
|
|
110
|
+
return ChangeFeed(self._client, f"/v1/consume/products/{product_id}/changes", cursor)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class GoldenApi:
|
|
114
|
+
def __init__(self, client: Client) -> None:
|
|
115
|
+
self._client = client
|
|
116
|
+
|
|
117
|
+
def list(self, model: str, *, q: str | None = None) -> RowPages:
|
|
118
|
+
"""Golden records of a model — the resolved single view, before any product shaping."""
|
|
119
|
+
params: dict[str, Any] = {"model": model}
|
|
120
|
+
if q:
|
|
121
|
+
params["q"] = q
|
|
122
|
+
return RowPages(self._client, "/v1/golden", params)
|
masterly/_ingest.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Ingest: deliver records to a source. Batches are chunked client-side and accepted
|
|
2
|
+
asynchronously by the platform (202) — mapping, validation, quarantine, matching, and
|
|
3
|
+
golden resolution run exactly as for every other channel."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from collections.abc import Sequence
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from typing import TYPE_CHECKING, Any
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from masterly._client import Client
|
|
13
|
+
|
|
14
|
+
_BATCH_SIZE = 500
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass(frozen=True)
|
|
18
|
+
class IngestReport:
|
|
19
|
+
"""What was handed to the platform. Acceptance is asynchronous: invalid records land in
|
|
20
|
+
the source's quarantine with a reason rather than failing the call."""
|
|
21
|
+
|
|
22
|
+
source_id: str
|
|
23
|
+
records: int
|
|
24
|
+
batches: int
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class SourcesApi:
|
|
28
|
+
def __init__(self, client: Client) -> None:
|
|
29
|
+
self._client = client
|
|
30
|
+
|
|
31
|
+
def list(self) -> list[dict[str, Any]]:
|
|
32
|
+
page = self._client._request("GET", "/v1/sources")
|
|
33
|
+
items: list[dict[str, Any]] = page.get("items", [])
|
|
34
|
+
return items
|
|
35
|
+
|
|
36
|
+
def _resolve(self, source: str) -> str:
|
|
37
|
+
"""Accept a source id (``src_…``) or its exact name."""
|
|
38
|
+
if source.startswith("src_"):
|
|
39
|
+
return source
|
|
40
|
+
matches = [s for s in self.list() if s.get("name") == source]
|
|
41
|
+
if not matches:
|
|
42
|
+
raise LookupError(f"no source named '{source}'")
|
|
43
|
+
source_id: str = matches[0]["source_id"]
|
|
44
|
+
return source_id
|
|
45
|
+
|
|
46
|
+
def ingest(
|
|
47
|
+
self,
|
|
48
|
+
source: str,
|
|
49
|
+
records: Sequence[dict[str, Any]],
|
|
50
|
+
*,
|
|
51
|
+
batch_size: int = _BATCH_SIZE,
|
|
52
|
+
) -> IngestReport:
|
|
53
|
+
"""Deliver records to a source, chunked into accepted batches.
|
|
54
|
+
|
|
55
|
+
Re-delivery is safe: records upsert by their source key, so running the same
|
|
56
|
+
notebook twice never duplicates data.
|
|
57
|
+
"""
|
|
58
|
+
if batch_size < 1:
|
|
59
|
+
raise ValueError("batch_size must be at least 1")
|
|
60
|
+
source_id = self._resolve(source)
|
|
61
|
+
batches = 0
|
|
62
|
+
for start in range(0, len(records), batch_size):
|
|
63
|
+
chunk = records[start : start + batch_size]
|
|
64
|
+
self._client._request(
|
|
65
|
+
"POST", "/v1/ingest", json={"source_id": source_id, "records": chunk}
|
|
66
|
+
)
|
|
67
|
+
batches += 1
|
|
68
|
+
return IngestReport(source_id=source_id, records=len(records), batches=batches)
|
masterly/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: masterly
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Python client for Masterly — extract governed data products and ingest records from your lakehouse
|
|
5
|
+
Project-URL: Homepage, https://masterlydata.com
|
|
6
|
+
Project-URL: Documentation, https://masterlydata.com/docs/reference/python-sdk/
|
|
7
|
+
Project-URL: Repository, https://github.com/masterly-data/masterly-python-sdk
|
|
8
|
+
Project-URL: Changelog, https://github.com/masterly-data/masterly-python-sdk/releases
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: data products,databricks,fabric,lakehouse,master data,mdm,snowflake
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Provides-Extra: pandas
|
|
25
|
+
Requires-Dist: pandas>=2.0; extra == 'pandas'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# masterly — Python client
|
|
29
|
+
|
|
30
|
+
Extract governed data products and ingest records from Python — notebooks on Databricks,
|
|
31
|
+
Microsoft Fabric, or anywhere else your pipelines run.
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from masterly import Client
|
|
35
|
+
|
|
36
|
+
client = Client(
|
|
37
|
+
base_url="https://app.example.com", # your Masterly install
|
|
38
|
+
token="<session or service-account token>",
|
|
39
|
+
environment="env_prod_eu",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
# Extract: page through a data product (cursor-managed for you)
|
|
43
|
+
for row in client.products.read("Customer 360"):
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
# Or straight into a DataFrame
|
|
47
|
+
df = client.products.read("Customer 360").to_pandas()
|
|
48
|
+
|
|
49
|
+
# Follow the change feed with a resumable cursor
|
|
50
|
+
feed = client.products.changes("Customer 360", cursor=saved_cursor)
|
|
51
|
+
for change in feed:
|
|
52
|
+
...
|
|
53
|
+
save(feed.cursor) # persist for the next run
|
|
54
|
+
|
|
55
|
+
# Ingest: deliver records to a source (chunked automatically)
|
|
56
|
+
report = client.sources.ingest("crm", records)
|
|
57
|
+
print(report.records, "records in", report.batches, "batches")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Tokens: two personas
|
|
61
|
+
|
|
62
|
+
- **Consumer** (extract in a Databricks/Fabric job): use a **service-account token**
|
|
63
|
+
(minted under Users → Service accounts). It pins its Environment and consumes published
|
|
64
|
+
products — reference them **by product id** (`dp_…`), since listing products needs a
|
|
65
|
+
session. Access policies (row rules, masks) apply per consumer automatically.
|
|
66
|
+
- **Integrator** (ingest + golden reads): use a **session token**. Sources and products can
|
|
67
|
+
be referenced by name.
|
|
68
|
+
|
|
69
|
+
The client is a thin, typed wrapper over the stable `/v1` REST contract — the same API
|
|
70
|
+
every other channel uses. Errors raise `masterly.ApiError` carrying the server's error
|
|
71
|
+
code and message. Re-delivery is idempotent: records upsert by their source key, so
|
|
72
|
+
running the same notebook twice never duplicates data.
|
|
73
|
+
|
|
74
|
+
`pandas` is an optional dependency: `pip install masterly[pandas]`.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
masterly/__init__.py,sha256=s5yIn2MzZCIKPoTCYHT9Q1GkA2te8F3TLMFui5U82ho,599
|
|
2
|
+
masterly/_client.py,sha256=kOkxqdqGg3QMEtmhrXhKWdVFLet0M7yO2NA7zPjjmH0,2812
|
|
3
|
+
masterly/_extract.py,sha256=jWo0ALsCBm_M18ERz6lobMGtrlb2VMc-1skqkbwM1v8,4577
|
|
4
|
+
masterly/_ingest.py,sha256=FIhownjEdU1ZtvZycrF6uvqZMgeOrLPKSXPwFv2Nu0M,2307
|
|
5
|
+
masterly/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
masterly-0.1.1.dist-info/METADATA,sha256=5ztU-aXUn30JM9H5Q7FiB5lCk4hzXikeKGTZaxOVFIw,3127
|
|
7
|
+
masterly-0.1.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
8
|
+
masterly-0.1.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
9
|
+
masterly-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|