8
8
9
9
import click
10
10
import tomllib
11
- from honcho .manager import Manager as HonchoManager
12
11
13
12
from plain .runtime import APP_PATH , settings
14
13
15
14
from .db import cli as db_cli
16
15
from .mkcert import MkcertManager
17
16
from .pid import Pid
17
+ from .poncho .manager import Manager as PonchoManager
18
18
from .services import Services
19
19
from .utils import has_pyproject_toml , plainpackage_installed
20
20
@@ -48,7 +48,7 @@ def services():
48
48
49
49
class Dev :
50
50
def __init__ (self , * , port ):
51
- self .manager = HonchoManager ()
51
+ self .poncho = PonchoManager ()
52
52
self .port = port
53
53
self .plain_env = {
54
54
** os .environ ,
@@ -76,9 +76,11 @@ def run(self):
76
76
storage_path = Path (settings .PLAIN_TEMP_PATH ) / "dev" / "certs" ,
77
77
)
78
78
self .modify_hosts_file ()
79
- self .add_csrf_trusted_origins ()
80
- self .add_allowed_hosts ()
79
+ self .set_csrf_trusted_origins ()
80
+ self .set_allowed_hosts ()
81
81
self .run_preflight ()
82
+
83
+ # Processes for poncho to run simultaneously
82
84
self .add_gunicorn ()
83
85
self .add_tailwind ()
84
86
self .add_pyproject_run ()
@@ -91,9 +93,9 @@ def run(self):
91
93
bold = True ,
92
94
)
93
95
94
- self .manager .loop ()
96
+ self .poncho .loop ()
95
97
96
- return self .manager .returncode
98
+ return self .poncho .returncode
97
99
finally :
98
100
pid .rm ()
99
101
@@ -152,7 +154,7 @@ def modify_hosts_file(self):
152
154
)
153
155
sys .exit (1 )
154
156
155
- def add_csrf_trusted_origins (self ):
157
+ def set_csrf_trusted_origins (self ):
156
158
csrf_trusted_origins = json .dumps (
157
159
[
158
160
f"https://{ self .domain } :{ self .port } " ,
@@ -168,7 +170,7 @@ def add_csrf_trusted_origins(self):
168
170
self .plain_env ["PLAIN_CSRF_TRUSTED_ORIGINS" ] = csrf_trusted_origins
169
171
self .custom_process_env ["PLAIN_CSRF_TRUSTED_ORIGINS" ] = csrf_trusted_origins
170
172
171
- def add_allowed_hosts (self ):
173
+ def set_allowed_hosts (self ):
172
174
allowed_hosts = json .dumps ([self .domain ])
173
175
174
176
click .secho (
@@ -226,13 +228,13 @@ def add_gunicorn(self):
226
228
# Default to two workers to prevent lockups
227
229
self .plain_env ["WEB_CONCURRENCY" ] = "2"
228
230
229
- self .manager .add_process ("plain" , runserver_cmd , env = self .plain_env )
231
+ self .poncho .add_process ("plain" , runserver_cmd , env = self .plain_env )
230
232
231
233
def add_tailwind (self ):
232
234
if not plainpackage_installed ("tailwind" ):
233
235
return
234
236
235
- self .manager .add_process ("tailwind" , "plain tailwind compile --watch" )
237
+ self .poncho .add_process ("tailwind" , "plain tailwind compile --watch" )
236
238
237
239
def add_pyproject_run (self ):
238
240
if not has_pyproject_toml (APP_PATH .parent ):
@@ -249,7 +251,7 @@ def add_pyproject_run(self):
249
251
** self .custom_process_env ,
250
252
** data .get ("env" , {}),
251
253
}
252
- self .manager .add_process (name , data ["cmd" ], env = env )
254
+ self .poncho .add_process (name , data ["cmd" ], env = env )
253
255
254
256
def add_services (self ):
255
257
services = Services .get_services (APP_PATH .parent )
@@ -259,7 +261,7 @@ def add_services(self):
259
261
"PYTHONUNBUFFERED" : "true" ,
260
262
** data .get ("env" , {}),
261
263
}
262
- self .manager .add_process (name , data ["cmd" ], env = env )
264
+ self .poncho .add_process (name , data ["cmd" ], env = env )
263
265
264
266
265
267
cli .add_command (db_cli )
0 commit comments