stackmachine 0.3.1__py3-none-any.whl → 0.3.2__py3-none-any.whl

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.
stackmachine/__init__.py CHANGED
@@ -74,7 +74,7 @@ from ._uploads import create_zip
74
74
  try:
75
75
  __version__ = version("stackmachine")
76
76
  except PackageNotFoundError:
77
- __version__ = "0.3.1"
77
+ __version__ = "0.3.2"
78
78
 
79
79
  __all__ = [
80
80
  "AppAlias",
@@ -25,24 +25,36 @@ class AsyncStackMachine:
25
25
  self,
26
26
  api_key: str,
27
27
  *,
28
- api_url: str = DEFAULT_API_URL,
28
+ api_url: Optional[str] = None,
29
+ apiUrl: Optional[str] = None,
29
30
  headers: Optional[Headers] = None,
30
31
  timeout: float = DEFAULT_TIMEOUT,
31
- max_network_retries: int = DEFAULT_MAX_NETWORK_RETRIES,
32
+ max_network_retries: Optional[int] = None,
33
+ maxNetworkRetries: Optional[int] = None,
32
34
  http_client: Optional[httpx.AsyncClient] = None,
33
35
  http_transport: Optional[httpx.AsyncBaseTransport] = None,
34
36
  ) -> None:
37
+ resolved_api_url = (
38
+ api_url if api_url is not None else apiUrl or DEFAULT_API_URL
39
+ )
40
+ resolved_max_retries = (
41
+ max_network_retries
42
+ if max_network_retries is not None
43
+ else maxNetworkRetries
44
+ if maxNetworkRetries is not None
45
+ else DEFAULT_MAX_NETWORK_RETRIES
46
+ )
35
47
  self.api_key = api_key
36
- self.api_url = api_url
37
- self.apiUrl = api_url
48
+ self.api_url = resolved_api_url
49
+ self.apiUrl = resolved_api_url
38
50
  self.timeout = timeout
39
- self.max_network_retries = max_network_retries
40
- self.maxNetworkRetries = max_network_retries
51
+ self.max_network_retries = resolved_max_retries
52
+ self.maxNetworkRetries = resolved_max_retries
41
53
  self._config = ClientConfig(
42
- api_url=api_url,
54
+ api_url=resolved_api_url,
43
55
  headers=headers,
44
56
  timeout=timeout,
45
- max_network_retries=max_network_retries,
57
+ max_network_retries=resolved_max_retries,
46
58
  )
47
59
  self._transport = AsyncTransport(
48
60
  api_key,
stackmachine/_client.py CHANGED
@@ -25,24 +25,36 @@ class StackMachine:
25
25
  self,
26
26
  api_key: str,
27
27
  *,
28
- api_url: str = DEFAULT_API_URL,
28
+ api_url: Optional[str] = None,
29
+ apiUrl: Optional[str] = None,
29
30
  headers: Optional[Headers] = None,
30
31
  timeout: float = DEFAULT_TIMEOUT,
31
- max_network_retries: int = DEFAULT_MAX_NETWORK_RETRIES,
32
+ max_network_retries: Optional[int] = None,
33
+ maxNetworkRetries: Optional[int] = None,
32
34
  http_client: Optional[httpx.Client] = None,
33
35
  http_transport: Optional[httpx.BaseTransport] = None,
34
36
  ) -> None:
37
+ resolved_api_url = (
38
+ api_url if api_url is not None else apiUrl or DEFAULT_API_URL
39
+ )
40
+ resolved_max_retries = (
41
+ max_network_retries
42
+ if max_network_retries is not None
43
+ else maxNetworkRetries
44
+ if maxNetworkRetries is not None
45
+ else DEFAULT_MAX_NETWORK_RETRIES
46
+ )
35
47
  self.api_key = api_key
36
- self.api_url = api_url
37
- self.apiUrl = api_url
48
+ self.api_url = resolved_api_url
49
+ self.apiUrl = resolved_api_url
38
50
  self.timeout = timeout
39
- self.max_network_retries = max_network_retries
40
- self.maxNetworkRetries = max_network_retries
51
+ self.max_network_retries = resolved_max_retries
52
+ self.maxNetworkRetries = resolved_max_retries
41
53
  self._config = ClientConfig(
42
- api_url=api_url,
54
+ api_url=resolved_api_url,
43
55
  headers=headers,
44
56
  timeout=timeout,
45
- max_network_retries=max_network_retries,
57
+ max_network_retries=resolved_max_retries,
46
58
  )
