bare-sidecar 0.1.0__py3-none-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.
- bare_sidecar/__init__.py +9 -0
- bare_sidecar/_host.py +19 -0
- bare_sidecar/_ipc.py +91 -0
- bare_sidecar/prebuilds/win32-x64/bare.exe +4 -0
- bare_sidecar/py.typed +0 -0
- bare_sidecar/sidecar.py +210 -0
- bare_sidecar-0.1.0.dist-info/METADATA +52 -0
- bare_sidecar-0.1.0.dist-info/RECORD +11 -0
- bare_sidecar-0.1.0.dist-info/WHEEL +4 -0
- bare_sidecar-0.1.0.dist-info/licenses/LICENSE +200 -0
- bare_sidecar-0.1.0.dist-info/licenses/NOTICE +13 -0
bare_sidecar/__init__.py
ADDED
bare_sidecar/_host.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import platform
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
SYSTEMS = {"darwin", "linux", "win32"}
|
|
5
|
+
ARCHS = {"arm64": "arm64", "aarch64": "arm64", "x86_64": "x64", "amd64": "x64"}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def host():
|
|
9
|
+
"""The host triple of the running platform, named as by Bare."""
|
|
10
|
+
arch = ARCHS.get(platform.machine().lower())
|
|
11
|
+
|
|
12
|
+
if sys.platform not in SYSTEMS or arch is None:
|
|
13
|
+
raise OSError(f"Unsupported platform {sys.platform}-{platform.machine()}")
|
|
14
|
+
|
|
15
|
+
return f"{sys.platform}-{arch}"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def executable_name(host):
|
|
19
|
+
return "bare.exe" if host.startswith("win32") else "bare"
|
bare_sidecar/_ipc.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import os
|
|
3
|
+
import secrets
|
|
4
|
+
import socket
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
# Not exposed by `_winapi`.
|
|
8
|
+
PIPE_REJECT_REMOTE_CLIENTS = 0x00000008
|
|
9
|
+
|
|
10
|
+
BUFSIZE = 65536
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Channel:
|
|
14
|
+
"""An IPC connection between this process and a child yet to be spawned.
|
|
15
|
+
|
|
16
|
+
``value`` names the child's end, as a descriptor or on Windows a handle, and
|
|
17
|
+
``options`` are the subprocess options that pass it to the child.
|
|
18
|
+
``release()`` closes this process' copy of it once the child is spawned.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, reader, writer, value, options, release):
|
|
22
|
+
self.reader = reader
|
|
23
|
+
self.writer = writer
|
|
24
|
+
self.value = value
|
|
25
|
+
self.options = options
|
|
26
|
+
self.release = release
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
async def open_channel():
|
|
30
|
+
if sys.platform == "win32":
|
|
31
|
+
return await _open_pipe()
|
|
32
|
+
|
|
33
|
+
return await _open_socketpair()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async def _open_socketpair():
|
|
37
|
+
parent, child = socket.socketpair()
|
|
38
|
+
|
|
39
|
+
try:
|
|
40
|
+
reader, writer = await asyncio.open_unix_connection(sock=parent)
|
|
41
|
+
except BaseException:
|
|
42
|
+
parent.close()
|
|
43
|
+
child.close()
|
|
44
|
+
raise
|
|
45
|
+
|
|
46
|
+
fd = child.fileno()
|
|
47
|
+
|
|
48
|
+
return Channel(reader, writer, str(fd), {"pass_fds": (fd,)}, child.close)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
async def _open_pipe():
|
|
52
|
+
import _winapi
|
|
53
|
+
import subprocess
|
|
54
|
+
|
|
55
|
+
name = rf"\\.\pipe\bare-sidecar-{os.getpid()}-{secrets.token_hex(8)}"
|
|
56
|
+
|
|
57
|
+
# A single instance that this process connects to before the child exists,
|
|
58
|
+
# so that no other process can connect in its place.
|
|
59
|
+
child = _winapi.CreateNamedPipe(
|
|
60
|
+
name,
|
|
61
|
+
_winapi.PIPE_ACCESS_DUPLEX
|
|
62
|
+
| _winapi.FILE_FLAG_OVERLAPPED
|
|
63
|
+
| _winapi.FILE_FLAG_FIRST_PIPE_INSTANCE,
|
|
64
|
+
_winapi.PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS,
|
|
65
|
+
1,
|
|
66
|
+
BUFSIZE,
|
|
67
|
+
BUFSIZE,
|
|
68
|
+
_winapi.NMPWAIT_WAIT_FOREVER,
|
|
69
|
+
_winapi.NULL,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
loop = asyncio.get_running_loop()
|
|
74
|
+
reader = asyncio.StreamReader()
|
|
75
|
+
protocol = asyncio.StreamReaderProtocol(reader)
|
|
76
|
+
transport, _ = await loop.create_pipe_connection(lambda: protocol, name)
|
|
77
|
+
writer = asyncio.StreamWriter(transport, protocol, reader, loop)
|
|
78
|
+
os.set_handle_inheritable(child, True)
|
|
79
|
+
except BaseException:
|
|
80
|
+
_winapi.CloseHandle(child)
|
|
81
|
+
raise
|
|
82
|
+
|
|
83
|
+
startupinfo = subprocess.STARTUPINFO(lpAttributeList={"handle_list": [child]})
|
|
84
|
+
|
|
85
|
+
return Channel(
|
|
86
|
+
reader,
|
|
87
|
+
writer,
|
|
88
|
+
str(child),
|
|
89
|
+
{"startupinfo": startupinfo},
|
|
90
|
+
lambda: _winapi.CloseHandle(child),
|
|
91
|
+
)
|
bare_sidecar/py.typed
ADDED
|
File without changes
|
bare_sidecar/sidecar.py
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import os
|
|
3
|
+
import signal
|
|
4
|
+
from contextlib import suppress
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from ._host import executable_name, host
|
|
8
|
+
from ._ipc import open_channel
|
|
9
|
+
|
|
10
|
+
# Read by the embedder shipped with this package, which opens `Bare.IPC` from
|
|
11
|
+
# the descriptor, or on Windows the handle, it names.
|
|
12
|
+
IPC_ENV = "BARE_SIDECAR_IPC"
|
|
13
|
+
|
|
14
|
+
STDIO = {
|
|
15
|
+
"inherit": None,
|
|
16
|
+
"pipe": asyncio.subprocess.PIPE,
|
|
17
|
+
"ignore": asyncio.subprocess.DEVNULL,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def executable():
|
|
22
|
+
"""The path of the Bare executable shipped for the running platform."""
|
|
23
|
+
current = host()
|
|
24
|
+
path = Path(__file__).parent / "prebuilds" / current / executable_name(current)
|
|
25
|
+
|
|
26
|
+
if not path.is_file():
|
|
27
|
+
raise FileNotFoundError(f"No Bare prebuild for {current}")
|
|
28
|
+
|
|
29
|
+
return path
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def spawn(entry, *args, stdio="inherit", bare=None):
|
|
33
|
+
"""Start ``entry`` in a Bare process with an IPC connection to it and
|
|
34
|
+
return its ``Sidecar``.
|
|
35
|
+
|
|
36
|
+
``args`` are passed to the process as ``Bare.argv``. ``stdio`` is
|
|
37
|
+
``"inherit"``, ``"pipe"``, or ``"ignore"``, either for all three standard
|
|
38
|
+
streams or as a sequence of one per stream. ``bare`` is the Bare executable
|
|
39
|
+
to use, defaulting to the one shipped with this package.
|
|
40
|
+
"""
|
|
41
|
+
if isinstance(stdio, str):
|
|
42
|
+
stdio = (stdio,) * 3
|
|
43
|
+
|
|
44
|
+
stdin, stdout, stderr = (STDIO[mode] for mode in stdio)
|
|
45
|
+
|
|
46
|
+
channel = await open_channel()
|
|
47
|
+
|
|
48
|
+
try:
|
|
49
|
+
process = await asyncio.create_subprocess_exec(
|
|
50
|
+
os.fspath(bare or executable()),
|
|
51
|
+
os.fspath(entry),
|
|
52
|
+
*args,
|
|
53
|
+
stdin=stdin,
|
|
54
|
+
stdout=stdout,
|
|
55
|
+
stderr=stderr,
|
|
56
|
+
env={**os.environ, IPC_ENV: channel.value},
|
|
57
|
+
**channel.options,
|
|
58
|
+
)
|
|
59
|
+
except BaseException:
|
|
60
|
+
channel.writer.close()
|
|
61
|
+
raise
|
|
62
|
+
finally:
|
|
63
|
+
channel.release()
|
|
64
|
+
|
|
65
|
+
return Sidecar(process, channel.reader, channel.writer)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class Sidecar:
|
|
69
|
+
"""A Bare process connected to its ``Bare.IPC``.
|
|
70
|
+
|
|
71
|
+
Iterating it with ``async for`` yields the data the process writes to
|
|
72
|
+
``Bare.IPC`` until the connection ends, and leaving ``async with`` closes
|
|
73
|
+
it. Use ``spawn()`` to start one.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
def __init__(self, process, reader, writer):
|
|
77
|
+
self._process = process
|
|
78
|
+
self._reader = reader
|
|
79
|
+
self._writer = writer
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def pid(self):
|
|
83
|
+
"""The process ID."""
|
|
84
|
+
return self._process.pid
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def returncode(self):
|
|
88
|
+
"""The exit code of the process, negated if killed by a signal, or
|
|
89
|
+
``None`` while it is running."""
|
|
90
|
+
return self._process.returncode
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def exit_code(self):
|
|
94
|
+
"""The exit code of the process, or ``None`` while it is running or if
|
|
95
|
+
it was killed by a signal."""
|
|
96
|
+
code = self._process.returncode
|
|
97
|
+
return code if code is not None and code >= 0 else None
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def signal_code(self):
|
|
101
|
+
"""The name of the signal that killed the process, or ``None``."""
|
|
102
|
+
code = self._process.returncode
|
|
103
|
+
return signal.Signals(-code).name if code is not None and code < 0 else None
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
def stdin(self):
|
|
107
|
+
"""The standard input of the process, if spawned with ``"pipe"``."""
|
|
108
|
+
return self._process.stdin
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def stdout(self):
|
|
112
|
+
"""The standard output of the process, if spawned with ``"pipe"``."""
|
|
113
|
+
return self._process.stdout
|
|
114
|
+
|
|
115
|
+
@property
|
|
116
|
+
def stderr(self):
|
|
117
|
+
"""The standard error of the process, if spawned with ``"pipe"``."""
|
|
118
|
+
return self._process.stderr
|
|
119
|
+
|
|
120
|
+
async def read(self, n=65536):
|
|
121
|
+
"""Read up to ``n`` bytes from the process, or ``b""`` once it has
|
|
122
|
+
closed its end of the connection."""
|
|
123
|
+
try:
|
|
124
|
+
data = await self._reader.read(n)
|
|
125
|
+
except ConnectionResetError:
|
|
126
|
+
# On Linux, a process that exits with data still unread resets the
|
|
127
|
+
# connection rather than ending it.
|
|
128
|
+
return b""
|
|
129
|
+
|
|
130
|
+
if not data:
|
|
131
|
+
self._end()
|
|
132
|
+
|
|
133
|
+
return data
|
|
134
|
+
|
|
135
|
+
def _end(self):
|
|
136
|
+
"""End this side of the connection, which the process waits for before
|
|
137
|
+
it exits once it has ended its own."""
|
|
138
|
+
if self._writer.is_closing():
|
|
139
|
+
return
|
|
140
|
+
|
|
141
|
+
# A process that has already exited has no end left to end, and pipes on
|
|
142
|
+
# Windows can't be half closed.
|
|
143
|
+
with suppress(OSError):
|
|
144
|
+
if self._writer.can_write_eof():
|
|
145
|
+
self._writer.write_eof()
|
|
146
|
+
else:
|
|
147
|
+
self._writer.close()
|
|
148
|
+
|
|
149
|
+
def __aiter__(self):
|
|
150
|
+
return self._chunks()
|
|
151
|
+
|
|
152
|
+
async def _chunks(self):
|
|
153
|
+
while chunk := await self.read():
|
|
154
|
+
yield chunk
|
|
155
|
+
|
|
156
|
+
async def write(self, data):
|
|
157
|
+
"""Write ``data`` to the process and wait for it to drain.
|
|
158
|
+
|
|
159
|
+
Data written once the process has closed its end of the connection,
|
|
160
|
+
such as while exiting, is dropped, as its exit already accounts for it.
|
|
161
|
+
"""
|
|
162
|
+
if self._writer.is_closing():
|
|
163
|
+
return
|
|
164
|
+
|
|
165
|
+
try:
|
|
166
|
+
self._writer.write(data)
|
|
167
|
+
await self._writer.drain()
|
|
168
|
+
except (BrokenPipeError, ConnectionResetError):
|
|
169
|
+
pass
|
|
170
|
+
|
|
171
|
+
def send_signal(self, sig):
|
|
172
|
+
"""Send ``sig`` to the process unless it has already exited."""
|
|
173
|
+
with suppress(ProcessLookupError):
|
|
174
|
+
self._process.send_signal(sig)
|
|
175
|
+
|
|
176
|
+
def terminate(self):
|
|
177
|
+
"""Ask the process to exit, with ``SIGTERM`` or on Windows by
|
|
178
|
+
terminating it, unless it has already exited."""
|
|
179
|
+
with suppress(ProcessLookupError):
|
|
180
|
+
self._process.terminate()
|
|
181
|
+
|
|
182
|
+
def kill(self):
|
|
183
|
+
"""Kill the process, with ``SIGKILL`` or on Windows by terminating it,
|
|
184
|
+
unless it has already exited."""
|
|
185
|
+
with suppress(ProcessLookupError):
|
|
186
|
+
self._process.kill()
|
|
187
|
+
|
|
188
|
+
async def wait(self):
|
|
189
|
+
"""Wait for the process to exit and return its exit code, negated if it
|
|
190
|
+
was killed by a signal."""
|
|
191
|
+
return await self._process.wait()
|
|
192
|
+
|
|
193
|
+
async def close(self):
|
|
194
|
+
"""Close the connection, terminating the process if it is still
|
|
195
|
+
running, and wait for it to exit."""
|
|
196
|
+
self._writer.close()
|
|
197
|
+
|
|
198
|
+
if self._process.returncode is None:
|
|
199
|
+
self.terminate()
|
|
200
|
+
|
|
201
|
+
await self.wait()
|
|
202
|
+
|
|
203
|
+
with suppress(OSError):
|
|
204
|
+
await self._writer.wait_closed()
|
|
205
|
+
|
|
206
|
+
async def __aenter__(self):
|
|
207
|
+
return self
|
|
208
|
+
|
|
209
|
+
async def __aexit__(self, *exc):
|
|
210
|
+
await self.close()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bare-sidecar
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Start and manage Bare sidecar processes from Python
|
|
5
|
+
Author: Holepunch
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: NOTICE
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
12
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# bare-sidecar-python
|
|
16
|
+
|
|
17
|
+
Start and manage Bare sidecar processes from Python. The Python counterpart of [bare-sidecar](https://github.com/holepunchto/bare-sidecar): it runs a Bare entry point in a child process with an IPC connection to it, exposed as `Bare.IPC` inside the process. The Bare executable is shipped in platform wheels.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
pip install bare-sidecar
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Platform wheels are published for macOS 13 and later, Linux with glibc 2.34 and later, and Windows, each on arm64 and x64.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import asyncio
|
|
29
|
+
|
|
30
|
+
from bare_sidecar import spawn
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
async def main():
|
|
34
|
+
async with await spawn("app.js") as sidecar:
|
|
35
|
+
await sidecar.write(b"Hello world")
|
|
36
|
+
|
|
37
|
+
async for data in sidecar:
|
|
38
|
+
print(data)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
asyncio.run(main())
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Where `app.js` is a Bare entry point using `Bare.IPC`:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
Bare.IPC.on('data', (data) => Bare.IPC.write(data))
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
Apache-2.0
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
bare_sidecar/__init__.py,sha256=IGrEdDxNTwugH4077OgCEGv7lMSWiIVFONjEuh-Fdhw,169
|
|
2
|
+
bare_sidecar/_host.py,sha256=msf3SckEfXKpnjUgqBPuVgEzhPeroXVrcdMLzFGdCSk,543
|
|
3
|
+
bare_sidecar/_ipc.py,sha256=T6c0b2adRMH517w_Gg7jva69XdWok7arLGDcoNNjbQw,2459
|
|
4
|
+
bare_sidecar/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
bare_sidecar/sidecar.py,sha256=Mfax8ismpUKkqRiTWoSpjuWOjf506RJ1sep4GoNIA20,6447
|
|
6
|
+
bare_sidecar/prebuilds/win32-x64/bare.exe,sha256=BPHk2fLHQCpiWqh3zZNo2xcRY7JapYOClip7TKiYAUU,43411456
|
|
7
|
+
bare_sidecar-0.1.0.dist-info/METADATA,sha256=Qq_AelFDWDEfq-MNdySusVQkGY8OnmtTec-rMNtyB3o,1276
|
|
8
|
+
bare_sidecar-0.1.0.dist-info/WHEEL,sha256=lpoBGaIUIidvvdZ4qRAP61bBKYJdt4FI3WXFL50Gzyo,94
|
|
9
|
+
bare_sidecar-0.1.0.dist-info/licenses/LICENSE,sha256=R6LPz3pytRiGjm1UcrDBpNo9Lde4z9-HnfLdr4CJUQo,11284
|
|
10
|
+
bare_sidecar-0.1.0.dist-info/licenses/NOTICE,sha256=hdAkJJsXX3Bg31bhcXn-xt_HHvZOAp-Yb3rwwHPxWzU,554
|
|
11
|
+
bare_sidecar-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,200 @@
|
|
|
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 (an "as is" basis
|
|
145
|
+
without warranties of any kind, either express or
|
|
146
|
+
implied, including, without limitation, any warranties or conditions
|
|
147
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
148
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
149
|
+
appropriateness of using or redistributing the Work and assume any
|
|
150
|
+
risks associated with Your exercise of permissions under this License.
|
|
151
|
+
|
|
152
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
153
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
154
|
+
unless required by applicable law (such as deliberate and grossly
|
|
155
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
156
|
+
liable to You for damages, including any direct, indirect, special,
|
|
157
|
+
incidental, or consequential damages of any character arising as a
|
|
158
|
+
result of this License or out of the use or inability to use the
|
|
159
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
160
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
161
|
+
other commercial damages or losses), even if such Contributor
|
|
162
|
+
has been advised of the possibility of such damages.
|
|
163
|
+
|
|
164
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
165
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
166
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
167
|
+
or other liability obligations and/or rights consistent with this
|
|
168
|
+
License. However, in accepting such obligations, You may act only
|
|
169
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
170
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
171
|
+
defend, and hold each Contributor harmless for any liability
|
|
172
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
173
|
+
of your accepting any such warranty or additional liability.
|
|
174
|
+
|
|
175
|
+
END OF TERMS AND CONDITIONS
|
|
176
|
+
|
|
177
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
178
|
+
|
|
179
|
+
To apply the Apache License to your work, attach the following
|
|
180
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
181
|
+
replaced with your own identifying information. (Don't include
|
|
182
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
183
|
+
comment syntax for the file format. We also recommend that a
|
|
184
|
+
file or class name and description of purpose be included on the
|
|
185
|
+
same "printed page" as the copyright notice for easier
|
|
186
|
+
identification within third-party archives.
|
|
187
|
+
|
|
188
|
+
Copyright [yyyy] [name of copyright owner]
|
|
189
|
+
|
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
you may not use this file except in compliance with the License.
|
|
192
|
+
You may obtain a copy of the License at
|
|
193
|
+
|
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
|
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
See the License for the specific language governing permissions and
|
|
200
|
+
limitations under the License.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 Holepunch Inc
|
|
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.
|