File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 44
44
run : |
45
45
cd dist/fastapi_cli*/
46
46
pip install -r requirements-tests.txt
47
+ env :
48
+ TIANGOLO_BUILD_PACKAGE : ${{ matrix.package }}
47
49
- name : Run source distribution tests
48
50
run : |
49
51
cd dist/fastapi_cli*/
Original file line number Diff line number Diff line change @@ -4,3 +4,6 @@ pytest >=4.4.0,<8.0.0
4
4
coverage[toml] >=6.2,<8.0
5
5
mypy ==1.4.1
6
6
ruff ==0.2.0
7
+ # Needed explicitly by fastapi-cli-slim
8
+ fastapi-slim
9
+ uvicorn
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ def _run(
51
51
host : str = "127.0.0.1" ,
52
52
port : int = 8000 ,
53
53
reload : bool = True ,
54
+ workers : Union [int , None ] = None ,
54
55
root_path : str = "" ,
55
56
command : str ,
56
57
app : Union [str , None ] = None ,
@@ -85,6 +86,7 @@ def _run(
85
86
host = host ,
86
87
port = port ,
87
88
reload = reload ,
89
+ workers = workers ,
88
90
root_path = root_path ,
89
91
proxy_headers = proxy_headers ,
90
92
)
@@ -200,6 +202,12 @@ def run(
200
202
help = "Enable auto-reload of the server when (code) files change. This is [bold]resource intensive[/bold], use it only during development."
201
203
),
202
204
] = False ,
205
+ workers : Annotated [
206
+ Union [int , None ],
207
+ typer .Option (
208
+ help = "Use multiple worker processes. Mutually exclusive with the --reload flag."
209
+ ),
210
+ ] = None ,
203
211
root_path : Annotated [
204
212
str ,
205
213
typer .Option (
@@ -249,6 +257,7 @@ def run(
249
257
host = host ,
250
258
port = port ,
251
259
reload = reload ,
260
+ workers = workers ,
252
261
root_path = root_path ,
253
262
app = app ,
254
263
command = "run" ,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ def test_dev() -> None:
26
26
"host" : "127.0.0.1" ,
27
27
"port" : 8000 ,
28
28
"reload" : True ,
29
+ "workers" : None ,
29
30
"root_path" : "" ,
30
31
"proxy_headers" : True ,
31
32
}
@@ -67,6 +68,7 @@ def test_dev_args() -> None:
67
68
"host" : "192.168.0.2" ,
68
69
"port" : 8080 ,
69
70
"reload" : False ,
71
+ "workers" : None ,
70
72
"root_path" : "/api" ,
71
73
"proxy_headers" : False ,
72
74
}
@@ -92,6 +94,7 @@ def test_run() -> None:
92
94
"host" : "0.0.0.0" ,
93
95
"port" : 8000 ,
94
96
"reload" : False ,
97
+ "workers" : None ,
95
98
"root_path" : "" ,
96
99
"proxy_headers" : True ,
97
100
}
@@ -118,6 +121,8 @@ def test_run_args() -> None:
118
121
"--port" ,
119
122
"8080" ,
120
123
"--no-reload" ,
124
+ "--workers" ,
125
+ "2" ,
121
126
"--root-path" ,
122
127
"/api" ,
123
128
"--app" ,
@@ -133,6 +138,7 @@ def test_run_args() -> None:
133
138
"host" : "192.168.0.2" ,
134
139
"port" : 8080 ,
135
140
"reload" : False ,
141
+ "workers" : 2 ,
136
142
"root_path" : "/api" ,
137
143
"proxy_headers" : False ,
138
144
}
@@ -171,6 +177,7 @@ def test_dev_help() -> None:
171
177
assert "Enable auto-reload of the server when (code) files change." in result .output
172
178
assert "The root path is used to tell your app" in result .output
173
179
assert "The name of the variable that contains the FastAPI app" in result .output
180
+ assert "Use multiple worker processes." not in result .output
174
181
175
182
176
183
def test_run_help () -> None :
@@ -191,6 +198,7 @@ def test_run_help() -> None:
191
198
assert "Enable auto-reload of the server when (code) files change." in result .output
192
199
assert "The root path is used to tell your app" in result .output
193
200
assert "The name of the variable that contains the FastAPI app" in result .output
201
+ assert "Use multiple worker processes." in result .output
194
202
195
203
196
204
def test_callback_help () -> None :
You can’t perform that action at this time.
0 commit comments