fastapi-cloud-cli 0.27.1__tar.gz → 0.28.1__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.
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/PKG-INFO +4 -3
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/pyproject.toml +5 -3
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/scripts/prepare_release.py +2 -2
- fastapi_cloud_cli-0.28.1/src/fastapi_cloud_cli/__init__.py +1 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/api/_errors.py +1 -1
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/api/_models.py +3 -3
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/api/_retry.py +1 -2
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/api/client.py +8 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/_auth.py +3 -1
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/_flow.py +11 -4
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/link.py +3 -1
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deploy/command.py +4 -2
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/login.py +0 -10
- fastapi_cloud_cli-0.28.1/src/fastapi_cloud_cli/commands/logout.py +67 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/logs.py +1 -1
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/setup_ci.py +2 -2
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/auth.py +11 -68
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/dates.py +4 -4
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/version_check.py +3 -3
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/conftest.py +8 -3
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/domains/test_cli.py +4 -4
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/resources/test_get.py +3 -3
- fastapi_cloud_cli-0.28.1/tests/test_auth.py +59 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli.py +3 -3
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_apps.py +2 -2
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_deploy.py +20 -4
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_deployments.py +3 -3
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_link.py +16 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_login.py +118 -22
- fastapi_cloud_cli-0.28.1/tests/test_cli_logout.py +185 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_whoami.py +40 -1
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_dates.py +2 -2
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_env_list.py +4 -4
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_progress_file.py +3 -7
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_version_check.py +7 -7
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/utils.py +3 -0
- fastapi_cloud_cli-0.27.1/src/fastapi_cloud_cli/__init__.py +0 -1
- fastapi_cloud_cli-0.27.1/src/fastapi_cloud_cli/commands/logout.py +0 -32
- fastapi_cloud_cli-0.27.1/tests/test_auth.py +0 -112
- fastapi_cloud_cli-0.27.1/tests/test_cli_logout.py +0 -54
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/LICENSE +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/README.md +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/scripts/add_latest_release_date.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/scripts/format.sh +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/scripts/lint.sh +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/scripts/test-cov-html.sh +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/scripts/test.sh +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/__main__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/api/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/cli.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/create.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/get.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/unlink.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/apps/update.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/auth/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/auth/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/auth/wait.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/ci/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/ci/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/ci/print_workflow.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deploy/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deploy/archive.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deploy/cloud.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deploy/configure.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deploy/upload.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deploy/wait.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/deployments.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/_setup.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/_shared.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/add.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/get.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/remove.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/rendering.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/domains/restart.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/env/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/env/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/env/_shared.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/env/delete.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/env/get.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/env/list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/env/set.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/providers/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/providers/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/providers/list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/resources/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/resources/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/resources/connect.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/resources/disconnect.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/resources/get.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/resources/list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/integrations/resources/providers.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/teams/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/teams/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/teams/get.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/teams/list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/tokens/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/tokens/_app.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/tokens/create.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/tokens/delete.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/tokens/list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/whoami.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/config.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/logging.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/py.typed +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/apps.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/build_logs.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/cli.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/config.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/env.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/errors.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/execution.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/progress_file.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/sentry.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/teams.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/domains/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/domains/test_setup.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/providers/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/providers/test_list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/resources/__init__.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/resources/test_connect.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/resources/test_disconnect.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/resources/test_list.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_api_client.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_archive.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_ci.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_setup_ci.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_teams.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_tokens.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_cli_unlink.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_config.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_deploy_utils.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_env_delete.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_env_get.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_env_set.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_logs.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_prepare_release.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_sentry.py +0 -0
- {fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/test_utils_apps.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fastapi-cloud-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.28.1
|
|
4
4
|
Summary: Deploy and manage FastAPI Cloud apps from the command line 🚀
|
|
5
5
|
Author-Email: Patrick Arminio <patrick@fastapilabs.com>
|
|
6
6
|
License: MIT
|
|
@@ -19,16 +19,17 @@ Classifier: Framework :: FastAPI
|
|
|
19
19
|
Classifier: Intended Audience :: Developers
|
|
20
20
|
Classifier: License :: OSI Approved :: MIT License
|
|
21
21
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
26
27
|
Project-URL: Homepage, https://github.com/fastapilabs/fastapi-cloud-cli
|
|
27
28
|
Project-URL: Documentation, https://fastapi.tiangolo.com/fastapi-cloud-cli/
|
|
28
29
|
Project-URL: Repository, https://github.com/fastapilabs/fastapi-cloud-cli
|
|
29
30
|
Project-URL: Issues, https://github.com/fastapilabs/fastapi-cloud-cli/issues
|
|
30
31
|
Project-URL: Changelog, https://github.com/fastapilabs/fastapi-cloud-cli/blob/main/release-notes.md
|
|
31
|
-
Requires-Python: >=3.
|
|
32
|
+
Requires-Python: >=3.11
|
|
32
33
|
Requires-Dist: typer>=0.26.1
|
|
33
34
|
Requires-Dist: uvicorn[standard]>=0.17.6
|
|
34
35
|
Requires-Dist: rignore>=0.5.1
|
|
@@ -5,7 +5,7 @@ description = "Deploy and manage FastAPI Cloud apps from the command line 🚀"
|
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Patrick Arminio", email = "patrick@fastapilabs.com" },
|
|
7
7
|
]
|
|
8
|
-
requires-python = ">=3.
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
classifiers = [
|
|
11
11
|
"Intended Audience :: Information Technology",
|
|
@@ -23,10 +23,11 @@ classifiers = [
|
|
|
23
23
|
"Intended Audience :: Developers",
|
|
24
24
|
"License :: OSI Approved :: MIT License",
|
|
25
25
|
"Programming Language :: Python :: 3 :: Only",
|
|
26
|
-
"Programming Language :: Python :: 3.10",
|
|
27
26
|
"Programming Language :: Python :: 3.11",
|
|
28
27
|
"Programming Language :: Python :: 3.12",
|
|
29
28
|
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Programming Language :: Python :: 3.14",
|
|
30
|
+
"Programming Language :: Python :: 3.15",
|
|
30
31
|
]
|
|
31
32
|
dependencies = [
|
|
32
33
|
"typer >= 0.26.1",
|
|
@@ -42,7 +43,7 @@ dependencies = [
|
|
|
42
43
|
"detect-installer>=0.1.0",
|
|
43
44
|
"agent-detector>=1.1.0",
|
|
44
45
|
]
|
|
45
|
-
version = "0.
|
|
46
|
+
version = "0.28.1"
|
|
46
47
|
|
|
47
48
|
[project.license]
|
|
48
49
|
text = "MIT"
|
|
@@ -107,6 +108,7 @@ junit_family = "xunit2"
|
|
|
107
108
|
format-command = "ruff format --stdin-filename {filename}"
|
|
108
109
|
|
|
109
110
|
[tool.coverage.run]
|
|
111
|
+
core = "ctrace"
|
|
110
112
|
parallel = true
|
|
111
113
|
data_file = "coverage/.coverage"
|
|
112
114
|
source = [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
from datetime import date
|
|
5
|
-
from enum import
|
|
5
|
+
from enum import StrEnum
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import Annotated
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ RELEASE_NOTES_HEADER = "# Release Notes\n\n"
|
|
|
14
14
|
LATEST_CHANGES_HEADER = "## Latest Changes"
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class BumpType(
|
|
17
|
+
class BumpType(StrEnum):
|
|
18
18
|
major = "major"
|
|
19
19
|
minor = "minor"
|
|
20
20
|
patch = "patch"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.28.1"
|
|
@@ -27,7 +27,7 @@ def _handle_unauthorized(auth_mode: AuthMode) -> str:
|
|
|
27
27
|
if auth_mode == "user":
|
|
28
28
|
delete_auth_config()
|
|
29
29
|
|
|
30
|
-
message += "
|
|
30
|
+
message += "Run `fastapi cloud login` to generate a new token."
|
|
31
31
|
else:
|
|
32
32
|
message += "Make sure to use a valid token."
|
|
33
33
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from enum import
|
|
1
|
+
from enum import StrEnum
|
|
2
2
|
from typing import Annotated, Literal
|
|
3
3
|
|
|
4
4
|
from pydantic import BaseModel, Field, TypeAdapter
|
|
@@ -50,7 +50,7 @@ BuildLogAdapter: TypeAdapter[BuildLogLine] = TypeAdapter(
|
|
|
50
50
|
)
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
class CustomDomainStatus(
|
|
53
|
+
class CustomDomainStatus(StrEnum):
|
|
54
54
|
internal_dcv_pending = "internal_dcv_pending"
|
|
55
55
|
internal_dcv_missing = "internal_dcv_missing"
|
|
56
56
|
internal_dcv_invalid = "internal_dcv_invalid"
|
|
@@ -96,7 +96,7 @@ class CustomDomainsAPIResponse(BaseModel):
|
|
|
96
96
|
count: int
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
class DeploymentStatus(
|
|
99
|
+
class DeploymentStatus(StrEnum):
|
|
100
100
|
waiting_upload = "waiting_upload"
|
|
101
101
|
upload_cancelled = "upload_cancelled"
|
|
102
102
|
ready_for_build = "ready_for_build"
|
|
@@ -4,10 +4,9 @@ from collections.abc import Callable, Generator
|
|
|
4
4
|
from contextlib import contextmanager
|
|
5
5
|
from datetime import timedelta
|
|
6
6
|
from functools import wraps
|
|
7
|
-
from typing import TypeVar
|
|
7
|
+
from typing import ParamSpec, TypeVar
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
|
-
from typing_extensions import ParamSpec
|
|
11
10
|
|
|
12
11
|
from ._errors import StreamLogError, TooManyRetriesError
|
|
13
12
|
|
|
@@ -211,6 +211,14 @@ 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."""
|
|
216
|
+
# Short, so logging out doesn't hang when FastAPI Cloud is slow.
|
|
217
|
+
response = self.post("/logout", timeout=5)
|
|
218
|
+
# FastAPI Cloud without /logout can't revoke tokens, so there's nothing to do.
|
|
219
|
+
if response.status_code != 404:
|
|
220
|
+
response.raise_for_status()
|
|
221
|
+
|
|
214
222
|
@attempts(STREAM_LOGS_MAX_RETRIES, STREAM_LOGS_TIMEOUT)
|
|
215
223
|
def stream_build_logs(
|
|
216
224
|
self, deployment_id: str, *, follow: bool = True
|
{fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/_auth.py
RENAMED
|
@@ -30,7 +30,9 @@ class UserCommand(TyperCommand):
|
|
|
30
30
|
if not identity.is_logged_in():
|
|
31
31
|
toolkit.fail(
|
|
32
32
|
"not_logged_in",
|
|
33
|
-
"
|
|
33
|
+
"Your session has expired."
|
|
34
|
+
if identity.is_user_token_expired()
|
|
35
|
+
else "No credentials found.",
|
|
34
36
|
hint="Run `fastapi cloud login`.",
|
|
35
37
|
)
|
|
36
38
|
|
{fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/_flow.py
RENAMED
|
@@ -26,6 +26,7 @@ class AuthorizationData(BaseModel):
|
|
|
26
26
|
|
|
27
27
|
class TokenResponse(BaseModel):
|
|
28
28
|
access_token: str
|
|
29
|
+
expires_in: int | None = None
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
class LoginOutput(BaseModel):
|
|
@@ -85,7 +86,7 @@ def fetch_access_token(
|
|
|
85
86
|
device_code: str,
|
|
86
87
|
interval: int,
|
|
87
88
|
timeout: int = DEFAULT_LOGIN_TIMEOUT_SECONDS,
|
|
88
|
-
) ->
|
|
89
|
+
) -> TokenResponse:
|
|
89
90
|
settings = Settings.get()
|
|
90
91
|
start = time.monotonic()
|
|
91
92
|
|
|
@@ -130,7 +131,7 @@ def fetch_access_token(
|
|
|
130
131
|
response_data = TokenResponse.model_validate_json(response.text)
|
|
131
132
|
logger.debug("Access token received successfully.")
|
|
132
133
|
|
|
133
|
-
return response_data
|
|
134
|
+
return response_data
|
|
134
135
|
|
|
135
136
|
|
|
136
137
|
def complete_device_login(
|
|
@@ -145,7 +146,7 @@ def complete_device_login(
|
|
|
145
146
|
) -> LoginOutput:
|
|
146
147
|
try:
|
|
147
148
|
with client.handle_http_errors(progress, toolkit=toolkit):
|
|
148
|
-
|
|
149
|
+
token = fetch_access_token(client, device_code, interval, timeout)
|
|
149
150
|
except LoginDeniedError:
|
|
150
151
|
toolkit.fail(
|
|
151
152
|
"permission_denied",
|
|
@@ -167,6 +168,12 @@ def complete_device_login(
|
|
|
167
168
|
hint=cancel_hint,
|
|
168
169
|
)
|
|
169
170
|
|
|
170
|
-
|
|
171
|
+
expires_at = None
|
|
172
|
+
if token.expires_in is not None:
|
|
173
|
+
expires_at = int(time.time()) + token.expires_in
|
|
174
|
+
|
|
175
|
+
write_auth_config(
|
|
176
|
+
AuthConfig(access_token=token.access_token, expires_at=expires_at)
|
|
177
|
+
)
|
|
171
178
|
|
|
172
179
|
return LoginOutput(authenticated=True, auth_mode="user")
|
|
@@ -217,7 +217,9 @@ def deploy(
|
|
|
217
217
|
if json_output:
|
|
218
218
|
toolkit.fail(
|
|
219
219
|
"not_logged_in",
|
|
220
|
-
"
|
|
220
|
+
"Your session has expired."
|
|
221
|
+
if identity.is_user_token_expired()
|
|
222
|
+
else "No credentials found.",
|
|
221
223
|
hint="Run `fastapi cloud login` or set FASTAPI_CLOUD_TOKEN.",
|
|
222
224
|
)
|
|
223
225
|
|
|
@@ -229,7 +231,7 @@ def deploy(
|
|
|
229
231
|
)
|
|
230
232
|
toolkit.print_line()
|
|
231
233
|
|
|
232
|
-
if identity.
|
|
234
|
+
if identity.is_user_token_expired():
|
|
233
235
|
toolkit.print("Your session has expired. Please log in again.")
|
|
234
236
|
else:
|
|
235
237
|
toolkit.print("You need to be logged in to deploy to FastAPI Cloud.")
|
{fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/login.py
RENAMED
|
@@ -103,16 +103,6 @@ def login(
|
|
|
103
103
|
toolkit.print_title("Login to FastAPI Cloud", tag="FastAPI Cloud", emoji="🔐")
|
|
104
104
|
toolkit.print_line()
|
|
105
105
|
|
|
106
|
-
if identity.is_logged_in():
|
|
107
|
-
toolkit.print("You are already logged in.")
|
|
108
|
-
toolkit.print_line()
|
|
109
|
-
toolkit.print(
|
|
110
|
-
"Run [bold]fastapi cloud logout[/bold] first if you want to switch accounts.",
|
|
111
|
-
emoji="💡",
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
return
|
|
115
|
-
|
|
116
106
|
if identity.has_deploy_token():
|
|
117
107
|
toolkit.print(
|
|
118
108
|
"You have [bold blue]FASTAPI_CLOUD_TOKEN[/] environment variable set.\n"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Annotated, Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
from rich_toolkit import RichToolkit
|
|
7
|
+
|
|
8
|
+
from fastapi_cloud_cli._app import cloud_app
|
|
9
|
+
from fastapi_cloud_cli.api import APIClient
|
|
10
|
+
from fastapi_cloud_cli.utils.auth import Identity, delete_auth_config
|
|
11
|
+
from fastapi_cloud_cli.utils.cli import get_rich_toolkit
|
|
12
|
+
from fastapi_cloud_cli.utils.execution import JsonOutputOption
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class LogoutOutput(BaseModel):
|
|
18
|
+
logged_out: bool
|
|
19
|
+
revoke_failed: Annotated[bool, Field(exclude=True)] = False
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
REVOKE_FAILED_MESSAGE = (
|
|
23
|
+
"Couldn't sign out on FastAPI Cloud, so this login stays valid until it expires."
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _render_logout_output(data: LogoutOutput, toolkit: RichToolkit) -> None:
|
|
28
|
+
toolkit.print_title("FastAPI Cloud")
|
|
29
|
+
toolkit.print_line()
|
|
30
|
+
toolkit.print("You are now logged out!", emoji="👋")
|
|
31
|
+
|
|
32
|
+
if data.revoke_failed:
|
|
33
|
+
toolkit.print_line()
|
|
34
|
+
toolkit.print(REVOKE_FAILED_MESSAGE, emoji="⚠️")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@cloud_app.command()
|
|
38
|
+
def logout(json_output: JsonOutputOption = False) -> Any:
|
|
39
|
+
"""
|
|
40
|
+
Logout from FastAPI Cloud.
|
|
41
|
+
"""
|
|
42
|
+
with get_rich_toolkit(json_output=json_output) as toolkit:
|
|
43
|
+
revoke_failed = False
|
|
44
|
+
|
|
45
|
+
if Identity().user_token:
|
|
46
|
+
# Revoke the token on a best-effort basis: logging out must still
|
|
47
|
+
# work when FastAPI Cloud can't be reached.
|
|
48
|
+
try:
|
|
49
|
+
with APIClient() as client:
|
|
50
|
+
client.logout()
|
|
51
|
+
except httpx.HTTPError as e:
|
|
52
|
+
logger.debug("Could not revoke the token: %s", e)
|
|
53
|
+
revoke_failed = True
|
|
54
|
+
|
|
55
|
+
delete_auth_config()
|
|
56
|
+
|
|
57
|
+
warnings = []
|
|
58
|
+
if revoke_failed:
|
|
59
|
+
warnings.append(
|
|
60
|
+
{"code": "token_not_revoked", "message": REVOKE_FAILED_MESSAGE}
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
toolkit.success(
|
|
64
|
+
LogoutOutput(logged_out=True, revoke_failed=revoke_failed),
|
|
65
|
+
warnings=warnings,
|
|
66
|
+
render_output=_render_logout_output,
|
|
67
|
+
)
|
{fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/logs.py
RENAMED
|
@@ -84,7 +84,7 @@ def _get_log_bullet(log: AppLogEntry) -> str:
|
|
|
84
84
|
def _format_log_line(log: AppLogEntry) -> str:
|
|
85
85
|
"""Format a log entry for display"""
|
|
86
86
|
# Parse the timestamp string to format it consistently
|
|
87
|
-
timestamp = datetime.fromisoformat(log.timestamp
|
|
87
|
+
timestamp = datetime.fromisoformat(log.timestamp)
|
|
88
88
|
timestamp_str = timestamp.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z"
|
|
89
89
|
|
|
90
90
|
return f"[dim]{timestamp_str}[/dim] {escape(log.message)}"
|
{fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/commands/setup_ci.py
RENAMED
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
import re
|
|
3
3
|
import shutil
|
|
4
4
|
import subprocess
|
|
5
|
-
from datetime import
|
|
5
|
+
from datetime import UTC, datetime
|
|
6
6
|
from pathlib import Path, PurePath
|
|
7
7
|
from typing import Annotated, Any
|
|
8
8
|
|
|
@@ -418,7 +418,7 @@ def setup_ci(
|
|
|
418
418
|
|
|
419
419
|
if should_create_token:
|
|
420
420
|
# Create unique token name with timestamp to avoid duplicates
|
|
421
|
-
timestamp = datetime.now(
|
|
421
|
+
timestamp = datetime.now(UTC).strftime("%Y-%m-%d %H:%M UTC")
|
|
422
422
|
token_name = f"GitHub Actions — {repo_slug} ({timestamp})"
|
|
423
423
|
|
|
424
424
|
with (
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import base64
|
|
2
|
-
import binascii
|
|
3
|
-
import json
|
|
4
1
|
import logging
|
|
5
2
|
import os
|
|
6
3
|
import time
|
|
@@ -17,6 +14,8 @@ AuthMode = Literal["token", "user"]
|
|
|
17
14
|
|
|
18
15
|
class AuthConfig(BaseModel):
|
|
19
16
|
access_token: str
|
|
17
|
+
# Unix time when FastAPI Cloud expires the token. Older logins didn't save it.
|
|
18
|
+
expires_at: int | None = None
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
def write_auth_config(auth_data: AuthConfig) -> None:
|
|
@@ -50,69 +49,11 @@ def read_auth_config() -> AuthConfig | None:
|
|
|
50
49
|
return AuthConfig.model_validate_json(auth_path.read_text(encoding="utf-8"))
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
def _get_auth_token() -> str | None:
|
|
54
|
-
logger.debug("Getting auth token")
|
|
55
|
-
auth_data = read_auth_config()
|
|
56
|
-
|
|
57
|
-
if auth_data is None:
|
|
58
|
-
logger.debug("No auth data found")
|
|
59
|
-
return None
|
|
60
|
-
|
|
61
|
-
logger.debug("Auth token retrieved successfully")
|
|
62
|
-
return auth_data.access_token
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def _is_jwt_expired(token: str) -> bool:
|
|
66
|
-
try:
|
|
67
|
-
parts = token.split(".")
|
|
68
|
-
|
|
69
|
-
if len(parts) != 3:
|
|
70
|
-
logger.debug("Invalid JWT format: expected 3 parts, got %d", len(parts))
|
|
71
|
-
return True
|
|
72
|
-
|
|
73
|
-
payload = parts[1]
|
|
74
|
-
|
|
75
|
-
# Add padding if needed (JWT uses base64url encoding without padding)
|
|
76
|
-
if padding := len(payload) % 4:
|
|
77
|
-
payload += "=" * (4 - padding)
|
|
78
|
-
|
|
79
|
-
payload = payload.replace("-", "+").replace("_", "/")
|
|
80
|
-
decoded_bytes = base64.b64decode(payload)
|
|
81
|
-
payload_data = json.loads(decoded_bytes)
|
|
82
|
-
|
|
83
|
-
exp = payload_data.get("exp")
|
|
84
|
-
|
|
85
|
-
if exp is None:
|
|
86
|
-
logger.debug("No 'exp' claim found in token")
|
|
87
|
-
|
|
88
|
-
return False
|
|
89
|
-
|
|
90
|
-
if not isinstance(exp, int): # pragma: no cover
|
|
91
|
-
logger.debug("Invalid 'exp' claim: expected int, got %s", type(exp))
|
|
92
|
-
|
|
93
|
-
return True
|
|
94
|
-
|
|
95
|
-
current_time = time.time()
|
|
96
|
-
|
|
97
|
-
is_expired = current_time >= exp
|
|
98
|
-
|
|
99
|
-
logger.debug(
|
|
100
|
-
"Token expiration check: current=%d, exp=%d, expired=%s",
|
|
101
|
-
current_time,
|
|
102
|
-
exp,
|
|
103
|
-
is_expired,
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
return is_expired
|
|
107
|
-
except (binascii.Error, json.JSONDecodeError) as e:
|
|
108
|
-
logger.debug("Error parsing JWT token: %s", e)
|
|
109
|
-
|
|
110
|
-
return True
|
|
111
|
-
|
|
112
|
-
|
|
113
52
|
class Identity:
|
|
114
53
|
def __init__(self) -> None:
|
|
115
|
-
|
|
54
|
+
auth_config = read_auth_config()
|
|
55
|
+
self._user_token = auth_config.access_token if auth_config else None
|
|
56
|
+
self._user_token_expires_at = auth_config.expires_at if auth_config else None
|
|
116
57
|
self._deploy_token: str | None = os.environ.get("FASTAPI_CLOUD_TOKEN")
|
|
117
58
|
|
|
118
59
|
@property
|
|
@@ -124,13 +65,14 @@ class Identity:
|
|
|
124
65
|
return self._deploy_token
|
|
125
66
|
|
|
126
67
|
def is_user_token_expired(self) -> bool:
|
|
127
|
-
|
|
128
|
-
|
|
68
|
+
# Without a saved expiry, only FastAPI Cloud can tell, with a 401.
|
|
69
|
+
if self._user_token_expires_at is None:
|
|
70
|
+
return False
|
|
129
71
|
|
|
130
|
-
return
|
|
72
|
+
return time.time() >= self._user_token_expires_at
|
|
131
73
|
|
|
132
74
|
def is_logged_in(self) -> bool:
|
|
133
|
-
if self._user_token
|
|
75
|
+
if not self._user_token:
|
|
134
76
|
logger.debug("Login status: False (no token)")
|
|
135
77
|
return False
|
|
136
78
|
|
|
@@ -138,6 +80,7 @@ class Identity:
|
|
|
138
80
|
logger.debug("Login status: False (token expired)")
|
|
139
81
|
return False
|
|
140
82
|
|
|
83
|
+
# A revoked token still gets a 401, which deletes the stored token.
|
|
141
84
|
logger.debug("Login status: True")
|
|
142
85
|
return True
|
|
143
86
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from datetime import
|
|
1
|
+
from datetime import UTC, datetime
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def format_last_updated(updated_at: str | None) -> str:
|
|
@@ -6,14 +6,14 @@ def format_last_updated(updated_at: str | None) -> str:
|
|
|
6
6
|
return "-"
|
|
7
7
|
|
|
8
8
|
try:
|
|
9
|
-
updated = datetime.fromisoformat(updated_at
|
|
9
|
+
updated = datetime.fromisoformat(updated_at)
|
|
10
10
|
except ValueError:
|
|
11
11
|
return updated_at
|
|
12
12
|
|
|
13
13
|
if updated.tzinfo is None:
|
|
14
|
-
updated = updated.replace(tzinfo=
|
|
14
|
+
updated = updated.replace(tzinfo=UTC)
|
|
15
15
|
|
|
16
|
-
now = datetime.now(
|
|
16
|
+
now = datetime.now(UTC)
|
|
17
17
|
seconds = int((now - updated).total_seconds())
|
|
18
18
|
|
|
19
19
|
if seconds < 60:
|
{fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/src/fastapi_cloud_cli/utils/version_check.py
RENAMED
|
@@ -4,7 +4,7 @@ import re
|
|
|
4
4
|
import threading
|
|
5
5
|
from contextlib import suppress
|
|
6
6
|
from dataclasses import dataclass
|
|
7
|
-
from datetime import datetime, timedelta
|
|
7
|
+
from datetime import UTC, datetime, timedelta
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
10
|
import httpx
|
|
@@ -68,7 +68,7 @@ def read_cached_latest_version(
|
|
|
68
68
|
*,
|
|
69
69
|
ttl: timedelta = VERSION_CHECK_CACHE_TTL,
|
|
70
70
|
) -> str | None:
|
|
71
|
-
now = datetime.now(
|
|
71
|
+
now = datetime.now(UTC)
|
|
72
72
|
|
|
73
73
|
try:
|
|
74
74
|
cache = VersionCheckCache.model_validate_json(
|
|
@@ -93,7 +93,7 @@ def write_latest_version_cache(
|
|
|
93
93
|
latest_version: str,
|
|
94
94
|
now: datetime | None = None,
|
|
95
95
|
) -> None:
|
|
96
|
-
now = now or datetime.now(
|
|
96
|
+
now = now or datetime.now(UTC)
|
|
97
97
|
data = {
|
|
98
98
|
"latest_version": latest_version,
|
|
99
99
|
"checked_at": now.isoformat(),
|
|
@@ -11,7 +11,7 @@ from typer import rich_utils
|
|
|
11
11
|
|
|
12
12
|
from fastapi_cloud_cli.config import Settings
|
|
13
13
|
|
|
14
|
-
from .utils import
|
|
14
|
+
from .utils import USER_TOKEN
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
@pytest.fixture(autouse=True)
|
|
@@ -67,9 +67,14 @@ def respx_mock(settings: Settings) -> Generator[respx.MockRouter, None, None]:
|
|
|
67
67
|
|
|
68
68
|
@pytest.fixture
|
|
69
69
|
def logged_in_cli(temp_auth_config: Path) -> Generator[None, None, None]:
|
|
70
|
-
|
|
70
|
+
temp_auth_config.write_text(f'{{"access_token": "{USER_TOKEN}"}}')
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
yield
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@pytest.fixture
|
|
76
|
+
def logged_in_with_expired_token(temp_auth_config: Path) -> Generator[None, None, None]:
|
|
77
|
+
temp_auth_config.write_text(f'{{"access_token": "{USER_TOKEN}", "expires_at": 0}}')
|
|
73
78
|
|
|
74
79
|
yield
|
|
75
80
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from datetime import
|
|
2
|
+
from datetime import UTC, datetime
|
|
3
3
|
from typing import Any
|
|
4
4
|
from unittest.mock import patch
|
|
5
5
|
|
|
@@ -90,7 +90,7 @@ def test_domains_list_requires_app_context(logged_in_cli: None) -> None:
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
@pytest.mark.respx
|
|
93
|
-
@time_machine.travel(datetime(2026, 9, 1, 10, 1, tzinfo=
|
|
93
|
+
@time_machine.travel(datetime(2026, 9, 1, 10, 1, tzinfo=UTC), tick=False)
|
|
94
94
|
def test_domains_list_uses_linked_app_and_renders_rows(
|
|
95
95
|
logged_in_cli: None,
|
|
96
96
|
respx_mock: respx.MockRouter,
|
|
@@ -341,7 +341,7 @@ def test_domains_get_resolves_normalized_hostname_or_id_as_json(
|
|
|
341
341
|
|
|
342
342
|
|
|
343
343
|
@pytest.mark.respx
|
|
344
|
-
@time_machine.travel(datetime(2026, 9, 1, 10, 1, tzinfo=
|
|
344
|
+
@time_machine.travel(datetime(2026, 9, 1, 10, 1, tzinfo=UTC), tick=False)
|
|
345
345
|
def test_domains_get_prompts_with_selector_and_renders_details(
|
|
346
346
|
logged_in_cli: None,
|
|
347
347
|
respx_mock: respx.MockRouter,
|
|
@@ -480,7 +480,7 @@ def test_domains_get_gates_zero_downtime_records_by_phase(
|
|
|
480
480
|
|
|
481
481
|
|
|
482
482
|
@pytest.mark.respx
|
|
483
|
-
@time_machine.travel(datetime(2026, 9, 1, 10, 1, tzinfo=
|
|
483
|
+
@time_machine.travel(datetime(2026, 9, 1, 10, 1, tzinfo=UTC), tick=False)
|
|
484
484
|
def test_domains_get_shows_url_and_no_action_when_live(
|
|
485
485
|
logged_in_cli: None,
|
|
486
486
|
respx_mock: respx.MockRouter,
|
{fastapi_cloud_cli-0.27.1 → fastapi_cloud_cli-0.28.1}/tests/integrations/resources/test_get.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from datetime import
|
|
2
|
+
from datetime import UTC, datetime
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import Literal
|
|
5
5
|
|
|
@@ -216,7 +216,7 @@ def test_gets_resource_json_requires_app_without_linked_app(
|
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
@pytest.mark.respx
|
|
219
|
-
@time_machine.travel(datetime(2026, 9, 1, 10, tzinfo=
|
|
219
|
+
@time_machine.travel(datetime(2026, 9, 1, 10, tzinfo=UTC), tick=False)
|
|
220
220
|
def test_gets_database_resource_in_human_output(
|
|
221
221
|
logged_in_cli: None,
|
|
222
222
|
respx_mock: respx.MockRouter,
|
|
@@ -248,7 +248,7 @@ connected resource
|
|
|
248
248
|
|
|
249
249
|
|
|
250
250
|
@pytest.mark.respx
|
|
251
|
-
@time_machine.travel(datetime(2026, 9, 1, 10, tzinfo=
|
|
251
|
+
@time_machine.travel(datetime(2026, 9, 1, 10, tzinfo=UTC), tick=False)
|
|
252
252
|
def test_gets_logfire_resource_in_human_output_without_environment_variables(
|
|
253
253
|
logged_in_cli: None,
|
|
254
254
|
respx_mock: respx.MockRouter,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from fastapi_cloud_cli.utils.auth import AuthConfig, Identity, write_auth_config
|
|
5
|
+
|
|
6
|
+
from .utils import USER_TOKEN, create_jwt_token
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_is_logged_in_with_no_token(temp_auth_config: Path) -> None:
|
|
10
|
+
assert not temp_auth_config.exists()
|
|
11
|
+
assert not Identity().is_logged_in()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_is_logged_in_with_token(temp_auth_config: Path) -> None:
|
|
15
|
+
write_auth_config(AuthConfig(access_token=USER_TOKEN))
|
|
16
|
+
|
|
17
|
+
assert Identity().is_logged_in()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_is_logged_in_before_token_expires(temp_auth_config: Path) -> None:
|
|
21
|
+
write_auth_config(
|
|
22
|
+
AuthConfig(access_token=USER_TOKEN, expires_at=int(time.time()) + 3600)
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
identity = Identity()
|
|
26
|
+
|
|
27
|
+
assert identity.is_logged_in()
|
|
28
|
+
assert not identity.is_user_token_expired()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_is_logged_in_with_expired_token(temp_auth_config: Path) -> None:
|
|
32
|
+
write_auth_config(
|
|
33
|
+
AuthConfig(access_token=USER_TOKEN, expires_at=int(time.time()) - 3600)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
identity = Identity()
|
|
37
|
+
|
|
38
|
+
assert not identity.is_logged_in()
|
|
39
|
+
assert identity.is_user_token_expired()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_token_without_saved_expiry_is_left_to_the_server(
|
|
43
|
+
temp_auth_config: Path,
|
|
44
|
+
) -> None:
|
|
45
|
+
past_exp = int(time.time()) - 3600
|
|
46
|
+
token = create_jwt_token({"exp": past_exp, "sub": "test_user"})
|
|
47
|
+
|
|
48
|
+
write_auth_config(AuthConfig(access_token=token))
|
|
49
|
+
|
|
50
|
+
identity = Identity()
|
|
51
|
+
|
|
52
|
+
assert identity.is_logged_in()
|
|
53
|
+
assert not identity.is_user_token_expired()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_is_logged_in_with_empty_token(temp_auth_config: Path) -> None:
|
|
57
|
+
write_auth_config(AuthConfig(access_token=""))
|
|
58
|
+
|
|
59
|
+
assert not Identity().is_logged_in()
|