47
59
  self._transport = SyncTransport(
48
60
  api_key,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackmachine
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Python SDK for StackMachine.
5
5
  Project-URL: Homepage, https://github.com/stackmachine/sdks/tree/main/python
6
6
  Project-URL: Repository, https://github.com/stackmachine/sdks
@@ -61,15 +61,13 @@ stackmachine = StackMachine("sk_stackmachine_...")
61
61
  async_stackmachine = AsyncStackMachine("sk_stackmachine_...")
62
62
  ```
63
63
 
64
- Both clients accept JavaScript-style aliases during initialization:
64
+ Both clients accept configuration options during initialization:
65
65
 
66
66
  ```python
67
- stackmachine = StackMachine.init(
68
- {
69
- "token": "sk_stackmachine_...",
70
- "apiUrl": "https://api.stackmachine.com/graphql",
71
- "maxNetworkRetries": 2,
72
- }
67
+ stackmachine = StackMachine(
68
+ "sk_stackmachine_...",
69
+ apiUrl="https://api.stackmachine.com/graphql",
70
+ maxNetworkRetries=2,
73
71
  )
74
72
  ```
75
73
 
@@ -101,10 +99,8 @@ async for app in apps:
101
99
 
102
100
  ```python
103
101
  deployment = stackmachine.deployments.create(
104
- {
105
- "file": "https://example.com/app.zip",
106
- "name": "my-app",
107
- }
102
+ upload_url="https://example.com/app.zip",
103
+ app_name="my-app",
108
104
  )
109
105
 
110
106
  version = deployment.wait()
@@ -112,10 +108,8 @@ version = deployment.wait()
112
108
 
113
109
  ```python
114
110
  deployment = stackmachine.apps.autobuild(
115
- {
116
- "file": "https://example.com/app.zip",
117
- "name": "my-app",
118
- }
111
+ upload_url="https://example.com/app.zip",
112
+ app_name="my-app",
119
113
  )
120
114
  ```
121
115
 
@@ -162,13 +156,15 @@ key = stackmachine.apps.ssh.users.authorized_keys.create(
162
156
  Most methods accept `request_options` for per-request configuration:
163
157
 
164
158
  ```python
159
+ from stackmachine import RequestOptions
160
+
165
161
  app = stackmachine.apps.retrieve(
166
162
  "app_id",
167
- request_options={
168
- "api_key": "sk_stackmachine_other",
169
- "timeout": 30,
170
- "idempotency_key": "deploy-123",
171
- },
163
+ request_options=RequestOptions(
164
+ api_key="sk_stackmachine_other",
165
+ timeout=30,
166
+ idempotency_key="deploy-123",
167
+ ),
172
168
  )
173
169
  ```
174
170
 
@@ -1,6 +1,6 @@
1
- stackmachine/__init__.py,sha256=KGWlDYIcuo5TLJIiGHUDISKbR7Djf6aB3xnRgESggww,3742
2
- stackmachine/_async_client.py,sha256=UMkTXJrjZLRWxMxbQNa-I4szwsHZqKvi0Ll3bnhxZPE,6107
3
- stackmachine/_client.py,sha256=0V3siWsoRz0XmYI8rLoEKw6Cm3T3GHcqyp0mJ-hkJAI,5933
1
+ stackmachine/__init__.py,sha256=bwLDfnAqwPNZXPsuu9A4eeSRWjZP4aVpfFfLvur2Oos,3742
2
+ stackmachine/_async_client.py,sha256=nZ5Rxbw6Yk8-3cv124p3tKcf_xyRiuYNcWnCiviIaDs,6570
3
+ stackmachine/_client.py,sha256=e3pdGdrCqgSJ4iNxmbyQI74rs41HrbaWI18s9sVMTQg,6396
4
4
  stackmachine/_config.py,sha256=vZUvZEIKRkCmAqq8dJ5B6r9cWF0rjHQ21AGS4hsaMKc,912
5
5
  stackmachine/_errors.py,sha256=yVJ4U1wUK4kPDXs_PxSlg9VdN9cpmUluToqvKR9r5kc,2708
6
6
  stackmachine/_models.py,sha256=sJBXZyN7o16iIsvbeVaSyE5XZmRsnV8zRnmgAmxKMa8,6211
@@ -20,6 +20,6 @@ stackmachine/resources/domains.py,sha256=oBbtp2X6ya5BQvhFtXFz7aKUGZcqTO4Ky-kOo-G
20
20
  stackmachine/resources/files.py,sha256=j4fFnFuz2-zM8MRvmRxv7jC47Q_NiTQaYCpR0Kb4Gpk,2701
21
21
  stackmachine/resources/ssh.py,sha256=tbqVWyAqeNf_eCjftF1b2Q1ED-ocpuRC2rSHyuzdRGM,22359
22
22
  stackmachine/resources/versions.py,sha256=VYMUS2KdoEh4POHm5IFF0Sy1xNI8jrwpHhtoKqgUqfk,7426
23
- stackmachine-0.3.1.dist-info/METADATA,sha256=XwPeHut887WGAhnWRp3loluzC8S4aNHl8bo6o7IfnEw,4348
24
- stackmachine-0.3.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
25
- stackmachine-0.3.1.dist-info/RECORD,,
23
+ stackmachine-0.3.2.dist-info/METADATA,sha256=gtJcf8dtBiJg3I6qb11uzTouVp3OM0gDxiG4sEYe9bs,4315
24
+ stackmachine-0.3.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
25
+ stackmachine-0.3.2.dist-info/RECORD,,