plain.dev 0.7.4__py3-none-any.whl → 0.7.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.
plain/dev/cli.py CHANGED
@@ -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.set_csrf_trusted_origins()
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 application is running at: {click.style(url, fg='green', underline=True)}\n",
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 set_csrf_trusted_origins(self):
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
- def set_allowed_hosts(self):
195
- allowed_hosts = json.dumps([self.domain])
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={click.style(allowed_hosts, underline=True)}",
199
- bold=True,
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
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plain.dev
3
- Version: 0.7.4
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)
@@ -1,6 +1,6 @@
1
1
  plain/dev/README.md,sha256=BQDaRKfsafIPzx7vtVt-zS-a8l6sxbQThhQTvu7tp3Y,3699
2
2
  plain/dev/__init__.py,sha256=C1JrkNE5XX2DLgBXXLAV_UyhofwVd0ZPL59fPUMbOKo,139
3
- plain/dev/cli.py,sha256=-JkOB8jUYCyGbHciNxB8P_W6o2ig62MQjYmm1Q58U14,9365
3
+ plain/dev/cli.py,sha256=ips-OUVtGzVuWnxCJkmn-I6OG71fO7uz8sIItZGC3gY,9315
4
4
  plain/dev/config.py,sha256=h6o5YZtJhg-cFIWoqIDWuMCC5T09cxEsBaa3BP4Nii0,632
5
5
  plain/dev/contribute/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
6
6
  plain/dev/contribute/cli.py,sha256=qZ7YmE_upbw-Y5NRpvaHnJTPp9kvn21fPQ7G0n1LAkg,2277
@@ -9,6 +9,7 @@ plain/dev/db/cli.py,sha256=058HjRKLGz-FxauQEpwsPoh_LCiy-_NEIpRZl9W1ZKM,2855
9
9
  plain/dev/db/container.py,sha256=RlPJU_CCMKA-zN8Kp0sYAu3jabOizxYAj8fSCsjCf60,5147
10
10
  plain/dev/debug.py,sha256=fIrecLfAK_lXSDyn3WmYikzZSse3KY47xcVVbZqJGhk,294
11
11
  plain/dev/default_settings.py,sha256=uXWYORWP_aRDwXIFXdu5kHyiBFUZzARIJdhPeFaX35c,75
12
+ plain/dev/gunicorn_logging.json,sha256=ReoMdMAIvbLYhjasjnKXuNp51pmHZBy007X2zmlyxAQ,1111
12
13
  plain/dev/mkcert.py,sha256=u284XXQeTgwSkKKh0gMrYpnNGdd9OOUJKLQAXcvGnr4,3459
13
14
  plain/dev/pid.py,sha256=gRMBf7aGndrra1TnmKtPghTijnd0i0Xeo63mzfPWp7M,436
14
15
  plain/dev/poncho/__init__.py,sha256=MDOk2rhhoR3V-I-rg6tMHFeX60vTGJuQ14RI-_N6tQY,97
@@ -25,8 +26,8 @@ plain/dev/templates/dev/requests.html,sha256=kQKJZq5L77juuL_t8UjcAehEU61U4RXNnKa
25
26
  plain/dev/urls.py,sha256=b4NL2I6Ok-t7nTPjRnKoz_LQRttE3_mp8l2NlmeYQ9I,146
26
27
  plain/dev/utils.py,sha256=4wMzpvj1Is_c0QxhsTu34_P9wAYlzw4glNPfVtZr_0A,123
27
28
  plain/dev/views.py,sha256=r2Ivk7OXytpRhXq4DZpsb7FXNP9vzmEE3D5kLajYG4w,1073
28
- plain_dev-0.7.4.dist-info/LICENSE,sha256=YDg-l_Rj7LVP5uDXy04eQPGb_DYVXAHAHYd9r3pU1Cg,2713
29
- plain_dev-0.7.4.dist-info/METADATA,sha256=DMoPhSJeILSYAwtsFcLa-rEPe2LxX0DdvAv_DMrpDUw,4624
30
- plain_dev-0.7.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
31
- plain_dev-0.7.4.dist-info/entry_points.txt,sha256=rBo-S4THn07f55UwHBuUhIbDhlUq3EzTOD8mIb5fGQg,99
32
- plain_dev-0.7.4.dist-info/RECORD,,
29
+ plain_dev-0.7.5.dist-info/LICENSE,sha256=YDg-l_Rj7LVP5uDXy04eQPGb_DYVXAHAHYd9r3pU1Cg,2713
30
+ plain_dev-0.7.5.dist-info/METADATA,sha256=trgDxXgMGCeQA6BCkurCmGD9Nrns8PVJll9E9R7J1Rc,4675
31
+ plain_dev-0.7.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
32
+ plain_dev-0.7.5.dist-info/entry_points.txt,sha256=rBo-S4THn07f55UwHBuUhIbDhlUq3EzTOD8mIb5fGQg,99
33
+ plain_dev-0.7.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 1.9.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any