plain.dev 0.7.4__tar.gz → 0.7.5__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.
- {plain_dev-0.7.4 → plain_dev-0.7.5}/PKG-INFO +2 -1
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/cli.py +15 -19
- plain_dev-0.7.5/plain/dev/gunicorn_logging.json +46 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/pyproject.toml +1 -1
- {plain_dev-0.7.4 → plain_dev-0.7.5}/LICENSE +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/README.md +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/README.md +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/__init__.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/config.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/contribute/__init__.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/contribute/cli.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/db/__init__.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/db/cli.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/db/container.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/debug.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/default_settings.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/mkcert.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/pid.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/poncho/__init__.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/poncho/color.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/poncho/compat.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/poncho/manager.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/poncho/printer.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/poncho/process.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/precommit/__init__.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/precommit/cli.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/requests.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/services.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/templates/dev/requests.html +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/urls.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/utils.py +0 -0
- {plain_dev-0.7.4 → plain_dev-0.7.5}/plain/dev/views.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: plain.dev
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.5
|
4
4
|
Summary: Local development tools for Plain.
|
5
5
|
Home-page: https://plainframework.com
|
6
6
|
License: BSD-3-Clause
|
@@ -11,6 +11,7 @@ Classifier: License :: OSI Approved :: BSD License
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
14
15
|
Requires-Dist: click (>=8.0.0)
|
15
16
|
Requires-Dist: debugpy (>=1.6.3,<2.0.0)
|
16
17
|
Requires-Dist: gunicorn (>20)
|
@@ -97,8 +97,7 @@ class Dev:
|
|
97
97
|
storage_path=Path(settings.PLAIN_TEMP_PATH) / "dev" / "certs",
|
98
98
|
)
|
99
99
|
self.modify_hosts_file()
|
100
|
-
self.
|
101
|
-
self.set_allowed_hosts()
|
100
|
+
self.set_csrf_and_allowed_hosts()
|
102
101
|
self.run_preflight()
|
103
102
|
|
104
103
|
# Processes for poncho to run simultaneously
|
@@ -110,10 +109,12 @@ class Dev:
|
|
110
109
|
# Output the clickable link before starting the manager loop
|
111
110
|
url = f"https://{self.domain}:{self.port}/"
|
112
111
|
click.secho(
|
113
|
-
f"\nYour
|
112
|
+
f"\nYour app will run at: {click.style(url, fg='green', underline=True)}\n",
|
114
113
|
bold=True,
|
115
114
|
)
|
116
115
|
|
116
|
+
click.secho("Starting services (Ctrl+C to stop):", italic=True, dim=True)
|
117
|
+
|
117
118
|
self.poncho.loop()
|
118
119
|
|
119
120
|
return self.poncho.returncode
|
@@ -156,12 +157,12 @@ class Dev:
|
|
156
157
|
|
157
158
|
# Entry does not exist; append it using sudo
|
158
159
|
click.secho(
|
159
|
-
"Modifying /etc/hosts file. You may be prompted for your password
|
160
|
+
"Modifying /etc/hosts file. You may be prompted for your password.\n",
|
160
161
|
bold=True,
|
161
162
|
)
|
162
163
|
cmd = f"echo '{hosts_entry}' | sudo tee -a {hosts_path} >/dev/null"
|
163
164
|
subprocess.run(cmd, shell=True, check=True)
|
164
|
-
click.secho(f"Added {self.domain} to {hosts_path}", bold=True)
|
165
|
+
click.secho(f"Added {self.domain} to {hosts_path}\n", bold=True)
|
165
166
|
except PermissionError:
|
166
167
|
click.secho(
|
167
168
|
"Permission denied while accessing hosts file.",
|
@@ -175,35 +176,28 @@ class Dev:
|
|
175
176
|
)
|
176
177
|
sys.exit(1)
|
177
178
|
|
178
|
-
def
|
179
|
+
def set_csrf_and_allowed_hosts(self):
|
179
180
|
csrf_trusted_origins = json.dumps(
|
180
181
|
[
|
181
182
|
f"https://{self.domain}:{self.port}",
|
182
183
|
]
|
183
184
|
)
|
184
|
-
|
185
|
-
click.secho(
|
186
|
-
f"Automatically set PLAIN_CSRF_TRUSTED_ORIGINS={click.style(csrf_trusted_origins, underline=True)}",
|
187
|
-
bold=True,
|
188
|
-
)
|
185
|
+
allowed_hosts = json.dumps([self.domain])
|
189
186
|
|
190
187
|
# Set environment variables
|
191
188
|
self.plain_env["PLAIN_CSRF_TRUSTED_ORIGINS"] = csrf_trusted_origins
|
192
189
|
self.custom_process_env["PLAIN_CSRF_TRUSTED_ORIGINS"] = csrf_trusted_origins
|
193
190
|
|
194
|
-
|
195
|
-
|
191
|
+
self.plain_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
|
192
|
+
self.custom_process_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
|
196
193
|
|
197
194
|
click.secho(
|
198
|
-
f"Automatically set PLAIN_ALLOWED_HOSTS={
|
199
|
-
|
195
|
+
f"Automatically set PLAIN_ALLOWED_HOSTS={allowed_hosts} PLAIN_CSRF_TRUSTED_ORIGINS={csrf_trusted_origins}",
|
196
|
+
dim=True,
|
200
197
|
)
|
201
198
|
|
202
|
-
# Set environment variables
|
203
|
-
self.plain_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
|
204
|
-
self.custom_process_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
|
205
|
-
|
206
199
|
def run_preflight(self):
|
200
|
+
click.echo()
|
207
201
|
if subprocess.run(["plain", "preflight"], env=self.plain_env).returncode:
|
208
202
|
click.secho("Preflight check failed!", fg="red")
|
209
203
|
sys.exit(1)
|
@@ -237,6 +231,8 @@ class Dev:
|
|
237
231
|
*reload_extra.split(),
|
238
232
|
"--access-logformat",
|
239
233
|
"'\"%(r)s\" status=%(s)s length=%(b)s dur=%(M)sms'",
|
234
|
+
"--log-config-json",
|
235
|
+
str(Path(__file__).parent / "gunicorn_logging.json"),
|
240
236
|
]
|
241
237
|
gunicorn = " ".join(gunicorn_cmd)
|
242
238
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"version": 1,
|
3
|
+
"disable_existing_loggers": false,
|
4
|
+
"root": {
|
5
|
+
"level": "INFO",
|
6
|
+
"handlers": [
|
7
|
+
"console"
|
8
|
+
]
|
9
|
+
},
|
10
|
+
"loggers": {
|
11
|
+
"gunicorn.error": {
|
12
|
+
"level": "INFO",
|
13
|
+
"handlers": [
|
14
|
+
"error_console"
|
15
|
+
],
|
16
|
+
"propagate": true,
|
17
|
+
"qualname": "gunicorn.error"
|
18
|
+
},
|
19
|
+
"gunicorn.access": {
|
20
|
+
"level": "INFO",
|
21
|
+
"handlers": [
|
22
|
+
"console"
|
23
|
+
],
|
24
|
+
"propagate": true,
|
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
|
+
}
|
39
|
+
},
|
40
|
+
"formatters": {
|
41
|
+
"generic": {
|
42
|
+
"format": "[%(process)d] [%(levelname)s] %(message)s",
|
43
|
+
"class": "logging.Formatter"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|