withcache 0.6.3__tar.gz → 0.6.5__tar.gz
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.
- {withcache-0.6.3 → withcache-0.6.5}/PKG-INFO +10 -10
- {withcache-0.6.3 → withcache-0.6.5}/README.md +9 -9
- {withcache-0.6.3 → withcache-0.6.5}/deploy/Containerfile +3 -3
- {withcache-0.6.3 → withcache-0.6.5}/deploy/compose.yml +1 -1
- {withcache-0.6.3 → withcache-0.6.5}/shim/build.zig.zon +1 -1
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/__init__.py +1 -1
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/_shim.py +1 -1
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/client.py +2 -2
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/curlwithcache.py +1 -1
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/server.py +193 -128
- withcache-0.6.5/src/withcache/static/bootstrap-icons.min.css +5 -0
- withcache-0.6.5/src/withcache/static/bootstrap.min.css +12 -0
- withcache-0.6.5/src/withcache/static/fonts/bootstrap-icons.woff +0 -0
- withcache-0.6.5/src/withcache/static/fonts/bootstrap-icons.woff2 +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/wgetwithcache.py +1 -1
- {withcache-0.6.3 → withcache-0.6.5}/tests/test_differential.py +1 -1
- {withcache-0.6.3 → withcache-0.6.5}/tests/test_withcache.py +10 -10
- withcache-0.6.3/src/withcache/static/pico.min.css +0 -4
- {withcache-0.6.3 → withcache-0.6.5}/.gitignore +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/LICENSE +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/hatch_build.py +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/pyproject.toml +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/shim/build.zig +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/shim/shim.zig +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/oras.py +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/src/withcache/static/htmx.min.js +0 -0
- {withcache-0.6.3 → withcache-0.6.5}/tests/test_oras.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: withcache
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Summary: Operator-curated, URL-keyed artifact cache for a small lab (CUDA/ROCm/DOCA/firmware)
|
|
5
5
|
Project-URL: Homepage, https://github.com/safl/withcache
|
|
6
6
|
Author-email: "Simon A. F. Lund" <safl@safl.dk>
|
|
@@ -100,13 +100,13 @@ asserts the binary and the Python `plan()` rewrite argv identically.
|
|
|
100
100
|
```sh
|
|
101
101
|
export WITHCACHE_ADMIN_PASSWORD=change-me # protects the operator UI
|
|
102
102
|
podman compose -f deploy/compose.yml up -d # or: docker compose -f ...
|
|
103
|
-
# operator UI: http://withcache-server:
|
|
103
|
+
# operator UI: http://withcache-server:8081/
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
Or without containers:
|
|
107
107
|
|
|
108
108
|
```sh
|
|
109
|
-
WITHCACHE_ADMIN_PASSWORD=change-me withcache-server --data-dir ./data --port
|
|
109
|
+
WITHCACHE_ADMIN_PASSWORD=change-me withcache-server --data-dir ./data --port 8081
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
Data (blobs + `cache.db` + `session-secret`) lives in the `/data` volume (or
|
|
@@ -137,7 +137,7 @@ Nothing is renamed; you opt in per command. Good for trying it out or a script
|
|
|
137
137
|
you can edit.
|
|
138
138
|
|
|
139
139
|
```sh
|
|
140
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
140
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
141
141
|
curlwithcache -fsSL https://the/origin/cuda.tar.gz -o cuda.tar.gz
|
|
142
142
|
wgetwithcache https://the/origin/rocm.tar.gz
|
|
143
143
|
```
|
|
@@ -152,7 +152,7 @@ mkdir -p ~/.withcache/bin
|
|
|
152
152
|
ln -sf "$(command -v curlwithcache)" ~/.withcache/bin/curl
|
|
153
153
|
ln -sf "$(command -v wgetwithcache)" ~/.withcache/bin/wget
|
|
154
154
|
|
|
155
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
155
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
156
156
|
export PATH="$HOME/.withcache/bin:$PATH"
|
|
157
157
|
hash -r # forget any cached curl/wget location
|
|
158
158
|
|
|
@@ -174,7 +174,7 @@ ln -sf "$(command -v wgetwithcache)" ~/.withcache/bin/wget
|
|
|
174
174
|
cat >> ~/.bashrc <<'EOF'
|
|
175
175
|
|
|
176
176
|
# withcache: transparent curl/wget caching
|
|
177
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
177
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
178
178
|
export PATH="$HOME/.withcache/bin:$PATH"
|
|
179
179
|
EOF
|
|
180
180
|
```
|
|
@@ -186,7 +186,7 @@ inside that directory.
|
|
|
186
186
|
|
|
187
187
|
```sh
|
|
188
188
|
# .envrc
|
|
189
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
189
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
190
190
|
PATH_add ~/.withcache/bin # assumes the symlinks from approach 2/3 exist
|
|
191
191
|
```
|
|
192
192
|
|
|
@@ -204,7 +204,7 @@ sudo ln -sf "$(command -v wgetwithcache)" /usr/local/bin/wget
|
|
|
204
204
|
|
|
205
205
|
# A login-shell env file (covers interactive logins; daemons started outside a
|
|
206
206
|
# login shell won't see it; set WITHCACHE_SERVER in their unit if you need it).
|
|
207
|
-
echo 'export WITHCACHE_SERVER=http://withcache-server:
|
|
207
|
+
echo 'export WITHCACHE_SERVER=http://withcache-server:8081' \
|
|
208
208
|
| sudo tee /etc/profile.d/withcache.sh >/dev/null
|
|
209
209
|
```
|
|
210
210
|
|
|
@@ -237,7 +237,7 @@ Notes & limits (all degrade gracefully; worst case is "no caching, curl still wo
|
|
|
237
237
|
|
|
238
238
|
## Operator UI
|
|
239
239
|
|
|
240
|
-
`http://withcache-server:
|
|
240
|
+
`http://withcache-server:8081/` (Pico.css + HTMX, bundled offline) shows:
|
|
241
241
|
- **Misses**: auto-fetched by default, or (under `--curate`) each with **Download** (queues a background pull) and **Dismiss**.
|
|
242
242
|
- **Downloads**: live progress bars, `queued/running/completed/cancelled/failed`, **Cancel**, and **Clear finished**. Downloads run in a background worker pool, not in the request, so large pulls never block, modelled on [bty]'s job managers.
|
|
243
243
|
- **Cached artifacts**: URL, size, **hits** (times served) and **misses** (times requested before it was cached), SHA-256, fetched-at, each with **Delete** to free space.
|
|
@@ -276,7 +276,7 @@ scheme. `withcache.client` is stdlib-only, so importing it adds no dependencies:
|
|
|
276
276
|
from withcache import client
|
|
277
277
|
|
|
278
278
|
# "use the cache when it's warm, the origin otherwise"
|
|
279
|
-
url = client.serve_url("http://cache:
|
|
279
|
+
url = client.serve_url("http://cache:8081", origin) or origin
|
|
280
280
|
```
|
|
281
281
|
|
|
282
282
|
`is_cached()` is a graceful `HEAD` (a miss, timeout, or unreachable cache all
|
|
@@ -82,13 +82,13 @@ asserts the binary and the Python `plan()` rewrite argv identically.
|
|
|
82
82
|
```sh
|
|
83
83
|
export WITHCACHE_ADMIN_PASSWORD=change-me # protects the operator UI
|
|
84
84
|
podman compose -f deploy/compose.yml up -d # or: docker compose -f ...
|
|
85
|
-
# operator UI: http://withcache-server:
|
|
85
|
+
# operator UI: http://withcache-server:8081/
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
Or without containers:
|
|
89
89
|
|
|
90
90
|
```sh
|
|
91
|
-
WITHCACHE_ADMIN_PASSWORD=change-me withcache-server --data-dir ./data --port
|
|
91
|
+
WITHCACHE_ADMIN_PASSWORD=change-me withcache-server --data-dir ./data --port 8081
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
Data (blobs + `cache.db` + `session-secret`) lives in the `/data` volume (or
|
|
@@ -119,7 +119,7 @@ Nothing is renamed; you opt in per command. Good for trying it out or a script
|
|
|
119
119
|
you can edit.
|
|
120
120
|
|
|
121
121
|
```sh
|
|
122
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
122
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
123
123
|
curlwithcache -fsSL https://the/origin/cuda.tar.gz -o cuda.tar.gz
|
|
124
124
|
wgetwithcache https://the/origin/rocm.tar.gz
|
|
125
125
|
```
|
|
@@ -134,7 +134,7 @@ mkdir -p ~/.withcache/bin
|
|
|
134
134
|
ln -sf "$(command -v curlwithcache)" ~/.withcache/bin/curl
|
|
135
135
|
ln -sf "$(command -v wgetwithcache)" ~/.withcache/bin/wget
|
|
136
136
|
|
|
137
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
137
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
138
138
|
export PATH="$HOME/.withcache/bin:$PATH"
|
|
139
139
|
hash -r # forget any cached curl/wget location
|
|
140
140
|
|
|
@@ -156,7 +156,7 @@ ln -sf "$(command -v wgetwithcache)" ~/.withcache/bin/wget
|
|
|
156
156
|
cat >> ~/.bashrc <<'EOF'
|
|
157
157
|
|
|
158
158
|
# withcache: transparent curl/wget caching
|
|
159
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
159
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
160
160
|
export PATH="$HOME/.withcache/bin:$PATH"
|
|
161
161
|
EOF
|
|
162
162
|
```
|
|
@@ -168,7 +168,7 @@ inside that directory.
|
|
|
168
168
|
|
|
169
169
|
```sh
|
|
170
170
|
# .envrc
|
|
171
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
171
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
172
172
|
PATH_add ~/.withcache/bin # assumes the symlinks from approach 2/3 exist
|
|
173
173
|
```
|
|
174
174
|
|
|
@@ -186,7 +186,7 @@ sudo ln -sf "$(command -v wgetwithcache)" /usr/local/bin/wget
|
|
|
186
186
|
|
|
187
187
|
# A login-shell env file (covers interactive logins; daemons started outside a
|
|
188
188
|
# login shell won't see it; set WITHCACHE_SERVER in their unit if you need it).
|
|
189
|
-
echo 'export WITHCACHE_SERVER=http://withcache-server:
|
|
189
|
+
echo 'export WITHCACHE_SERVER=http://withcache-server:8081' \
|
|
190
190
|
| sudo tee /etc/profile.d/withcache.sh >/dev/null
|
|
191
191
|
```
|
|
192
192
|
|
|
@@ -219,7 +219,7 @@ Notes & limits (all degrade gracefully; worst case is "no caching, curl still wo
|
|
|
219
219
|
|
|
220
220
|
## Operator UI
|
|
221
221
|
|
|
222
|
-
`http://withcache-server:
|
|
222
|
+
`http://withcache-server:8081/` (Pico.css + HTMX, bundled offline) shows:
|
|
223
223
|
- **Misses**: auto-fetched by default, or (under `--curate`) each with **Download** (queues a background pull) and **Dismiss**.
|
|
224
224
|
- **Downloads**: live progress bars, `queued/running/completed/cancelled/failed`, **Cancel**, and **Clear finished**. Downloads run in a background worker pool, not in the request, so large pulls never block, modelled on [bty]'s job managers.
|
|
225
225
|
- **Cached artifacts**: URL, size, **hits** (times served) and **misses** (times requested before it was cached), SHA-256, fetched-at, each with **Delete** to free space.
|
|
@@ -258,7 +258,7 @@ scheme. `withcache.client` is stdlib-only, so importing it adds no dependencies:
|
|
|
258
258
|
from withcache import client
|
|
259
259
|
|
|
260
260
|
# "use the cache when it's warm, the origin otherwise"
|
|
261
|
-
url = client.serve_url("http://cache:
|
|
261
|
+
url = client.serve_url("http://cache:8081", origin) or origin
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
`is_cached()` is a graceful `HEAD` (a miss, timeout, or unreachable cache all
|
|
@@ -17,7 +17,7 @@ RUN useradd --create-home --uid 10001 app \
|
|
|
17
17
|
&& mkdir -p /data && chown app:app /data
|
|
18
18
|
USER app
|
|
19
19
|
|
|
20
|
-
EXPOSE
|
|
20
|
+
EXPOSE 8081
|
|
21
21
|
VOLUME ["/data"]
|
|
22
22
|
|
|
23
23
|
# Set WITHCACHE_ADMIN_PASSWORD at run time to protect the operator UI.
|
|
@@ -25,6 +25,6 @@ VOLUME ["/data"]
|
|
|
25
25
|
# with WITHCACHE_SESSION_SECRET.
|
|
26
26
|
|
|
27
27
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
|
|
28
|
-
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:
|
|
28
|
+
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8081/healthz',timeout=2).status==200 else 1)"
|
|
29
29
|
|
|
30
|
-
ENTRYPOINT ["withcache-server", "--host", "0.0.0.0", "--port", "
|
|
30
|
+
ENTRYPOINT ["withcache-server", "--host", "0.0.0.0", "--port", "8081", "--data-dir", "/data"]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
.name = .withcache_shim,
|
|
3
3
|
// Zig requires a literal here; keep it in lockstep with the project's
|
|
4
4
|
// single source (src/withcache/__init__.py) via `make bump` / `make version-check`.
|
|
5
|
-
.version = "0.6.
|
|
5
|
+
.version = "0.6.5",
|
|
6
6
|
.fingerprint = 0xd7d96c5ed212ccaa,
|
|
7
7
|
.minimum_zig_version = "0.16.0",
|
|
8
8
|
.paths = .{
|
|
@@ -17,6 +17,6 @@ All modules are stdlib-only and self-contained.
|
|
|
17
17
|
from . import oras
|
|
18
18
|
from .client import blob_url, cache_base, is_cached, serve_url
|
|
19
19
|
|
|
20
|
-
__version__ = "0.6.
|
|
20
|
+
__version__ = "0.6.5"
|
|
21
21
|
|
|
22
22
|
__all__ = ["__version__", "blob_url", "cache_base", "is_cached", "oras", "serve_url"]
|
|
@@ -26,7 +26,7 @@ _SCHEME = re.compile(r"^[a-zA-Z][a-zA-Z0-9+.\-]*://")
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def cache_base(server: str) -> str:
|
|
29
|
-
"""Accept 'host', 'host:
|
|
29
|
+
"""Accept 'host', 'host:8081', or 'http://withcache-server:8081'."""
|
|
30
30
|
server = server.strip().rstrip("/")
|
|
31
31
|
if "://" not in server:
|
|
32
32
|
server = "http://" + server
|
|
@@ -7,7 +7,7 @@ dependencies.
|
|
|
7
7
|
from withcache import client
|
|
8
8
|
|
|
9
9
|
# "use the cache when it's warm, the origin otherwise"
|
|
10
|
-
url = client.serve_url("http://cache:
|
|
10
|
+
url = client.serve_url("http://cache:8081", origin) or origin
|
|
11
11
|
|
|
12
12
|
The ``/b/<urlsafe-b64(origin)>/<basename>`` encoding is shared with the shims
|
|
13
13
|
and the server (one definition in :mod:`withcache._shim`), so consumers stay in
|
|
@@ -25,7 +25,7 @@ __all__ = ["PROBE_TIMEOUT", "blob_url", "cache_base", "is_cached", "serve_url"]
|
|
|
25
25
|
|
|
26
26
|
PROBE_TIMEOUT = 3.0 # seconds; never block the caller on a slow/unreachable cache
|
|
27
27
|
|
|
28
|
-
#: Normalize a server value: accepts 'host', 'host:
|
|
28
|
+
#: Normalize a server value: accepts 'host', 'host:8081', or 'http://host:8081'.
|
|
29
29
|
cache_base = _shim.cache_base
|
|
30
30
|
|
|
31
31
|
|
|
@@ -7,7 +7,7 @@ withcache cache-host and the artifact is cached there, the download is served
|
|
|
7
7
|
from the cache; otherwise — server unset, not cached, or unreachable — your curl
|
|
8
8
|
runs exactly as written. Existing scripts need no changes.
|
|
9
9
|
|
|
10
|
-
export WITHCACHE_SERVER=http://withcache-server:
|
|
10
|
+
export WITHCACHE_SERVER=http://withcache-server:8081
|
|
11
11
|
curl -fsSL https://the/origin/cuda.tar.gz -o cuda.tar.gz # cache hit -> local
|
|
12
12
|
|
|
13
13
|
It wraps the system curl, so all curl flags keep working; on a miss it hands
|