abstract_transfer
One transport for HTTP pulls, stdlib only. Generalised from hugpy's worker model
pull (hugpy_storage.provision) so every project moves bytes the same way.
from abstract_transfer import fetch, chunk_sha256s
fetch("https://host/file", "/data/file", sha256="…") # verified
fetch(url, dest, chunk_sums=sums, chunk_bytes=32 << 20) # per-chunk verified, parallel
fetch(url, dest, validate=lambda p: open(p,"rb").read(4) == b"GGUF")
abstract-transfer URL DEST [--sha256 X] [--size N] [-H 'Authorization: Bearer …']
Guarantees
- Complete-or-raise. Data lands in
DEST.part; only after size,sha256andvalidate()pass is itos.replaced toDEST. A file under its final name is whole. - Resume. Sequential pulls continue from the bytes already in
.part(Range: bytes=N-); a server that answers 200 instead of 206 restarts cleanly. - Parallel segments when the server honours Range and the file is ≥ 64 MiB
(or
chunk_sumsis given):concurrencyconnections, one chunk each. - Per-chunk SHA-256 (
chunk_sums, fromchunk_sha256s()on the server): each chunk is verified as it lands and recorded inDEST.part.state, so a crash resumes from proven content, not a byte offset. - Single-flight per destination: a thread lock plus an
fcntllock file — two pulls of the same file never interleave.
Used by
- abstract-toolserver
fileshare_fetch. - hugpy_storage (planned): its private
_download_*helpers map 1:1 ontofetch.
Metadata
Release files for abstract-transfer 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| abstract_transfer-0.0.1.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| abstract_transfer-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / abstract_transfer-0.0.1.tar.gz
| Download URL | abstract_transfer-0.0.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6cfe1a76d6ac3d1a2a894fafa4ef5d30cf875e3a17542fbe9bf6a6cac580904
|
|
BLAKE2b-256 checksum How to use checksums |
a0d5ae40f2471fd660a924fc7cdceb85c8dd0d9257eb3e43898054a29385de9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / abstract_transfer-0.0.1-py3-none-any.whl
| Download URL | abstract_transfer-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac38f3428c58750b11a9e4adc239fc60cf0287c2dedea28a378e1e153e294365
|
|
BLAKE2b-256 checksum How to use checksums |
fe1d94ed3ca945ee97feeb87f9ab858693e8757e1379da51c36728493e7f4f67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|