tensorbase-sdk 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.
tensorbase/_volumes.py ADDED
@@ -0,0 +1,204 @@
1
+ """Volumes: durable files shared by functions, sandboxes and desktops."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import shutil
7
+ import urllib.parse
8
+ from typing import Dict, Iterator, List, Optional, Union
9
+
10
+ from ._client import Client, TensorbaseError, default_client
11
+
12
+
13
+ def _q(s: str) -> str:
14
+ return urllib.parse.quote(s, safe="")
15
+
16
+
17
+ class Volume:
18
+ """A workspace volume.
19
+
20
+ Mount it into functions, sandboxes and desktops::
21
+
22
+ @app.function(volumes=[tb.Volume("models", "/models")])
23
+ def predict(x): ...
24
+
25
+ tb.Sandbox.create(volumes=[tb.Volume("models", "/models", read_only=True)])
26
+
27
+ or work with its files from anywhere::
28
+
29
+ vol = tb.Volume.create("models") # or tb.Volume("models")
30
+ vol.write_file("config.json", b"{}")
31
+ vol.put_file("weights.bin", "out/weights.bin")
32
+ vol.listdir("out")
33
+ vol.read_file("out/weights.bin")
34
+
35
+ Workloads that mount a volume see API changes within seconds, and their own changes are
36
+ committed every 30 seconds and when they stop or pause. When two writers change the same
37
+ file, the last commit wins.
38
+ """
39
+
40
+ def __init__(self, name: str, mount_path: str = "", *, read_only: bool = False, client: Optional[Client] = None):
41
+ self.name = name
42
+ self.mount_path = mount_path
43
+ self.read_only = read_only
44
+ self._client = client
45
+ self._id: Optional[str] = name if name.startswith("vol_") else None
46
+
47
+ def __repr__(self) -> str:
48
+ return f"Volume({self.name!r}" + (f", {self.mount_path!r}" if self.mount_path else "") + ")"
49
+
50
+ def __eq__(self, other) -> bool:
51
+ return isinstance(other, Volume) and (self.name, self.mount_path, self.read_only) == (other.name, other.mount_path, other.read_only)
52
+
53
+ def mount(self) -> dict:
54
+ """The mount entry for a sandbox or desktop."""
55
+ if not self.mount_path:
56
+ raise ValueError(f"{self!r} needs a mount_path to be mounted")
57
+ d = {"volume": self.name, "mount_path": self.mount_path}
58
+ if self.read_only:
59
+ d["read_only"] = True
60
+ return d
61
+
62
+ # ---------- management ----------
63
+
64
+ @property
65
+ def client(self) -> Client:
66
+ return self._client or default_client()
67
+
68
+ @classmethod
69
+ def create(cls, name: str, *, exist_ok: bool = True, client: Optional[Client] = None) -> "Volume":
70
+ c = client or default_client()
71
+ try:
72
+ data = c.request("POST", f"/v1/workspaces/{_q(c.need_workspace())}/volumes", {"name": name})
73
+ except TensorbaseError as e:
74
+ if e.status == 409 and exist_ok:
75
+ return cls(name, client=c)
76
+ raise
77
+ v = cls(name, client=c)
78
+ v._id = data["id"]
79
+ return v
80
+
81
+ @classmethod
82
+ def list(cls, *, client: Optional[Client] = None) -> List[dict]:
83
+ c = client or default_client()
84
+ return c.request("GET", f"/v1/workspaces/{_q(c.need_workspace())}/volumes")["items"]
85
+
86
+ @property
87
+ def id(self) -> str:
88
+ if self._id is None:
89
+ for v in Volume.list(client=self.client):
90
+ if v["name"] == self.name:
91
+ self._id = v["id"]
92
+ break
93
+ else:
94
+ raise TensorbaseError(404, "NOT_FOUND", f"volume {self.name} not found")
95
+ return self._id
96
+
97
+ def _path(self, suffix: str = "") -> str:
98
+ return f"/v1/volumes/{_q(self.id)}{suffix}"
99
+
100
+ def info(self) -> dict:
101
+ """Size, file count, version and whether running workloads mount it."""
102
+ return self.client.request("GET", self._path())
103
+
104
+ def delete(self) -> None:
105
+ """Deletes the volume and every file in it."""
106
+ self.client.request("DELETE", self._path())
107
+
108
+ # ---------- files ----------
109
+
110
+ def listdir(self, path: str = "", *, recursive: bool = False) -> List[dict]:
111
+ """Entries under ``path``: dicts with path, size_bytes, is_dir, mode, modified_at."""
112
+ res = self.client.request("GET", self._path("/files"), query={"prefix": path.strip("/"), "recursive": str(recursive).lower()})
113
+ return res["items"]
114
+
115
+ def iterdir(self, path: str = "") -> Iterator[str]:
116
+ for e in self.listdir(path):
117
+ yield e["path"]
118
+
119
+ def exists(self, path: str) -> bool:
120
+ path = path.strip("/")
121
+ parent = os.path.dirname(path)
122
+ return any(e["path"] == path for e in self.listdir(parent))
123
+
124
+ def read_file(self, path: str) -> bytes:
125
+ return self.client.request_raw("GET", self._path("/content"), query={"path": path})
126
+
127
+ def read_text(self, path: str, encoding: str = "utf-8") -> str:
128
+ return self.read_file(path).decode(encoding)
129
+
130
+ def write_file(self, path: str, data: Union[str, bytes], *, mode: Optional[int] = None) -> dict:
131
+ if isinstance(data, str):
132
+ data = data.encode()
133
+ q = {"path": path, "mode": None if mode is None else format(mode, "o")}
134
+ with self.client.open("PUT", self._path("/content"), data, q, content_type="application/octet-stream", length=len(data)) as res:
135
+ import json
136
+ return json.loads(res.read())
137
+
138
+ def put_file(self, local_path: str, path: Optional[str] = None) -> dict:
139
+ """Uploads a local file (streamed) to ``path`` (default: its base name)."""
140
+ path = path or os.path.basename(local_path)
141
+ size = os.path.getsize(local_path)
142
+ mode = os.stat(local_path).st_mode & 0o777
143
+ with open(local_path, "rb") as f, self.client.open("PUT", self._path("/content"), f, {"path": path, "mode": format(mode, "o")},
144
+ timeout=3600, content_type="application/octet-stream", length=size) as res:
145
+ import json
146
+ return json.loads(res.read())
147
+
148
+ def put_directory(self, local_dir: str, path: str = "") -> int:
149
+ """Uploads a local directory tree under ``path``; returns the number of files."""
150
+ n = 0
151
+ for root, _dirs, files in os.walk(local_dir):
152
+ for name in files:
153
+ src = os.path.join(root, name)
154
+ if not os.path.isfile(src) or os.path.islink(src):
155
+ continue
156
+ rel = os.path.relpath(src, local_dir).replace(os.sep, "/")
157
+ self.put_file(src, f"{path.strip('/')}/{rel}".lstrip("/"))
158
+ n += 1
159
+ return n
160
+
161
+ def get_file(self, path: str, local_path: Optional[str] = None) -> str:
162
+ """Downloads a file (streamed) and returns the local path."""
163
+ local_path = local_path or os.path.basename(path.rstrip("/"))
164
+ os.makedirs(os.path.dirname(os.path.abspath(local_path)), exist_ok=True)
165
+ tmp = local_path + ".tb-part"
166
+ with self.client.open("GET", self._path("/content"), None, {"path": path}, timeout=3600) as res, open(tmp, "wb") as f:
167
+ shutil.copyfileobj(res, f, 1 << 20)
168
+ os.replace(tmp, local_path)
169
+ return local_path
170
+
171
+ def get_directory(self, path: str = "", local_dir: str = ".") -> int:
172
+ """Downloads everything under ``path`` into ``local_dir``; returns the number of files."""
173
+ prefix = path.strip("/")
174
+ n = 0
175
+ for e in self.listdir(prefix, recursive=True):
176
+ rel = e["path"][len(prefix):].lstrip("/") if prefix else e["path"]
177
+ dst = os.path.join(local_dir, *rel.split("/"))
178
+ if e["is_dir"]:
179
+ os.makedirs(dst, exist_ok=True)
180
+ else:
181
+ self.get_file(e["path"], dst)
182
+ n += 1
183
+ return n
184
+
185
+ def mkdir(self, path: str) -> dict:
186
+ return self.client.request("POST", self._path("/directories"), {"path": path})
187
+
188
+ def remove(self, path: str, *, recursive: bool = False) -> None:
189
+ """Deletes a file, or a directory with ``recursive=True``."""
190
+ self.client.request("DELETE", self._path("/files"), query={"path": path, "recursive": str(recursive).lower()})
191
+
192
+
193
+ def mounts(volumes) -> Optional[List[dict]]:
194
+ """Accepts a list of Volume, or a {mount_path: Volume | name} mapping."""
195
+ if not volumes:
196
+ return None
197
+ if isinstance(volumes, dict):
198
+ out = []
199
+ for path, v in volumes.items():
200
+ name = v.name if isinstance(v, Volume) else str(v)
201
+ ro = v.read_only if isinstance(v, Volume) else False
202
+ out.append(Volume(name, path, read_only=ro).mount())
203
+ return out
204
+ return [v.mount() for v in volumes]
tensorbase/webhooks.py ADDED
@@ -0,0 +1,79 @@
1
+ """Verify Tensorbase webhook and task callback deliveries.
2
+
3
+ Every delivery is signed with the Standard Webhooks scheme (https://www.standardwebhooks.com):
4
+
5
+ from tensorbase import webhooks
6
+
7
+ @app.post("/tensorbase")
8
+ async def receive(request):
9
+ body = await request.body() # the raw bytes, before any JSON parsing
10
+ event = webhooks.verify(SECRET, request.headers, body)
11
+ if event["type"] == "task.succeeded":
12
+ ...
13
+
14
+ ``SECRET`` is the ``whsec_…`` secret shown when the webhook was created (``tb webhook create``),
15
+ or, for task callbacks, the workspace callback secret (``tb webhook callback-secret``).
16
+ Deliveries are at least once: deduplicate on ``event["id"]`` (the ``webhook-id`` header).
17
+ """
18
+
19
+ import base64
20
+ import hashlib
21
+ import hmac
22
+ import json
23
+ import time
24
+ from typing import Any, Mapping, Optional, Union
25
+
26
+ __all__ = ["WebhookVerificationError", "sign", "verify"]
27
+
28
+ TOLERANCE_SECONDS = 5 * 60
29
+
30
+
31
+ class WebhookVerificationError(Exception):
32
+ """The signature or timestamp of a delivery is not valid."""
33
+
34
+
35
+ def _key(secret: str) -> bytes:
36
+ raw = secret[len("whsec_"):] if secret.startswith("whsec_") else secret
37
+ try:
38
+ return base64.b64decode(raw, validate=True)
39
+ except ValueError as e:
40
+ raise WebhookVerificationError("malformed signing secret") from e
41
+
42
+
43
+ def sign(secret: str, msg_id: str, timestamp: int, body: bytes) -> str:
44
+ """Return the ``v1,<base64>`` signature of a message (for tests of your receiver)."""
45
+ mac = hmac.new(_key(secret), f"{msg_id}.{timestamp}.".encode() + body, hashlib.sha256)
46
+ return "v1," + base64.b64encode(mac.digest()).decode()
47
+
48
+
49
+ def _header(headers: Mapping[str, str], name: str) -> Optional[str]:
50
+ if name in headers:
51
+ return headers[name]
52
+ lower = name.lower()
53
+ for k, v in headers.items():
54
+ if k.lower() == lower:
55
+ return v
56
+ return None
57
+
58
+
59
+ def verify(secret: str, headers: Mapping[str, str], body: Union[bytes, str], *, now: Optional[float] = None) -> Any:
60
+ """Check the ``webhook-id``, ``webhook-timestamp`` and ``webhook-signature`` headers against
61
+ the raw body and return the parsed event. Raises :class:`WebhookVerificationError`."""
62
+ if isinstance(body, str):
63
+ body = body.encode()
64
+ msg_id = _header(headers, "webhook-id")
65
+ ts = _header(headers, "webhook-timestamp")
66
+ sigs = _header(headers, "webhook-signature")
67
+ if not msg_id or not ts or not sigs:
68
+ raise WebhookVerificationError("missing webhook-id, webhook-timestamp or webhook-signature header")
69
+ try:
70
+ ts_int = int(ts)
71
+ except ValueError as e:
72
+ raise WebhookVerificationError("invalid webhook-timestamp") from e
73
+ current = time.time() if now is None else now
74
+ if abs(current - ts_int) > TOLERANCE_SECONDS:
75
+ raise WebhookVerificationError("webhook-timestamp is too far from now")
76
+ expected = sign(secret, msg_id, ts_int, body)
77
+ if not any(hmac.compare_digest(expected, s) for s in sigs.split()):
78
+ raise WebhookVerificationError("signature does not match")
79
+ return json.loads(body)
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.4
2
+ Name: tensorbase-sdk
3
+ Version: 0.1.0
4
+ Summary: Tensorbase SDK: serverless functions, endpoints, task queues and schedules
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://tensorbase.ai
7
+ Project-URL: Documentation, https://docs.tensorbase.ai
8
+ Project-URL: Source, https://github.com/Tensorbaseai/tensorbase-python
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Dynamic: license-file
13
+
14
+ # Tensorbase SDK for Python
15
+
16
+ Serverless functions, HTTP endpoints, task queues and schedules on [Tensorbase](https://tensorbase.ai).
17
+
18
+ ```sh
19
+ pip install tensorbase-sdk
20
+ ```
21
+
22
+ ```python
23
+ import tensorbase as tb
24
+
25
+ app = tb.App("hello")
26
+
27
+ @app.function(cpu=1, memory=512)
28
+ def square(x: int) -> int:
29
+ return x * x
30
+
31
+ @app.endpoint(min_containers=0)
32
+ def greet(name: str = "world") -> dict:
33
+ return {"hello": name}
34
+ ```
35
+
36
+ Deploy with the `tb` CLI (`tb deploy hello.py`), then call it from anywhere:
37
+
38
+ ```python
39
+ square = tb.Function.lookup("hello", "square")
40
+ square.remote(4) # 16
41
+ square.map([1, 2, 3]) # [1, 4, 9]
42
+ task = square.spawn(7) # runs in the background
43
+ task.result() # 49
44
+ ```
45
+
46
+ Run untrusted code in a sandbox (a Firecracker microVM with its own kernel):
47
+
48
+ ```python
49
+ with tb.Sandbox.create(image="tensorbase/sandbox:python3.12", egress="none") as sbx:
50
+ sbx.files.write("/work/solution.py", generated_code)
51
+ result = sbx.exec("python /work/solution.py", timeout=30)
52
+ print(result.exit_code, result.stdout)
53
+ ```
54
+
55
+ Give an agent a desktop and drive it with the computer-use API:
56
+
57
+ ```python
58
+ desk = tb.Desktop.create(name="research", look={"display_name": "Research agent", "color": "#7c5cff"})
59
+ desk.act([{"type": "browser_open", "url": "https://arxiv.org/list/cs.AI/recent"},
60
+ {"type": "click", "x": 412, "y": 338}])
61
+ png = desk.screenshot()
62
+ desk.sleep() # memory snapshot; billing stops until the next call wakes it
63
+ ```
64
+
65
+ ## Volumes, sandboxes and desktops
66
+
67
+ ```python
68
+ vol = tb.Volume.create("datasets") # durable files, shared by every workload
69
+ vol.put_directory("./data", "raw")
70
+ vol.listdir("raw")
71
+
72
+ with tb.Sandbox.create(volumes=[tb.Volume("datasets", "/data", read_only=True)]) as sbx:
73
+ print(sbx.exec("ls /data/raw").stdout)
74
+
75
+ desk = tb.Desktop.create(name="research")
76
+ desk.act([{"type": "browser_open", "url": "https://example.com"}])
77
+ png = desk.screenshot()
78
+ ```
79
+
80
+ Settings come from arguments, then the environment, then `tb login`:
81
+
82
+ | Setting | Environment | Default |
83
+ | --- | --- | --- |
84
+ | API key | `TB_API_KEY` (or `TB_TOKEN`) | from `tb login` |
85
+ | Workspace | `TB_WORKSPACE` | from `tb login` |
86
+ | API URL | `TB_API_URL` | `https://gateway.tensorbase.ai` |
87
+
88
+ Create API keys in the [Tensorbase Console](https://console.tensorbase.ai). Documentation:
89
+ https://docs.tensorbase.ai
90
+
91
+ ## Task callbacks and webhooks
92
+
93
+ A task can POST its result to your server when it finishes, and a workspace webhook receives
94
+ events (task, deployment, image, sandbox, desktop and billing). Both are signed with the
95
+ [Standard Webhooks](https://www.standardwebhooks.com) scheme; check them with
96
+ `tensorbase.webhooks.verify` before trusting the body:
97
+
98
+ ```python
99
+ @app.task_queue(callback_url="https://example.com/tensorbase/done")
100
+ def transcribe(url): ...
101
+
102
+ task = transcribe.spawn_with_callback("https://example.com/other", "https://…/audio.mp3")
103
+
104
+ # On your server, with the raw request body:
105
+ from tensorbase import webhooks
106
+ event = webhooks.verify(SECRET, request.headers, raw_body) # raises WebhookVerificationError
107
+ if event["type"] == "task.succeeded":
108
+ print(event["data"]["result"])
109
+ ```
110
+
111
+ `SECRET` is the workspace callback secret (`tb webhook callback-secret`) for callbacks, or the
112
+ secret shown by `tb webhook create URL` for a webhook. Deliveries are retried for about 28 hours
113
+ and may arrive more than once: deduplicate on `event["id"]`.
114
+
115
+ Requires Python 3.9+. No dependencies.
116
+
117
+ > This repository is published from the Tensorbase backend, where the SDK lives next to the
118
+ > container runtime (`tensorbase/_runner.py`) it ships with. Issues are welcome here; code changes
119
+ > are made upstream and appear in the next release. `embed.go` is how the backend embeds this
120
+ > package and can be ignored.
121
+ >
122
+ > The previous generated client (`tensorbase-client` on PyPI) is on the `legacy` branch.
@@ -0,0 +1,13 @@
1
+ tensorbase/__init__.py,sha256=y1AxohUKl6QruxDFVEvzHTIGOCBBd86tadU65dP5gA8,915
2
+ tensorbase/_app.py,sha256=_EvSYtX8XZpqXpQrgW0yr2u1EX2EWNBZFjecZZN_Nd0,15148
3
+ tensorbase/_client.py,sha256=OM2hRL6SipIRbDrUM-MtFVEBVfEStI5ni9X66Y4FIHc,4345
4
+ tensorbase/_inspect.py,sha256=jDxCStPkie1mVsLlV_UH0uxzEDrVqAPOfXeAT0GkIH0,1680
5
+ tensorbase/_machines.py,sha256=9GYJNpaMLdN7THv35uKWvXl86fLLVBhneZOePpLb5Zg,11895
6
+ tensorbase/_runner.py,sha256=Z8FNOC2wpema6xE3wl59NgiCWTKXLjNxEMXHwjiendw,14640
7
+ tensorbase/_volumes.py,sha256=jf4arAdriCp-zztQJk_KlnjvH8d0vxVDV9oMsh9OPbo,8402
8
+ tensorbase/webhooks.py,sha256=2XU8jNgK6r3ix2-J4zc0Kw2HTMP6LipC0Xl2ycVyoQg,3091
9
+ tensorbase_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=KXFbj0QeK_XNQCn0LEVeWvrzqhNalaXm3Ra0_X7LRqU,11340
10
+ tensorbase_sdk-0.1.0.dist-info/METADATA,sha256=IPNjTxAS2jJkI8dQUQnoY0AWGIKBVlEItIjcyEASvUI,4311
11
+ tensorbase_sdk-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
12
+ tensorbase_sdk-0.1.0.dist-info/top_level.txt,sha256=algM3gcyRNgatwce7ejlZrrA1YjzaAo61igqYJcA0Qs,11
13
+ tensorbase_sdk-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -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 2025 Tensorbase
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.
@@ -0,0 +1 @@
1
+ tensorbase