fastapi-cli 0.0.3__py3-none-any.whl → 0.0.5__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_cli/__init__.py +1 -1
- fastapi_cli/cli.py +9 -1
- fastapi_cli/discover.py +23 -19
- {fastapi_cli-0.0.3.dist-info → fastapi_cli-0.0.5.dist-info}/METADATA +14 -14
- fastapi_cli-0.0.5.dist-info/RECORD +12 -0
- {fastapi_cli-0.0.3.dist-info → fastapi_cli-0.0.5.dist-info}/WHEEL +1 -1
- fastapi_cli-0.0.3.dist-info/RECORD +0 -12
- {fastapi_cli-0.0.3.dist-info → fastapi_cli-0.0.5.dist-info}/entry_points.txt +0 -0
- {fastapi_cli-0.0.3.dist-info → fastapi_cli-0.0.5.dist-info}/licenses/LICENSE +0 -0
fastapi_cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.5"
|
fastapi_cli/cli.py
CHANGED
|
@@ -3,7 +3,6 @@ from pathlib import Path
|
|
|
3
3
|
from typing import Any, Union
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
import uvicorn
|
|
7
6
|
from rich import print
|
|
8
7
|
from rich.padding import Padding
|
|
9
8
|
from rich.panel import Panel
|
|
@@ -20,6 +19,11 @@ app = typer.Typer(rich_markup_mode="rich")
|
|
|
20
19
|
setup_logging()
|
|
21
20
|
logger = getLogger(__name__)
|
|
22
21
|
|
|
22
|
+
try:
|
|
23
|
+
import uvicorn
|
|
24
|
+
except ImportError: # pragma: no cover
|
|
25
|
+
uvicorn = None # type: ignore[assignment]
|
|
26
|
+
|
|
23
27
|
|
|
24
28
|
def version_callback(value: bool) -> None:
|
|
25
29
|
if value:
|
|
@@ -81,6 +85,10 @@ def _run(
|
|
|
81
85
|
style="green",
|
|
82
86
|
)
|
|
83
87
|
print(Padding(panel, 1))
|
|
88
|
+
if not uvicorn:
|
|
89
|
+
raise FastAPICLIException(
|
|
90
|
+
"Could not import Uvicorn, try running 'pip install uvicorn'"
|
|
91
|
+
) from None
|
|
84
92
|
uvicorn.run(
|
|
85
93
|
app=use_uvicorn_app,
|
|
86
94
|
host=host,
|
fastapi_cli/discover.py
CHANGED
|
@@ -5,7 +5,6 @@ from logging import getLogger
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from typing import Union
|
|
7
7
|
|
|
8
|
-
from fastapi import FastAPI
|
|
9
8
|
from rich import print
|
|
10
9
|
from rich.padding import Padding
|
|
11
10
|
from rich.panel import Panel
|
|
@@ -16,26 +15,27 @@ from fastapi_cli.exceptions import FastAPICLIException
|
|
|
16
15
|
|
|
17
16
|
logger = getLogger(__name__)
|
|
18
17
|
|
|
18
|
+
try:
|
|
19
|
+
from fastapi import FastAPI
|
|
20
|
+
except ImportError: # pragma: no cover
|
|
21
|
+
FastAPI = None # type: ignore[misc, assignment]
|
|
22
|
+
|
|
19
23
|
|
|
20
24
|
def get_default_path() -> Path:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return path
|
|
36
|
-
path = Path("app/api.py")
|
|
37
|
-
if path.is_file():
|
|
38
|
-
return path
|
|
25
|
+
potential_paths = (
|
|
26
|
+
"main.py",
|
|
27
|
+
"app.py",
|
|
28
|
+
"api.py",
|
|
29
|
+
"app/main.py",
|
|
30
|
+
"app/app.py",
|
|
31
|
+
"app/api.py",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
for full_path in potential_paths:
|
|
35
|
+
path = Path(full_path)
|
|
36
|
+
if path.is_file():
|
|
37
|
+
return path
|
|
38
|
+
|
|
39
39
|
raise FastAPICLIException(
|
|
40
40
|
"Could not find a default file to run, please provide an explicit path"
|
|
41
41
|
)
|
|
@@ -107,6 +107,10 @@ def get_app_name(*, mod_data: ModuleData, app_name: Union[str, None] = None) ->
|
|
|
107
107
|
"Ensure all the package directories have an [blue]__init__.py[/blue] file"
|
|
108
108
|
)
|
|
109
109
|
raise
|
|
110
|
+
if not FastAPI: # type: ignore[truthy-function]
|
|
111
|
+
raise FastAPICLIException(
|
|
112
|
+
"Could not import FastAPI, try running 'pip install fastapi'"
|
|
113
|
+
) from None
|
|
110
114
|
object_names = dir(mod)
|
|
111
115
|
object_names_set = set(object_names)
|
|
112
116
|
if app_name:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fastapi-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
|
|
5
|
-
Home-page: https://github.com/
|
|
5
|
+
Home-page: https://github.com/fastapi/fastapi-cli
|
|
6
6
|
Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
|
|
7
7
|
License: MIT
|
|
8
8
|
Classifier: Intended Audience :: Information Technology
|
|
@@ -20,7 +20,6 @@ Classifier: Framework :: FastAPI
|
|
|
20
20
|
Classifier: Intended Audience :: Developers
|
|
21
21
|
Classifier: License :: OSI Approved :: MIT License
|
|
22
22
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.8
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.9
|
|
26
25
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -28,31 +27,32 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
28
27
|
Classifier: Programming Language :: Python :: 3.12
|
|
29
28
|
Classifier: License :: OSI Approved :: MIT License
|
|
30
29
|
Project-URL: Documentation, https://fastapi.tiangolo.com
|
|
31
|
-
Project-URL: Homepage, https://github.com/
|
|
32
|
-
Project-URL: Repository, https://github.com/
|
|
30
|
+
Project-URL: Homepage, https://github.com/fastapi/fastapi-cli
|
|
31
|
+
Project-URL: Repository, https://github.com/fastapi/fastapi-cli
|
|
33
32
|
Requires-Python: >=3.8
|
|
34
33
|
Requires-Dist: typer>=0.12.3
|
|
35
|
-
Requires-Dist: fastapi
|
|
36
34
|
Requires-Dist: uvicorn[standard]>=0.15.0
|
|
35
|
+
Requires-Dist: uvicorn[standard]>=0.15.0; extra == "standard"
|
|
36
|
+
Provides-Extra: standard
|
|
37
37
|
Description-Content-Type: text/markdown
|
|
38
38
|
|
|
39
39
|
# FastAPI CLI
|
|
40
40
|
|
|
41
|
-
<a href="https://github.com/
|
|
42
|
-
<img src="https://github.com/
|
|
41
|
+
<a href="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml" target="_blank">
|
|
42
|
+
<img src="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml/badge.svg" alt="Test">
|
|
43
43
|
</a>
|
|
44
|
-
<a href="https://github.com/
|
|
45
|
-
<img src="https://github.com/
|
|
44
|
+
<a href="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml" target="_blank">
|
|
45
|
+
<img src="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml/badge.svg" alt="Publish">
|
|
46
46
|
</a>
|
|
47
|
-
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/
|
|
48
|
-
<img src="https://coverage-badge.samuelcolvin.workers.dev/
|
|
47
|
+
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi-cli" target="_blank">
|
|
48
|
+
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi-cli.svg" alt="Coverage">
|
|
49
49
|
<a href="https://pypi.org/project/fastapi-cli" target="_blank">
|
|
50
50
|
<img src="https://img.shields.io/pypi/v/fastapi-cli?color=%2334D058&label=pypi%20package" alt="Package version">
|
|
51
51
|
</a>
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
55
|
-
**Source Code**: <a href="https://github.com/
|
|
55
|
+
**Source Code**: <a href="https://github.com/fastapi/fastapi-cli" target="_blank">https://github.com/fastapi/fastapi-cli</a>
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
@@ -62,7 +62,7 @@ Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
|
|
|
62
62
|
|
|
63
63
|
**FastAPI CLI** is a command line program `fastapi` that you can use to serve your FastAPI app, manage your FastAPI project, and more.
|
|
64
64
|
|
|
65
|
-
When you install FastAPI (e.g. with `pip install fastapi`), it includes a package called `fastapi-cli`, this package provides the `fastapi` command in the terminal.
|
|
65
|
+
When you install FastAPI (e.g. with `pip install "fastapi[standard]"`), it includes a package called `fastapi-cli`, this package provides the `fastapi` command in the terminal.
|
|
66
66
|
|
|
67
67
|
To run your FastAPI app for development, you can use the `fastapi dev` command:
|
|
68
68
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
fastapi_cli-0.0.5.dist-info/METADATA,sha256=faB4x1HRZohNWY5TRzUY3TWcln8wnFs9nLWnPY3UgQs,6970
|
|
2
|
+
fastapi_cli-0.0.5.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
|
|
3
|
+
fastapi_cli-0.0.5.dist-info/entry_points.txt,sha256=RLUGtkrAf9gNKxCS3EeJNYN8AF1Er364vjW7bnEcCA8,50
|
|
4
|
+
fastapi_cli-0.0.5.dist-info/licenses/LICENSE,sha256=FqD5B4VbXJnefprQseE0U8llL6FxojC-i8muZy7YmSU,1086
|
|
5
|
+
fastapi_cli/__init__.py,sha256=S7u1lbuWmM3A3ajykBialmPoJUK6Jg-WmNqM-9OZFdk,22
|
|
6
|
+
fastapi_cli/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
|
7
|
+
fastapi_cli/cli.py,sha256=o7dRxEfZ_lBO72b6RZEAa_wKua2pkK5kp6Rr5PhZML4,9278
|
|
8
|
+
fastapi_cli/discover.py,sha256=nAhYW4bbeM7uOyWLEy4f0BilJNnY1fxk9q17c_973WM,5416
|
|
9
|
+
fastapi_cli/exceptions.py,sha256=AHRSqd43fbqN5IpX-Fq389k9MoEK_q28wVFL7oqPNcc,47
|
|
10
|
+
fastapi_cli/logging.py,sha256=lI7rIsioTJQsxDuWpG5YR_brWpIAUY4vDnhYm5p91ws,664
|
|
11
|
+
fastapi_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
fastapi_cli-0.0.5.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
fastapi_cli-0.0.3.dist-info/METADATA,sha256=Y-hqiy0ZfFTGeTamhue94ks6dDVYJoBXjECqKwuccxw,6955
|
|
2
|
-
fastapi_cli-0.0.3.dist-info/WHEEL,sha256=vnE8JVcI2Wz7GRKorsPArnBdnW2SWKWGow5gu5tHlRU,90
|
|
3
|
-
fastapi_cli-0.0.3.dist-info/entry_points.txt,sha256=RLUGtkrAf9gNKxCS3EeJNYN8AF1Er364vjW7bnEcCA8,50
|
|
4
|
-
fastapi_cli-0.0.3.dist-info/licenses/LICENSE,sha256=FqD5B4VbXJnefprQseE0U8llL6FxojC-i8muZy7YmSU,1086
|
|
5
|
-
fastapi_cli/__init__.py,sha256=4GZKi13lDTD25YBkGakhZyEQZWTER_OWQMNPoH_UM2c,22
|
|
6
|
-
fastapi_cli/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
|
7
|
-
fastapi_cli/cli.py,sha256=SA-0m7F4uI-etRHDZwFfN_C8nYEfsetFYZf4vCNs82c,9032
|
|
8
|
-
fastapi_cli/discover.py,sha256=5QbjDHEbfNUQoYG7ZXRfYWvSJkj74ojkFtzUftPb2VE,5285
|
|
9
|
-
fastapi_cli/exceptions.py,sha256=AHRSqd43fbqN5IpX-Fq389k9MoEK_q28wVFL7oqPNcc,47
|
|
10
|
-
fastapi_cli/logging.py,sha256=lI7rIsioTJQsxDuWpG5YR_brWpIAUY4vDnhYm5p91ws,664
|
|
11
|
-
fastapi_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
fastapi_cli-0.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|