plain.dev 0.29.1__py3-none-any.whl → 0.30.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.
- plain/dev/cli.py +13 -23
- plain/dev/gunicorn_logging.json +35 -41
- plain/dev/requests.py +2 -2
- plain/dev/services.py +2 -2
- {plain_dev-0.29.1.dist-info → plain_dev-0.30.0.dist-info}/METADATA +1 -1
- {plain_dev-0.29.1.dist-info → plain_dev-0.30.0.dist-info}/RECORD +9 -9
- {plain_dev-0.29.1.dist-info → plain_dev-0.30.0.dist-info}/WHEEL +0 -0
- {plain_dev-0.29.1.dist-info → plain_dev-0.30.0.dist-info}/entry_points.txt +0 -0
- {plain_dev-0.29.1.dist-info → plain_dev-0.30.0.dist-info}/licenses/LICENSE +0 -0
plain/dev/cli.py
CHANGED
@@ -18,7 +18,7 @@ from rich.console import Console
|
|
18
18
|
from rich.text import Text
|
19
19
|
|
20
20
|
from plain.cli import register_cli
|
21
|
-
from plain.runtime import APP_PATH,
|
21
|
+
from plain.runtime import APP_PATH, PLAIN_TEMP_PATH
|
22
22
|
|
23
23
|
from .mkcert import MkcertManager
|
24
24
|
from .poncho.manager import Manager as PonchoManager
|
@@ -145,14 +145,13 @@ class Dev:
|
|
145
145
|
self.plain_env = {
|
146
146
|
"PYTHONUNBUFFERED": "true",
|
147
147
|
"PLAIN_DEV": "true",
|
148
|
+
**os.environ,
|
148
149
|
}
|
149
150
|
|
150
151
|
if log_level:
|
151
152
|
self.plain_env["PLAIN_LOG_LEVEL"] = log_level.upper()
|
152
153
|
self.plain_env["APP_LOG_LEVEL"] = log_level.upper()
|
153
154
|
|
154
|
-
self.plain_env.update(os.environ)
|
155
|
-
|
156
155
|
self.custom_process_env = {
|
157
156
|
**self.plain_env,
|
158
157
|
"PORT": str(self.port),
|
@@ -197,12 +196,12 @@ class Dev:
|
|
197
196
|
mkcert_manager.setup_mkcert(install_path=Path.home() / ".plain" / "dev")
|
198
197
|
self.ssl_cert_path, self.ssl_key_path = mkcert_manager.generate_certs(
|
199
198
|
domain=self.hostname,
|
200
|
-
storage_path=Path(
|
199
|
+
storage_path=Path(PLAIN_TEMP_PATH) / "dev" / "certs",
|
201
200
|
)
|
202
201
|
|
203
202
|
self.symlink_plain_src()
|
204
203
|
self.modify_hosts_file()
|
205
|
-
self.
|
204
|
+
self.set_allowed_hosts()
|
206
205
|
self.run_preflight()
|
207
206
|
|
208
207
|
# If we start services ourselves, we should manage the pidfile
|
@@ -280,10 +279,10 @@ class Dev:
|
|
280
279
|
plain_path = Path(
|
281
280
|
importlib.util.find_spec("plain.runtime").origin
|
282
281
|
).parent.parent
|
283
|
-
if not
|
284
|
-
|
282
|
+
if not PLAIN_TEMP_PATH.exists():
|
283
|
+
PLAIN_TEMP_PATH.mkdir()
|
285
284
|
|
286
|
-
symlink_path =
|
285
|
+
symlink_path = PLAIN_TEMP_PATH / "src"
|
287
286
|
|
288
287
|
# The symlink is broken
|
289
288
|
if symlink_path.is_symlink() and not symlink_path.exists():
|
@@ -355,22 +354,13 @@ class Dev:
|
|
355
354
|
)
|
356
355
|
sys.exit(1)
|
357
356
|
|
358
|
-
def
|
359
|
-
if "PLAIN_CSRF_TRUSTED_ORIGINS" not in os.environ:
|
360
|
-
csrf_trusted_origins = json.dumps(
|
361
|
-
[
|
362
|
-
self.url,
|
363
|
-
]
|
364
|
-
)
|
365
|
-
self.plain_env["PLAIN_CSRF_TRUSTED_ORIGINS"] = csrf_trusted_origins
|
366
|
-
self.custom_process_env["PLAIN_CSRF_TRUSTED_ORIGINS"] = csrf_trusted_origins
|
367
|
-
click.secho(
|
368
|
-
f"Automatically set PLAIN_CSRF_TRUSTED_ORIGINS={csrf_trusted_origins}",
|
369
|
-
dim=True,
|
370
|
-
)
|
371
|
-
|
357
|
+
def set_allowed_hosts(self):
|
372
358
|
if "PLAIN_ALLOWED_HOSTS" not in os.environ:
|
373
|
-
|
359
|
+
hostnames = [self.hostname]
|
360
|
+
if self.tunnel_url:
|
361
|
+
# Add the tunnel URL to the allowed hosts
|
362
|
+
hostnames.append(self.tunnel_url.split("://")[1])
|
363
|
+
allowed_hosts = json.dumps(hostnames)
|
374
364
|
self.plain_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
|
375
365
|
self.custom_process_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
|
376
366
|
click.secho(
|
plain/dev/gunicorn_logging.json
CHANGED
@@ -1,46 +1,40 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
"version": 1,
|
3
|
+
"disable_existing_loggers": false,
|
4
|
+
"root": {
|
5
|
+
"level": "INFO",
|
6
|
+
"handlers": ["console"]
|
7
|
+
},
|
8
|
+
"loggers": {
|
9
|
+
"gunicorn.error": {
|
10
|
+
"level": "INFO",
|
11
|
+
"handlers": ["error_console"],
|
12
|
+
"propagate": false,
|
13
|
+
"qualname": "gunicorn.error"
|
9
14
|
},
|
10
|
-
"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
"console"
|
23
|
-
],
|
24
|
-
"propagate": false,
|
25
|
-
"qualname": "gunicorn.access"
|
26
|
-
}
|
27
|
-
},
|
28
|
-
"handlers": {
|
29
|
-
"console": {
|
30
|
-
"class": "logging.StreamHandler",
|
31
|
-
"formatter": "generic",
|
32
|
-
"stream": "ext://sys.stdout"
|
33
|
-
},
|
34
|
-
"error_console": {
|
35
|
-
"class": "logging.StreamHandler",
|
36
|
-
"formatter": "generic",
|
37
|
-
"stream": "ext://sys.stderr"
|
38
|
-
}
|
15
|
+
"gunicorn.access": {
|
16
|
+
"level": "INFO",
|
17
|
+
"handlers": ["console"],
|
18
|
+
"propagate": false,
|
19
|
+
"qualname": "gunicorn.access"
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"handlers": {
|
23
|
+
"console": {
|
24
|
+
"class": "logging.StreamHandler",
|
25
|
+
"formatter": "generic",
|
26
|
+
"stream": "ext://sys.stdout"
|
39
27
|
},
|
40
|
-
"
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
28
|
+
"error_console": {
|
29
|
+
"class": "logging.StreamHandler",
|
30
|
+
"formatter": "generic",
|
31
|
+
"stream": "ext://sys.stderr"
|
32
|
+
}
|
33
|
+
},
|
34
|
+
"formatters": {
|
35
|
+
"generic": {
|
36
|
+
"format": "[%(process)d] [%(levelname)s] %(message)s",
|
37
|
+
"class": "logging.Formatter"
|
45
38
|
}
|
39
|
+
}
|
46
40
|
}
|
plain/dev/requests.py
CHANGED
@@ -6,7 +6,7 @@ import traceback
|
|
6
6
|
|
7
7
|
import requests
|
8
8
|
|
9
|
-
from plain.runtime import settings
|
9
|
+
from plain.runtime import PLAIN_TEMP_PATH, settings
|
10
10
|
from plain.signals import got_request_exception
|
11
11
|
|
12
12
|
|
@@ -18,7 +18,7 @@ class RequestLog:
|
|
18
18
|
|
19
19
|
@staticmethod
|
20
20
|
def storage_path():
|
21
|
-
return str(
|
21
|
+
return str(PLAIN_TEMP_PATH / "dev" / "requestlog")
|
22
22
|
|
23
23
|
@classmethod
|
24
24
|
def replay_request(cls, name):
|
plain/dev/services.py
CHANGED
@@ -7,7 +7,7 @@ from pathlib import Path
|
|
7
7
|
|
8
8
|
import click
|
9
9
|
|
10
|
-
from plain.runtime import APP_PATH,
|
10
|
+
from plain.runtime import APP_PATH, PLAIN_TEMP_PATH
|
11
11
|
|
12
12
|
from .poncho.manager import Manager as PonchoManager
|
13
13
|
from .utils import has_pyproject_toml
|
@@ -15,7 +15,7 @@ from .utils import has_pyproject_toml
|
|
15
15
|
|
16
16
|
class ServicesPid:
|
17
17
|
def __init__(self):
|
18
|
-
self.pidfile =
|
18
|
+
self.pidfile = PLAIN_TEMP_PATH / "dev" / "services.pid"
|
19
19
|
|
20
20
|
def write(self):
|
21
21
|
pid = os.getpid()
|
@@ -1,14 +1,14 @@
|
|
1
1
|
plain/dev/README.md,sha256=EQJ9lF-JQ9KQWJZ_j6CD3jbRquOLgDRlIPbgT7A2gG4,3658
|
2
2
|
plain/dev/__init__.py,sha256=nRX1B0Br8gmqhJLqo5Z9PqzReDahBtbmwH6C-7hzuls,103
|
3
|
-
plain/dev/cli.py,sha256=
|
3
|
+
plain/dev/cli.py,sha256=UVYMrU2glf8z9rkEbxr1QleY1l1Z6Gqm8lDBWC5vv6o,15295
|
4
4
|
plain/dev/debug.py,sha256=Ka84K8zUdF0kMYNyqiLYDrdzU1jU8LSOkts3hcw_Gok,1005
|
5
5
|
plain/dev/default_settings.py,sha256=uXWYORWP_aRDwXIFXdu5kHyiBFUZzARIJdhPeFaX35c,75
|
6
6
|
plain/dev/entrypoints.py,sha256=diqNwA6eydUMtoO7p_rH-DtSYsw5-GBmjFe1Z5bHagc,579
|
7
|
-
plain/dev/gunicorn_logging.json,sha256=
|
7
|
+
plain/dev/gunicorn_logging.json,sha256=3H6b6bQf_KdY61gzypvI0ly_Jduy-Uhqs2ra9ttzGJQ,867
|
8
8
|
plain/dev/mkcert.py,sha256=fm1U_UTGPREso6ZaP79WqEvd9uvA4lYWFo6fKhNglMM,3911
|
9
9
|
plain/dev/pdb.py,sha256=4ru3rlIIyuYVXteyI7v42i4MmdBIjpJP0IJemBpf83A,3742
|
10
|
-
plain/dev/requests.py,sha256=
|
11
|
-
plain/dev/services.py,sha256=
|
10
|
+
plain/dev/requests.py,sha256=OLpauU0FoaJA2IG6YD_KS323jKM5l6RX0HiXQvqpH-E,6865
|
11
|
+
plain/dev/services.py,sha256=0MfPLoffItypUg_1PkX-juigR-abSS42nFHFZ5Eag-k,2843
|
12
12
|
plain/dev/urls.py,sha256=6fyl-DvxDgKjUjpyhuLN8m6GisB8L-eH4rhYH_eRmGA,188
|
13
13
|
plain/dev/utils.py,sha256=4wMzpvj1Is_c0QxhsTu34_P9wAYlzw4glNPfVtZr_0A,123
|
14
14
|
plain/dev/views.py,sha256=yCZ_YmkJGCb3YYgElhzAPrA9V0X3lkiLD1-Ht1HjV7A,1131
|
@@ -24,8 +24,8 @@ plain/dev/poncho/process.py,sha256=JJOKy-C6vMCg7-6JMCtu6C649h7HmOBSJqDP_hnX49I,2
|
|
24
24
|
plain/dev/precommit/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
25
25
|
plain/dev/precommit/cli.py,sha256=KVHcG3Y_JZJNu3_MLIrO5s6yMYQfAArIU5L0hNWZUjg,3441
|
26
26
|
plain/dev/templates/dev/requests.html,sha256=kQKJZq5L77juuL_t8UjcAehEU61U4RXNnKaAET-wAm8,7627
|
27
|
-
plain_dev-0.
|
28
|
-
plain_dev-0.
|
29
|
-
plain_dev-0.
|
30
|
-
plain_dev-0.
|
31
|
-
plain_dev-0.
|
27
|
+
plain_dev-0.30.0.dist-info/METADATA,sha256=3xVJFToL4VLYRv-NIG-vx2dLHYIS155pacrl9oHxphI,4163
|
28
|
+
plain_dev-0.30.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
29
|
+
plain_dev-0.30.0.dist-info/entry_points.txt,sha256=zrcTOiFk_MLKsnYVlwVP7aMm1XLEqq7w4EBkJ-3ge-g,114
|
30
|
+
plain_dev-0.30.0.dist-info/licenses/LICENSE,sha256=Cx4Dq9yR2fLHthf8Ke36B8QJvE1bZFXVzDIGE8wGzsY,4132
|
31
|
+
plain_dev-0.30.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|