sprites-py 0.0.1a1__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.
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: sprites-py
3
+ Version: 0.0.1a1
4
+ Summary: Python SDK for the Sprites API
5
+ Author: Sprites Team
6
+ License: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: httpx>=0.25.0
19
+ Requires-Dist: websockets>=12.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=7.0; extra == "dev"
22
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
23
+ Requires-Dist: mypy>=1.0; extra == "dev"
24
+
25
+ # Sprites Python SDK
26
+
27
+ Python SDK for [Sprites](https://sprites.dev) - remote command execution platform.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install sprites-py
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ```python
38
+ from sprites import SpritesClient
39
+
40
+ # Create a client
41
+ client = SpritesClient(token="your-token")
42
+
43
+ # Get a sprite handle
44
+ sprite = client.sprite("my-sprite")
45
+
46
+ # Run a command
47
+ result = sprite.run("echo", "hello", capture_output=True)
48
+ print(result.stdout.decode()) # "hello\n"
49
+
50
+ # Or use the Go-style API
51
+ cmd = sprite.command("ls", "-la")
52
+ output = cmd.output()
53
+ print(output.decode())
54
+ ```
55
+
56
+ ## API Overview
57
+
58
+ ### SpritesClient
59
+
60
+ ```python
61
+ from sprites import SpritesClient
62
+
63
+ client = SpritesClient(
64
+ token="your-token",
65
+ base_url="https://api.sprites.dev", # optional
66
+ timeout=30.0, # optional
67
+ )
68
+
69
+ # Create a sprite
70
+ sprite = client.create_sprite("my-sprite")
71
+
72
+ # Get a sprite handle (doesn't create it)
73
+ sprite = client.sprite("my-sprite")
74
+
75
+ # Delete a sprite
76
+ client.delete_sprite("my-sprite")
77
+ ```
78
+
79
+ ### Sprite
80
+
81
+ ```python
82
+ # Run a command (subprocess.run style)
83
+ result = sprite.run("echo", "hello", capture_output=True, timeout=30)
84
+ print(result.returncode)
85
+ print(result.stdout)
86
+
87
+ # Create a command (Go exec.Cmd style)
88
+ cmd = sprite.command("bash", "-c", "echo hello")
89
+ output = cmd.output() # Returns stdout
90
+ combined = cmd.combined_output() # Returns stdout + stderr
91
+
92
+ # TTY mode
93
+ cmd = sprite.command("bash", tty=True, tty_rows=24, tty_cols=80)
94
+ cmd.run()
95
+ ```
96
+
97
+ ### Checkpoints
98
+
99
+ ```python
100
+ # List checkpoints
101
+ checkpoints = sprite.list_checkpoints()
102
+
103
+ # Create a checkpoint
104
+ stream = sprite.create_checkpoint("my checkpoint")
105
+ for msg in stream:
106
+ print(msg.type, msg.data)
107
+
108
+ # Restore a checkpoint
109
+ stream = sprite.restore_checkpoint("checkpoint-id")
110
+ for msg in stream:
111
+ print(msg.type, msg.data)
112
+ ```
113
+
114
+ ### Network Policy
115
+
116
+ ```python
117
+ from sprites.types import NetworkPolicy, PolicyRule
118
+
119
+ # Get current policy
120
+ policy = sprite.get_network_policy()
121
+
122
+ # Update policy
123
+ new_policy = NetworkPolicy(rules=[
124
+ PolicyRule(domain="example.com", action="allow"),
125
+ ])
126
+ sprite.update_network_policy(new_policy)
127
+ ```
128
+
129
+ ## Requirements
130
+
131
+ - Python 3.11+
132
+ - websockets
133
+ - httpx
134
+
135
+ ## License
136
+
137
+ MIT
@@ -0,0 +1,113 @@
1
+ # Sprites Python SDK
2
+
3
+ Python SDK for [Sprites](https://sprites.dev) - remote command execution platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install sprites-py
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from sprites import SpritesClient
15
+
16
+ # Create a client
17
+ client = SpritesClient(token="your-token")
18
+
19
+ # Get a sprite handle
20
+ sprite = client.sprite("my-sprite")
21
+
22
+ # Run a command
23
+ result = sprite.run("echo", "hello", capture_output=True)
24
+ print(result.stdout.decode()) # "hello\n"
25
+
26
+ # Or use the Go-style API
27
+ cmd = sprite.command("ls", "-la")
28
+ output = cmd.output()
29
+ print(output.decode())
30
+ ```
31
+
32
+ ## API Overview
33
+
34
+ ### SpritesClient
35
+
36
+ ```python
37
+ from sprites import SpritesClient
38
+
39
+ client = SpritesClient(
40
+ token="your-token",
41
+ base_url="https://api.sprites.dev", # optional
42
+ timeout=30.0, # optional
43
+ )
44
+
45
+ # Create a sprite
46
+ sprite = client.create_sprite("my-sprite")
47
+
48
+ # Get a sprite handle (doesn't create it)
49
+ sprite = client.sprite("my-sprite")
50
+
51
+ # Delete a sprite
52
+ client.delete_sprite("my-sprite")
53
+ ```
54
+
55
+ ### Sprite
56
+
57
+ ```python
58
+ # Run a command (subprocess.run style)
59
+ result = sprite.run("echo", "hello", capture_output=True, timeout=30)
60
+ print(result.returncode)
61
+ print(result.stdout)
62
+
63
+ # Create a command (Go exec.Cmd style)
64
+ cmd = sprite.command("bash", "-c", "echo hello")
65
+ output = cmd.output() # Returns stdout
66
+ combined = cmd.combined_output() # Returns stdout + stderr
67
+
68
+ # TTY mode
69
+ cmd = sprite.command("bash", tty=True, tty_rows=24, tty_cols=80)
70
+ cmd.run()
71
+ ```
72
+
73
+ ### Checkpoints
74
+
75
+ ```python
76
+ # List checkpoints
77
+ checkpoints = sprite.list_checkpoints()
78
+
79
+ # Create a checkpoint
80
+ stream = sprite.create_checkpoint("my checkpoint")
81
+ for msg in stream:
82
+ print(msg.type, msg.data)
83
+
84
+ # Restore a checkpoint
85
+ stream = sprite.restore_checkpoint("checkpoint-id")
86
+ for msg in stream:
87
+ print(msg.type, msg.data)
88
+ ```
89
+
90
+ ### Network Policy
91
+
92
+ ```python
93
+ from sprites.types import NetworkPolicy, PolicyRule
94
+
95
+ # Get current policy
96
+ policy = sprite.get_network_policy()
97
+
98
+ # Update policy
99
+ new_policy = NetworkPolicy(rules=[
100
+ PolicyRule(domain="example.com", action="allow"),
101
+ ])
102
+ sprite.update_network_policy(new_policy)
103
+ ```
104
+
105
+ ## Requirements
106
+
107
+ - Python 3.11+
108
+ - websockets
109
+ - httpx
110
+
111
+ ## License
112
+
113
+ MIT
@@ -0,0 +1,47 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sprites-py"
7
+ version = "0.0.1-alpha.1"
8
+ description = "Python SDK for the Sprites API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Sprites Team"}
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ ]
26
+ dependencies = [
27
+ "httpx>=0.25.0",
28
+ "websockets>=12.0",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "pytest>=7.0",
34
+ "pytest-asyncio>=0.21.0",
35
+ "mypy>=1.0",
36
+ ]
37
+
38
+ [project.scripts]
39
+ sprites-cli = "sprites.cli:main"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
43
+
44
+ [tool.mypy]
45
+ python_version = "0.0.1-alpha.1"
46
+ warn_return_any = true
47
+ warn_unused_configs = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,109 @@
1
+ """
2
+ Sprites SDK for Python
3
+
4
+ A Python SDK for interacting with the Sprites API, providing filesystem,
5
+ checkpoint, services, and network policy management.
6
+
7
+ Usage:
8
+ from sprites import SpritesClient
9
+
10
+ client = SpritesClient(token="your-token")
11
+ sprite = client.sprite("my-sprite")
12
+
13
+ # Filesystem operations (pathlib.Path-like API)
14
+ fs = sprite.filesystem("/app")
15
+ config = (fs / "config.json").read_text()
16
+ (fs / "output.txt").write_text("Hello, World!")
17
+
18
+ # List directory contents
19
+ for entry in (fs / "data").iterdir():
20
+ print(entry.name)
21
+ """
22
+
23
+ from .client import SpritesClient
24
+ from .sprite import Sprite
25
+ from .filesystem import SpriteFilesystem, SpritePath
26
+ from .exceptions import (
27
+ SpriteError,
28
+ NetworkError,
29
+ AuthenticationError,
30
+ NotFoundError,
31
+ ExecError,
32
+ FilesystemError,
33
+ FileNotFoundError_,
34
+ IsADirectoryError_,
35
+ NotADirectoryError_,
36
+ PermissionError_,
37
+ DirectoryNotEmptyError,
38
+ )
39
+ from .types import (
40
+ ClientOptions,
41
+ URLSettings,
42
+ SpriteConfig,
43
+ SpawnOptions,
44
+ ExecOptions,
45
+ ExecResult,
46
+ SpriteInfo,
47
+ ListOptions,
48
+ SpriteList,
49
+ Session,
50
+ Checkpoint,
51
+ StreamMessage,
52
+ PortMapping,
53
+ Service,
54
+ ServiceState,
55
+ ServiceWithState,
56
+ ServiceRequest,
57
+ ServiceLogEvent,
58
+ PolicyRule,
59
+ NetworkPolicy,
60
+ FileStat,
61
+ DirEntry,
62
+ )
63
+
64
+ __version__ = "0.0.1-alpha.1"
65
+
66
+ __all__ = [
67
+ # Main classes
68
+ "SpritesClient",
69
+ "Sprite",
70
+ "SpriteFilesystem",
71
+ "SpritePath",
72
+ # Exceptions
73
+ "SpriteError",
74
+ "NetworkError",
75
+ "AuthenticationError",
76
+ "NotFoundError",
77
+ "ExecError",
78
+ "FilesystemError",
79
+ "FileNotFoundError_",
80
+ "IsADirectoryError_",
81
+ "NotADirectoryError_",
82
+ "PermissionError_",
83
+ "DirectoryNotEmptyError",
84
+ # Types
85
+ "ClientOptions",
86
+ "URLSettings",
87
+ "SpriteConfig",
88
+ "SpawnOptions",
89
+ "ExecOptions",
90
+ "ExecResult",
91
+ "SpriteInfo",
92
+ "ListOptions",
93
+ "SpriteList",
94
+ "Session",
95
+ "Checkpoint",
96
+ "StreamMessage",
97
+ "PortMapping",
98
+ "Service",
99
+ "ServiceState",
100
+ "ServiceWithState",
101
+ "ServiceRequest",
102
+ "ServiceLogEvent",
103
+ "PolicyRule",
104
+ "NetworkPolicy",
105
+ "FileStat",
106
+ "DirEntry",
107
+ # Version
108
+ "__version__",
109
+ ]