Python Async SDK (grpclib)
This SDK talks to afs_proxy / afslet using asyncio + grpclib.
Generated protobuf modules are inside afs_sdk/api/....
Version
When imported from a git checkout, afs_sdk.__version__ is resolved from:
git describe --tags --long --always --dirty --match 'v*'
Example output:
>>> import afs_sdk
>>> afs_sdk.__version__
'v0.2.0-1-gabc1234-dirty'
>>> afs_sdk.get_version_info()
VersionInfo(version='v0.2.0-1-gabc1234-dirty', tag='v0.2.0', commit_sha='abc1234', distance=1, dirty=True)
When installed from a built distribution without .git metadata, it falls back
to the package metadata version. PyPI release versions are derived from git tags
via setuptools_scm.
Setup (uv)
cd python
~/.local/bin/uv sync
API
- Low-level:
AfsClient.raw_execute(requests: AsyncIterator[ExecuteRequest]) - High-level:
AfsClient.execute(request: ExecuteInput)- request is a single typed object (
image, optionalcommand, optionalenv, resources, and extra file entries) envaccepts either adict[str, str]or a sequence ofKEY=VALUEstrings, and overrides image env on key conflict- set
force_local_fetch=Trueto force local layer fetch on selected layerstore - response is
AsyncIterator[ExecuteEvent]
- request is a single typed object (
- Proxy status stream:
AfsClient.status(include_layerstores=True, include_afslets=True)- returns
AsyncIterator[ProxyStatusEvent]
- returns
- Reconcile image replica:
AfsClient.reconcile_image(request: ReconcileImageInput)- request: image/tag/platform/replica
- response:
ReconcileImageResult(image_key, current_replica, requested_replica, ensured)
- Execute tar.gz output is parsed in streaming form into:
TarDirectoryTarSymlinkTarFilePart(chunked file data; no full-file buffering)
- CPU-heavy tar.gz decode/untar is offloaded via executor:
- pass
tar_executor=...toAfsClient - default is an internal
ThreadPoolExecutor(max_workers=1)
- pass
Extra file input types
ExtraFile.content supports:
bytesAsyncIterator[bytes]
Example
import asyncio
from afs_sdk import AfsClient, ExecuteInput, ExtraFile
async def run():
req = ExecuteInput(
image="alpine",
tag="latest",
command=["/bin/sh", "-c", "echo ok >/tmp/ok.txt"],
env={"FOO": "bar", "PATH": "/custom/bin"},
fuse_max_read_ahead_bytes=16 << 20,
cpu_cores=1,
memory_mb=256,
timeout_ms=2000,
extra_entries=[
ExtraFile(path="hello.txt", content=b"hello from sdk\n"),
],
)
async with AfsClient("127.0.0.1", 62051) as client:
async for event in client.execute(req):
print(type(event).__name__)
asyncio.run(run())
CLI-style demo:
PYTHONPATH=python ~/.local/bin/uv run python python/examples/execute_stream.py \
--addr 127.0.0.1:62051 \
--dir ./extra-dir \
--env FOO=bar \
--env PATH=/custom/bin \
--image alpine --tag latest \
-- /bin/sh -c 'echo ok >/tmp/ok.txt'
If command is omitted, AFS uses the image Entrypoint/Cmd defaults returned by discovery.
Reconcile image replica demo:
PYTHONPATH=python ~/.local/bin/uv run python python/examples/reconcile_image.py \
--addr 127.0.0.1:62051 \
--image alpine --tag latest --replica 0
Metadata
Release files for afs-sdk 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| afs_sdk-0.2.4.tar.gz | 30.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| afs_sdk-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.8 kB
Release files / afs_sdk-0.2.4.tar.gz
| Download URL | afs_sdk-0.2.4.tar.gz |
|---|---|
| Size | 30.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6cadcc1371bd5f2a1e095e7ba1bede44a38d6450fa7e5430e3445c46e827f63e
|
|
BLAKE2b-256 checksum How to use checksums |
3e09491e67391178c13c0189f782d0e79b46795827f2080fb3b3824b43978d73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.
Transparency logRelease files / afs_sdk-0.2.4-py3-none-any.whl
| Download URL | afs_sdk-0.2.4-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
493c0834fdcd38f122d796792734baa29709aacf82fd1c3ac5f526ed3d284ef8
|
|
BLAKE2b-256 checksum How to use checksums |
650d24e4a20377b0cd1fb0532bad2fd212cc7a64fd4a52e7ba95bdf14d21bee3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.
Transparency logSecurity for afs-sdk 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for afs_sdk-0.2.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.