Python SDK for the Sprites API
Project description
Sprites Python SDK
Python SDK for Sprites - remote command execution platform.
Installation
pip install sprites-py
Quick Start
from sprites import SpritesClient
# Create a client
client = SpritesClient(token="your-token")
# Get a sprite handle
sprite = client.sprite("my-sprite")
# Run a command
result = sprite.run("echo", "hello", capture_output=True)
print(result.stdout.decode()) # "hello\n"
# Or use the Go-style API
cmd = sprite.command("ls", "-la")
output = cmd.output()
print(output.decode())
API Overview
SpritesClient
from sprites import SpritesClient
client = SpritesClient(
token="your-token",
base_url="https://api.sprites.dev", # optional
timeout=30.0, # optional
)
# Create a sprite
sprite = client.create_sprite("my-sprite")
# Get a sprite handle (doesn't create it)
sprite = client.sprite("my-sprite")
# Delete a sprite
client.delete_sprite("my-sprite")
Sprite
# Run a command (subprocess.run style)
result = sprite.run("echo", "hello", capture_output=True, timeout=30)
print(result.returncode)
print(result.stdout)
# Create a command (Go exec.Cmd style)
cmd = sprite.command("bash", "-c", "echo hello")
output = cmd.output() # Returns stdout
combined = cmd.combined_output() # Returns stdout + stderr
# TTY mode
cmd = sprite.command("bash", tty=True, tty_rows=24, tty_cols=80)
cmd.run()
Checkpoints
# List checkpoints
checkpoints = sprite.list_checkpoints()
# Create a checkpoint
stream = sprite.create_checkpoint("my checkpoint")
for msg in stream:
print(msg.type, msg.data)
# Restore a checkpoint
stream = sprite.restore_checkpoint("checkpoint-id")
for msg in stream:
print(msg.type, msg.data)
Network Policy
from sprites.types import NetworkPolicy, PolicyRule
# Get current policy
policy = sprite.get_network_policy()
# Update policy
new_policy = NetworkPolicy(rules=[
PolicyRule(domain="example.com", action="allow"),
])
sprite.update_network_policy(new_policy)
Requirements
- Python 3.11+
- websockets
- httpx
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sprites_py-0.0.1rc37.tar.gz.
File metadata
- Download URL: sprites_py-0.0.1rc37.tar.gz
- Upload date:
- Size: 35.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fc58aa80a9a99c1a12cb17725d13675d5e25dc2a33f245f21486473aede05b9
|
|
| MD5 |
71d0e1fbd2e6f95d082fa51dd761b1ac
|
|
| BLAKE2b-256 |
88cd24bbca8438fdc8a89e3365b927b20f511e1c4529a8574ea252e967f8071c
|
Provenance
The following attestation bundles were made for sprites_py-0.0.1rc37.tar.gz:
Publisher:
publish.yml on superfly/sprites-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sprites_py-0.0.1rc37.tar.gz -
Subject digest:
2fc58aa80a9a99c1a12cb17725d13675d5e25dc2a33f245f21486473aede05b9 - Sigstore transparency entry: 971350569
- Sigstore integration time:
-
Permalink:
superfly/sprites-py@6da24c2b69207fdb54572a295fea6004a3c6307f -
Branch / Tag:
refs/tags/v0.0.1-rc37 - Owner: https://github.com/superfly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6da24c2b69207fdb54572a295fea6004a3c6307f -
Trigger Event:
push
-
Statement type:
File details
Details for the file sprites_py-0.0.1rc37-py3-none-any.whl.
File metadata
- Download URL: sprites_py-0.0.1rc37-py3-none-any.whl
- Upload date:
- Size: 39.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d032b0059e2881b16a35349c0f01adafa99143671103a43a79d7e39a0c1ef6c9
|
|
| MD5 |
7d67a23d4cc442976efffd6f23c59056
|
|
| BLAKE2b-256 |
b68b87c87887ae3bde72425134efea163fdbdef610765a8db7244c7b4adeab46
|
Provenance
The following attestation bundles were made for sprites_py-0.0.1rc37-py3-none-any.whl:
Publisher:
publish.yml on superfly/sprites-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sprites_py-0.0.1rc37-py3-none-any.whl -
Subject digest:
d032b0059e2881b16a35349c0f01adafa99143671103a43a79d7e39a0c1ef6c9 - Sigstore transparency entry: 971350616
- Sigstore integration time:
-
Permalink:
superfly/sprites-py@6da24c2b69207fdb54572a295fea6004a3c6307f -
Branch / Tag:
refs/tags/v0.0.1-rc37 - Owner: https://github.com/superfly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6da24c2b69207fdb54572a295fea6004a3c6307f -
Trigger Event:
push
-
Statement type: