fastapi-cloud-cli 0.28.1__py3-none-any.whl → 0.29.0__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.
- fastapi_cloud_cli/__init__.py +1 -1
- fastapi_cloud_cli/api/_models.py +7 -1
- fastapi_cloud_cli/api/client.py +4 -3
- fastapi_cloud_cli/commands/_flow.py +20 -1
- fastapi_cloud_cli/commands/env/get.py +1 -1
- fastapi_cloud_cli/commands/integrations/resources/disconnect.py +1 -1
- fastapi_cloud_cli/utils/sentry.py +12 -1
- {fastapi_cloud_cli-0.28.1.dist-info → fastapi_cloud_cli-0.29.0.dist-info}/METADATA +1 -1
- {fastapi_cloud_cli-0.28.1.dist-info → fastapi_cloud_cli-0.29.0.dist-info}/RECORD +12 -12
- {fastapi_cloud_cli-0.28.1.dist-info → fastapi_cloud_cli-0.29.0.dist-info}/WHEEL +0 -0
- {fastapi_cloud_cli-0.28.1.dist-info → fastapi_cloud_cli-0.29.0.dist-info}/entry_points.txt +0 -0
- {fastapi_cloud_cli-0.28.1.dist-info → fastapi_cloud_cli-0.29.0.dist-info}/licenses/LICENSE +0 -0
fastapi_cloud_cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.29.0"
|
fastapi_cloud_cli/api/_models.py
CHANGED
|
@@ -117,6 +117,7 @@ class DeploymentStatus(StrEnum):
|
|
|
117
117
|
verification_failed_oom = "verification_failed_oom"
|
|
118
118
|
verifying_skipped = "verifying_skipped"
|
|
119
119
|
success = "success"
|
|
120
|
+
scaled_to_zero = "scaled_to_zero"
|
|
120
121
|
degraded_oom = "degraded_oom"
|
|
121
122
|
degraded = "degraded"
|
|
122
123
|
expired = "expired"
|
|
@@ -151,6 +152,7 @@ class DeploymentStatus(StrEnum):
|
|
|
151
152
|
cls.verification_failed_oom: "Verification Failed (OOM)",
|
|
152
153
|
cls.verifying_skipped: "Verification Skipped",
|
|
153
154
|
cls.success: "Ready",
|
|
155
|
+
cls.scaled_to_zero: "Scaled to Zero",
|
|
154
156
|
cls.degraded_oom: "Degraded (OOM)",
|
|
155
157
|
cls.degraded: "Degraded",
|
|
156
158
|
cls.expired: "Expired",
|
|
@@ -170,7 +172,11 @@ class Deployment(BaseModel):
|
|
|
170
172
|
failure: BuildFailure | None = None
|
|
171
173
|
|
|
172
174
|
|
|
173
|
-
SUCCESSFUL_STATUSES = {
|
|
175
|
+
SUCCESSFUL_STATUSES = {
|
|
176
|
+
DeploymentStatus.success,
|
|
177
|
+
DeploymentStatus.scaled_to_zero,
|
|
178
|
+
DeploymentStatus.verifying_skipped,
|
|
179
|
+
}
|
|
174
180
|
BUILD_FAILED_STATUSES = {
|
|
175
181
|
DeploymentStatus.building_image_failed,
|
|
176
182
|
DeploymentStatus.building_image_failed_timeout,
|
fastapi_cloud_cli/api/client.py
CHANGED
|
@@ -211,10 +211,11 @@ class APIClient(httpx.Client):
|
|
|
211
211
|
|
|
212
212
|
return CustomDomain.model_validate(response.json())
|
|
213
213
|
|
|
214
|
-
def logout(self) -> None:
|
|
215
|
-
"""Revoke the token this client sends."""
|
|
214
|
+
def logout(self, token: str | None = None) -> None:
|
|
215
|
+
"""Revoke the given token, or else the token this client sends."""
|
|
216
|
+
headers = {"Authorization": f"Bearer {token}"} if token else None
|
|
216
217
|
# Short, so logging out doesn't hang when FastAPI Cloud is slow.
|
|
217
|
-
response = self.post("/logout", timeout=5)
|
|
218
|
+
response = self.post("/logout", headers=headers, timeout=5)
|
|
218
219
|
# FastAPI Cloud without /logout can't revoke tokens, so there's nothing to do.
|
|
219
220
|
if response.status_code != 404:
|
|
220
221
|
response.raise_for_status()
|
|
@@ -8,7 +8,12 @@ from rich_toolkit.progress import Progress
|
|
|
8
8
|
|
|
9
9
|
from fastapi_cloud_cli.api import APIClient
|
|
10
10
|
from fastapi_cloud_cli.config import Settings
|
|
11
|
-
from fastapi_cloud_cli.utils.auth import
|
|
11
|
+
from fastapi_cloud_cli.utils.auth import (
|
|
12
|
+
AuthConfig,
|
|
13
|
+
AuthMode,
|
|
14
|
+
Identity,
|
|
15
|
+
write_auth_config,
|
|
16
|
+
)
|
|
12
17
|
from fastapi_cloud_cli.utils.cli import FastAPIRichToolkit
|
|
13
18
|
|
|
14
19
|
logger = logging.getLogger(__name__)
|
|
@@ -172,8 +177,22 @@ def complete_device_login(
|
|
|
172
177
|
if token.expires_in is not None:
|
|
173
178
|
expires_at = int(time.time()) + token.expires_in
|
|
174
179
|
|
|
180
|
+
replaced = Identity()
|
|
181
|
+
|
|
175
182
|
write_auth_config(
|
|
176
183
|
AuthConfig(access_token=token.access_token, expires_at=expires_at)
|
|
177
184
|
)
|
|
178
185
|
|
|
186
|
+
if replaced.user_token and not replaced.is_user_token_expired():
|
|
187
|
+
_revoke_replaced_login(client, replaced.user_token)
|
|
188
|
+
|
|
179
189
|
return LoginOutput(authenticated=True, auth_mode="user")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _revoke_replaced_login(client: APIClient, token: str) -> None:
|
|
193
|
+
# Otherwise the replaced login stays valid, unused, until it expires.
|
|
194
|
+
# Best effort: the new login is already saved, so a failure changes nothing.
|
|
195
|
+
try:
|
|
196
|
+
client.logout(token)
|
|
197
|
+
except httpx.HTTPError as e:
|
|
198
|
+
logger.debug("Could not revoke the replaced login: %s", e)
|
|
@@ -105,7 +105,7 @@ def get_variable(
|
|
|
105
105
|
name = toolkit.ask(
|
|
106
106
|
"Select the environment variable to get:",
|
|
107
107
|
options=[
|
|
108
|
-
Option({"name": env_var.name, "value": env_var.name})
|
|
108
|
+
Option[str]({"name": env_var.name, "value": env_var.name})
|
|
109
109
|
for env_var in environment_variables.data
|
|
110
110
|
],
|
|
111
111
|
bullet=False,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
1
3
|
import sentry_sdk
|
|
2
4
|
from sentry_sdk.integrations.typer import TyperIntegration
|
|
3
5
|
|
|
@@ -6,6 +8,15 @@ from fastapi_cloud_cli.utils.auth import Identity
|
|
|
6
8
|
SENTRY_DSN = "https://230250605ea4b58a0b69c768e9ec1168@o4506985151856640.ingest.us.sentry.io/4508449198899200"
|
|
7
9
|
|
|
8
10
|
|
|
11
|
+
def _without_user_data() -> dict[str, Any]:
|
|
12
|
+
# sentry-sdk 3 replaced `send_default_pii` with `data_collection`, and
|
|
13
|
+
# collects user info unless told not to. Apps can still pin sentry-sdk 2.
|
|
14
|
+
if int(sentry_sdk.VERSION.split(".")[0]) < 3:
|
|
15
|
+
return {"send_default_pii": False}
|
|
16
|
+
|
|
17
|
+
return {"data_collection": {"user_info": False}}
|
|
18
|
+
|
|
19
|
+
|
|
9
20
|
def init_sentry() -> None:
|
|
10
21
|
"""Initialize Sentry error tracking only if user is logged in or has a deploy token."""
|
|
11
22
|
identity = Identity()
|
|
@@ -16,5 +27,5 @@ def init_sentry() -> None:
|
|
|
16
27
|
sentry_sdk.init(
|
|
17
28
|
dsn=SENTRY_DSN,
|
|
18
29
|
integrations=[TyperIntegration()],
|
|
19
|
-
|
|
30
|
+
**_without_user_data(),
|
|
20
31
|
)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
fastapi_cloud_cli-0.
|
|
2
|
-
fastapi_cloud_cli-0.
|
|
3
|
-
fastapi_cloud_cli-0.
|
|
4
|
-
fastapi_cloud_cli-0.
|
|
5
|
-
fastapi_cloud_cli/__init__.py,sha256=
|
|
1
|
+
fastapi_cloud_cli-0.29.0.dist-info/METADATA,sha256=czXeE_Idu5hDpU3XNUYejbyi5LLfLJW7pLETJat6-tY,3159
|
|
2
|
+
fastapi_cloud_cli-0.29.0.dist-info/WHEEL,sha256=IuIk3wbaEnFH1cx75iM2R1CmliRI3dFLXTbRakgvgFQ,90
|
|
3
|
+
fastapi_cloud_cli-0.29.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
fastapi_cloud_cli-0.29.0.dist-info/licenses/LICENSE,sha256=FqD5B4VbXJnefprQseE0U8llL6FxojC-i8muZy7YmSU,1086
|
|
5
|
+
fastapi_cloud_cli/__init__.py,sha256=RvbohpnoJRSLAwJOFoWTtu5c5Vpi5vWAfsKR12hwJVI,23
|
|
6
6
|
fastapi_cloud_cli/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
|
7
7
|
fastapi_cloud_cli/_app.py,sha256=7RNSWWNLEoIN3WwvTBJ3MSKIPPfbbwoLHFJrSYdJjJc,735
|
|
8
8
|
fastapi_cloud_cli/api/__init__.py,sha256=ORZqOHW7yaKjq0jY7M5pK8J5oyFgMOrWNeBzXMC2fCA,1359
|
|
9
9
|
fastapi_cloud_cli/api/_errors.py,sha256=YAoKrlK92zvFlzG1LJhin3qMLW8ODgeDTYD4ASBOh8U,3717
|
|
10
|
-
fastapi_cloud_cli/api/_models.py,sha256=
|
|
10
|
+
fastapi_cloud_cli/api/_models.py,sha256=0fGjW6ajoeGKhG05BMK29-RvhQDCkE7b1VyazLCqYCg,6211
|
|
11
11
|
fastapi_cloud_cli/api/_retry.py,sha256=FAVsRnd71jKBzIJ1sbe4pH193ciYOxigzJeM3RwkdqY,2677
|
|
12
|
-
fastapi_cloud_cli/api/client.py,sha256=
|
|
12
|
+
fastapi_cloud_cli/api/client.py,sha256=YJLvtqbH0-ujVc0ckR8EEgrWAN8V3kMRs_Dv9rBN0rI,11398
|
|
13
13
|
fastapi_cloud_cli/cli.py,sha256=u-ZYE-mN0Ml5XNy11iMR_W8WCqp8d2J6BZ7YH05-CkM,3989
|
|
14
14
|
fastapi_cloud_cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
fastapi_cloud_cli/commands/_auth.py,sha256=9v7rhkpuapanw7luvvmaNHz2LZvRLJ9zFr0EfUCQ3sk,1308
|
|
16
|
-
fastapi_cloud_cli/commands/_flow.py,sha256=
|
|
16
|
+
fastapi_cloud_cli/commands/_flow.py,sha256=11xtvu2tua7GB2Rc1FbZ6r5zCl_4ve1zU0kJql5IiNM,5482
|
|
17
17
|
fastapi_cloud_cli/commands/apps/__init__.py,sha256=-oW9VE8MFLE0zy2QuipUL0oT7Jczs0GRiROeSnK8vFw,94
|
|
18
18
|
fastapi_cloud_cli/commands/apps/_app.py,sha256=ilokfEQAgehMjEn3XtxKqVDtFYBnZBgiDdf42s3oWsk,110
|
|
19
19
|
fastapi_cloud_cli/commands/apps/create.py,sha256=dPr9mMD2yG0cxsEzM5Xo5MeQPAFQlUXRCEplIYLtZG0,5507
|
|
@@ -50,7 +50,7 @@ fastapi_cloud_cli/commands/env/__init__.py,sha256=X3cOoOwBCn8jgoIPWMPGRiRzPfUomi
|
|
|
50
50
|
fastapi_cloud_cli/commands/env/_app.py,sha256=Ip-tTBKpl_xUhMwnYlmvep7tu-VC3gFHo_9IWklBg_k,123
|
|
51
51
|
fastapi_cloud_cli/commands/env/_shared.py,sha256=dDtLjcv5AK7v9N_BPD4fZaElc1Mu3xBBpHA78kbeyTI,855
|
|
52
52
|
fastapi_cloud_cli/commands/env/delete.py,sha256=baILA8agCL41h2MNbbdPqj5k600AAG7HYboxveGo2Ag,5601
|
|
53
|
-
fastapi_cloud_cli/commands/env/get.py,sha256=
|
|
53
|
+
fastapi_cloud_cli/commands/env/get.py,sha256=FJpkHipaHG64dEDvgw0a28mhja0Z8LLkq28P2sOE1RQ,3983
|
|
54
54
|
fastapi_cloud_cli/commands/env/list.py,sha256=oeqjX-eofuidbyoZY31x2bpm0aZAavDhmT3KW3n5jww,3271
|
|
55
55
|
fastapi_cloud_cli/commands/env/set.py,sha256=wGOFeaat-W1OE8VnTeayezlmcPEeeIHznEEcYj4wELk,6247
|
|
56
56
|
fastapi_cloud_cli/commands/integrations/__init__.py,sha256=0rxfgiemdH6QLzxeA1egGi9T6JVw8EiBV_cOF4cTe-I,424
|
|
@@ -60,7 +60,7 @@ fastapi_cloud_cli/commands/integrations/providers/list.py,sha256=hAaRgFoW-4FXIIj
|
|
|
60
60
|
fastapi_cloud_cli/commands/integrations/resources/__init__.py,sha256=XthSeuJ-KHeS1TWon_uqZkiAIyDOpNjB2od9jWD7ZlE,136
|
|
61
61
|
fastapi_cloud_cli/commands/integrations/resources/_app.py,sha256=weporYT5Vgn9vpwlu2s7jl4-zX7ZjO371uiuxtkYHEI,121
|
|
62
62
|
fastapi_cloud_cli/commands/integrations/resources/connect.py,sha256=dV5bsyHhYcrYZkfd-6HiwTvqGO2M8Pl_fpMyXfWaDWg,4406
|
|
63
|
-
fastapi_cloud_cli/commands/integrations/resources/disconnect.py,sha256=
|
|
63
|
+
fastapi_cloud_cli/commands/integrations/resources/disconnect.py,sha256=x7Oh18bCOSoUkDiHnDNjGsuhO1M1J97ukcF29VD5voI,7723
|
|
64
64
|
fastapi_cloud_cli/commands/integrations/resources/get.py,sha256=E4hXpZeS5DX0wFjra6vrlTO5QrP5M3q5-mbS8T_RYHc,6422
|
|
65
65
|
fastapi_cloud_cli/commands/integrations/resources/list.py,sha256=AKyBWgZxpssor3jzFUFM83vpe684IzGnZ_iUj3d5zB0,3488
|
|
66
66
|
fastapi_cloud_cli/commands/integrations/resources/providers.py,sha256=-9RnA7qW-rYaBm2q86bQlnqTvzorjjrbT0XBwwwY7uA,232
|
|
@@ -92,7 +92,7 @@ fastapi_cloud_cli/utils/env.py,sha256=a9S6ehNGxhKbQHXxFVJtjqMEkodKwKa0wOvRVh9VBj
|
|
|
92
92
|
fastapi_cloud_cli/utils/errors.py,sha256=lZYNUNgZejV-ztlp-zMTwjIJ-Od_5XvfW3RkHKf-jLw,580
|
|
93
93
|
fastapi_cloud_cli/utils/execution.py,sha256=oyxRLUlvdBIqZyiYkyP9OR7J7WBJuZL5Pp4NnX98o-E,398
|
|
94
94
|
fastapi_cloud_cli/utils/progress_file.py,sha256=GMK-OgS1pr2IgfBpJgwPqkb2k37W0b2Crsu_r3WSEWo,988
|
|
95
|
-
fastapi_cloud_cli/utils/sentry.py,sha256=
|
|
95
|
+
fastapi_cloud_cli/utils/sentry.py,sha256=uR8ie_s0MNV8Te6SGD47a6bgrnt6XeR55YvzKekd7Gg,969
|
|
96
96
|
fastapi_cloud_cli/utils/teams.py,sha256=PSCL-hySKcUU_pz45xBEKeB8NCbWLBCGlgx_GFLZ-2w,2007
|
|
97
97
|
fastapi_cloud_cli/utils/version_check.py,sha256=JJIED6Cl_yXQADdX5xT-4j-zyKP6L17w9mkcGjKKYp4,5186
|
|
98
|
-
fastapi_cloud_cli-0.
|
|
98
|
+
fastapi_cloud_cli-0.29.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|