Skip to content

Commit 832db0e

Browse files
committed
feat(sdk/python): Update dstack python SDK.
1 parent 6e2150f commit 832db0e

15 files changed

Lines changed: 3304 additions & 1008 deletions

sdk/python/pdm.lock

Lines changed: 1366 additions & 828 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/python/pyproject.toml

Lines changed: 107 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies = [
99
"httpx>=0.27.2",
1010
"asyncio>=3.4.3",
1111
"pydantic>=2.9.2",
12+
"cryptography>=43.0.0",
1213
]
1314
requires-python = ">=3.10"
1415
readme = "README.md"
@@ -25,18 +26,119 @@ all = ["solders", "web3"]
2526
requires = ["pdm-backend"]
2627
build-backend = "pdm.backend"
2728

29+
[dependency-groups]
30+
test = [
31+
"pytest>=8.3.3",
32+
"pytest-asyncio>=0.24.0",
33+
"evidence-api>=0.5.0",
34+
]
35+
lint = [
36+
"mypy>=1.8.0",
37+
"black>=24.0.0",
38+
"isort>=5.12.0",
39+
"flake8>=7.0.0",
40+
"flake8-docstrings>=1.7.0",
41+
"flake8-pyproject>=1.2.3",
42+
]
43+
solana = [
44+
"solders",
45+
]
46+
ethereum = [
47+
"web3",
48+
]
49+
50+
[tool.mypy]
51+
python_version = "3.10"
52+
warn_return_any = true
53+
warn_unused_configs = true
54+
disallow_untyped_defs = true
55+
disallow_incomplete_defs = true
56+
check_untyped_defs = true
57+
disallow_untyped_decorators = true
58+
no_implicit_optional = true
59+
warn_redundant_casts = true
60+
warn_unused_ignores = true
61+
warn_no_return = true
62+
warn_unreachable = true
63+
strict_equality = true
64+
show_error_codes = true
65+
66+
# Black configuration
67+
[tool.black]
68+
line-length = 88
69+
target-version = ['py310']
70+
include = '\.pyi?$'
71+
exclude = '''
72+
/(
73+
\.git
74+
| \.hg
75+
| \.mypy_cache
76+
| \.tox
77+
| \.venv
78+
| _build
79+
| buck-out
80+
| build
81+
| dist
82+
)/
83+
'''
84+
85+
# isort configuration
86+
[tool.isort]
87+
profile = "black"
88+
line_length = 88
89+
# Enforce one import per line without parentheses
90+
force_single_line = true
91+
use_parentheses = false
92+
include_trailing_comma = false
93+
multi_line_output = 3
94+
force_grid_wrap = 0
95+
ensure_newline_before_comments = true
96+
97+
# flake8 configuration
98+
[tool.flake8]
99+
max-line-length = 88
100+
extend-ignore = [
101+
"E203", # whitespace before ':'
102+
"E501", # line too long (handled by black)
103+
"W503", # line break before binary operator
104+
]
105+
exclude = [
106+
".git",
107+
"__pycache__",
108+
"build",
109+
"dist",
110+
".venv",
111+
".mypy_cache",
112+
".pytest_cache",
113+
]
114+
per-file-ignores = [
115+
"__init__.py:F401", # imported but unused
116+
"tests/*.py:D100,D101,D102,D103,D104", # relax docstring rules for tests
117+
]
28118
[tool.pdm]
29119
distribution = true
30120

31121
[tool.pdm.publish]
32122
repository = "pypi"
33123

124+
[tool.pdm.scripts]
125+
# Formatting scripts
126+
fmt = {composite = ["isort src/ tests/", "black src/ tests/"]}
127+
format = {call = "pdm:fmt"}
128+
129+
# Linting scripts
130+
lint = {composite = ["flake8 src/ tests/", "mypy src/"]}
131+
check = {composite = ["black --check src/ tests/", "isort --check-only src/ tests/", "flake8 src/ tests/", "mypy src/"]}
132+
133+
# Testing scripts
134+
test = "pytest"
135+
test-cov = "pytest --cov=src/"
136+
137+
# Combined scripts
138+
check-all = {composite = ["pdm:fmt", "pdm:lint", "pdm:test"]}
139+
verify = {composite = ["pdm:check", "pdm:test"]}
140+
34141
[tool.pdm.dev-dependencies]
35-
test = [
36-
"pytest>=8.3.3",
37-
"pytest-asyncio>=0.24.0",
38-
"evidence-api>=0.5.0",
39-
]
40142
solana = [
41143
"solders",
42144
]
Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1-
from .dstack_client import DstackClient, AsyncDstackClient, GetKeyResponse, GetTlsKeyResponse, GetQuoteResponse
1+
"""Top-level package for the dstack Python SDK.
22
3-
__all__ = ['DstackClient', 'AsyncDstackClient', 'GetKeyResponse', 'GetTlsKeyResponse', 'GetQuoteResponse']
3+
Provides synchronous and asynchronous clients, cryptographic helpers, and
4+
utilities for working with dstack services.
5+
"""
6+
7+
from .dstack_client import AsyncDstackClient
8+
from .dstack_client import AsyncTappdClient
9+
from .dstack_client import DstackClient
10+
from .dstack_client import EventLog
11+
from .dstack_client import GetKeyResponse
12+
from .dstack_client import GetQuoteResponse
13+
from .dstack_client import GetTlsKeyResponse
14+
from .dstack_client import InfoResponse
15+
from .dstack_client import TappdClient
16+
from .dstack_client import TcbInfo
17+
from .encrypt_env_vars import EnvVar
18+
from .encrypt_env_vars import encrypt_env_vars
19+
from .encrypt_env_vars import encrypt_env_vars_sync
20+
from .get_compose_hash import AppCompose
21+
from .get_compose_hash import DockerConfig
22+
from .get_compose_hash import get_compose_hash
23+
from .verify_env_encrypt_public_key import verify_env_encrypt_public_key
24+
from .verify_env_encrypt_public_key import verify_signature_simple
25+
26+
__all__ = [
27+
# Core clients
28+
"DstackClient",
29+
"AsyncDstackClient",
30+
"AsyncTappdClient",
31+
"TappdClient",
32+
# Response types
33+
"GetKeyResponse",
34+
"GetTlsKeyResponse",
35+
"GetQuoteResponse",
36+
"InfoResponse",
37+
"TcbInfo",
38+
"EventLog",
39+
# Utility functions
40+
"encrypt_env_vars_sync",
41+
"encrypt_env_vars",
42+
"EnvVar",
43+
"get_compose_hash",
44+
"AppCompose",
45+
"DockerConfig",
46+
"verify_env_encrypt_public_key",
47+
"verify_signature_simple",
48+
]

0 commit comments

Comments
 (0)