plain.dev 0.14.1__py3-none-any.whl → 0.15.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/README.md +1 -1
- plain/dev/cli.py +9 -11
- plain/dev/contribute/cli.py +5 -2
- plain/dev/poncho/compat.py +1 -0
- plain/dev/poncho/manager.py +1 -1
- plain/dev/poncho/printer.py +7 -33
- plain/dev/precommit/cli.py +3 -3
- plain/dev/services.py +1 -1
- {plain_dev-0.14.1.dist-info → plain_dev-0.15.0.dist-info}/METADATA +15 -23
- {plain_dev-0.14.1.dist-info → plain_dev-0.15.0.dist-info}/RECORD +21 -21
- {plain_dev-0.14.1.dist-info → plain_dev-0.15.0.dist-info}/WHEEL +1 -1
- plain_dev-0.15.0.dist-info/entry_points.txt +7 -0
- plain_dev-0.14.1.dist-info/entry_points.txt +0 -8
- {plain_dev-0.14.1.dist-info → plain_dev-0.15.0.dist-info/licenses}/LICENSE +0 -0
plain/dev/README.md
CHANGED
@@ -58,7 +58,7 @@ Runs:
|
|
58
58
|
|
59
59
|
- Custom commands defined in `pyproject.toml` at `tool.plain.pre-commit.run`
|
60
60
|
- `plain code check`, if [`plain.code`](https://plainframework.com/docs/plain-code/plain/code/) is installed
|
61
|
-
- `
|
61
|
+
- `uv lock --locked`, if using uv
|
62
62
|
- `plain preflight --database default`
|
63
63
|
- `plain migrate --check`
|
64
64
|
- `plain makemigrations --dry-run --check`
|
plain/dev/cli.py
CHANGED
@@ -4,12 +4,13 @@ import os
|
|
4
4
|
import platform
|
5
5
|
import subprocess
|
6
6
|
import sys
|
7
|
+
import tomllib
|
7
8
|
from importlib.metadata import entry_points
|
8
9
|
from importlib.util import find_spec
|
9
10
|
from pathlib import Path
|
10
11
|
|
11
12
|
import click
|
12
|
-
import
|
13
|
+
from rich.console import Console
|
13
14
|
|
14
15
|
from plain.runtime import APP_PATH, settings
|
15
16
|
|
@@ -17,6 +18,7 @@ from .db import cli as db_cli
|
|
17
18
|
from .mkcert import MkcertManager
|
18
19
|
from .pid import Pid
|
19
20
|
from .poncho.manager import Manager as PonchoManager
|
21
|
+
from .poncho.printer import Printer
|
20
22
|
from .services import Services
|
21
23
|
from .utils import has_pyproject_toml
|
22
24
|
|
@@ -91,8 +93,6 @@ class Dev:
|
|
91
93
|
self.hostname = hostname
|
92
94
|
self.log_level = log_level
|
93
95
|
|
94
|
-
self.poncho = PonchoManager()
|
95
|
-
|
96
96
|
self.ssl_key_path = None
|
97
97
|
self.ssl_cert_path = None
|
98
98
|
|
@@ -110,6 +110,9 @@ class Dev:
|
|
110
110
|
"PLAIN_DEV_URL": self.url,
|
111
111
|
}
|
112
112
|
|
113
|
+
self.console = Console(markup=False, highlight=False)
|
114
|
+
self.poncho = PonchoManager(printer=Printer(lambda s: self.console.out(s)))
|
115
|
+
|
113
116
|
def run(self):
|
114
117
|
pid = Pid()
|
115
118
|
pid.write()
|
@@ -133,15 +136,10 @@ class Dev:
|
|
133
136
|
self.add_pyproject_run()
|
134
137
|
self.add_services()
|
135
138
|
|
136
|
-
|
137
|
-
click.secho(
|
138
|
-
f"\nYour app will run at: {click.style(self.url, fg='green', underline=True)}\n",
|
139
|
-
bold=True,
|
140
|
-
)
|
141
|
-
|
142
|
-
click.secho("Starting services (Ctrl+C to stop):", italic=True, dim=True)
|
139
|
+
click.secho("\nStarting services (Ctrl+C to stop):", italic=True, dim=True)
|
143
140
|
|
144
|
-
self.
|
141
|
+
with self.console.status(self.url):
|
142
|
+
self.poncho.loop()
|
145
143
|
|
146
144
|
return self.poncho.returncode
|
147
145
|
finally:
|
plain/dev/contribute/cli.py
CHANGED
@@ -7,11 +7,14 @@ import click
|
|
7
7
|
|
8
8
|
@click.command("contribute")
|
9
9
|
@click.option("--repo", default="../plain", help="Path to the plain repo")
|
10
|
+
@click.option(
|
11
|
+
"--reset", is_flag=True, help="Undo any changes to pyproject.toml and uv.lock"
|
12
|
+
)
|
10
13
|
@click.argument("packages", nargs=-1)
|
11
|
-
def cli(packages, repo):
|
14
|
+
def cli(packages, repo, reset):
|
12
15
|
"""Contribute to plain by linking packages locally."""
|
13
16
|
|
14
|
-
if
|
17
|
+
if reset:
|
15
18
|
click.secho("Undoing any changes to pyproject.toml and uv.lock", bold=True)
|
16
19
|
result = subprocess.run(["git", "checkout", "pyproject.toml", "uv.lock"])
|
17
20
|
if result.returncode:
|
plain/dev/poncho/compat.py
CHANGED
plain/dev/poncho/manager.py
CHANGED
@@ -91,7 +91,7 @@ class Manager:
|
|
91
91
|
"""
|
92
92
|
|
93
93
|
def _terminate(signum, frame):
|
94
|
-
self._system_print("
|
94
|
+
self._system_print("{} received\n".format(SIGNALS[signum]["name"]))
|
95
95
|
self.returncode = SIGNALS[signum]["rc"]
|
96
96
|
self.terminate()
|
97
97
|
|
plain/dev/poncho/printer.py
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
import sys
|
2
1
|
from collections import namedtuple
|
3
2
|
|
4
|
-
from .compat import ON_WINDOWS
|
5
|
-
|
6
3
|
Message = namedtuple("Message", "type data time name color")
|
7
4
|
|
8
5
|
|
@@ -15,27 +12,18 @@ class Printer:
|
|
15
12
|
|
16
13
|
def __init__(
|
17
14
|
self,
|
18
|
-
|
15
|
+
print_func,
|
19
16
|
time_format="%H:%M:%S",
|
20
17
|
width=0,
|
21
18
|
color=True,
|
22
19
|
prefix=True,
|
23
20
|
):
|
24
|
-
self.
|
21
|
+
self.print_func = print_func
|
25
22
|
self.time_format = time_format
|
26
23
|
self.width = width
|
27
24
|
self.color = color
|
28
25
|
self.prefix = prefix
|
29
26
|
|
30
|
-
try:
|
31
|
-
# We only want to print colored messages if the given output supports
|
32
|
-
# ANSI escape sequences. Usually, testing if it is a TTY is safe enough.
|
33
|
-
self._colors_supported = self.output.isatty()
|
34
|
-
except AttributeError:
|
35
|
-
# If the given output does not implement isatty(), we assume that it
|
36
|
-
# is not able to handle ANSI escape sequences.
|
37
|
-
self._colors_supported = False
|
38
|
-
|
39
27
|
def write(self, message):
|
40
28
|
if message.type != "line":
|
41
29
|
raise RuntimeError('Printer can only process messages of type "line"')
|
@@ -58,28 +46,14 @@ class Printer:
|
|
58
46
|
if self.prefix:
|
59
47
|
time_formatted = message.time.strftime(self.time_format)
|
60
48
|
prefix = f"{time_formatted} {name}| "
|
61
|
-
if self.color and
|
49
|
+
if self.color and message.color:
|
62
50
|
prefix = _color_string(message.color, prefix)
|
63
|
-
print(prefix + line, file=self.output, flush=True)
|
64
51
|
|
65
|
-
|
66
|
-
def _ansi(code):
|
67
|
-
return f"\033[{code}m"
|
52
|
+
self.print_func(prefix + line)
|
68
53
|
|
69
54
|
|
70
55
|
def _color_string(color, s):
|
71
|
-
|
56
|
+
def _ansi(code):
|
57
|
+
return f"\033[{code}m"
|
72
58
|
|
73
|
-
|
74
|
-
if ON_WINDOWS:
|
75
|
-
# The colorama package provides transparent support for ANSI color codes
|
76
|
-
# on Win32 platforms. We try and import and configure that, but fall back
|
77
|
-
# to no color if we fail.
|
78
|
-
try:
|
79
|
-
import colorama
|
80
|
-
except ImportError:
|
81
|
-
|
82
|
-
def _color_string(color, s):
|
83
|
-
return s
|
84
|
-
else:
|
85
|
-
colorama.init()
|
59
|
+
return f"{_ansi(0)}{_ansi(color)}{s}{_ansi(0)}"
|
plain/dev/precommit/cli.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import os
|
2
2
|
import subprocess
|
3
3
|
import sys
|
4
|
+
import tomllib
|
4
5
|
from importlib.util import find_spec
|
5
6
|
from pathlib import Path
|
6
7
|
|
7
8
|
import click
|
8
|
-
import tomllib
|
9
9
|
|
10
10
|
from plain.cli.print import print_event
|
11
11
|
|
@@ -56,8 +56,8 @@ def cli(install):
|
|
56
56
|
if find_spec("plain.code"):
|
57
57
|
check_short("Running plain code checks", "plain", "code", "check")
|
58
58
|
|
59
|
-
if Path("
|
60
|
-
check_short("Checking
|
59
|
+
if Path("uv.lock").exists():
|
60
|
+
check_short("Checking uv.lock", "uv", "lock", "--locked")
|
61
61
|
|
62
62
|
if plain_db_connected():
|
63
63
|
check_short(
|
plain/dev/services.py
CHANGED
@@ -1,26 +1,19 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: plain.dev
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.15.0
|
4
4
|
Summary: Local development tools for Plain.
|
5
|
-
|
6
|
-
License: BSD-3-Clause
|
7
|
-
|
8
|
-
|
9
|
-
Requires-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Requires-Dist:
|
16
|
-
Requires-Dist:
|
17
|
-
Requires-Dist: gunicorn (>20)
|
18
|
-
Requires-Dist: plain (<1.0.0)
|
19
|
-
Requires-Dist: psycopg[binary] (>=3.2.2,<4.0.0)
|
20
|
-
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
21
|
-
Requires-Dist: requests (>=2.0.0)
|
22
|
-
Project-URL: Documentation, https://plainframework.com/docs/
|
23
|
-
Project-URL: Repository, https://github.com/dropseed/plain
|
5
|
+
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
6
|
+
License-Expression: BSD-3-Clause
|
7
|
+
License-File: LICENSE
|
8
|
+
Requires-Python: >=3.11
|
9
|
+
Requires-Dist: click>=8.0.0
|
10
|
+
Requires-Dist: debugpy~=1.6.3
|
11
|
+
Requires-Dist: gunicorn>20
|
12
|
+
Requires-Dist: plain<1.0.0
|
13
|
+
Requires-Dist: psycopg[binary]~=3.2.2
|
14
|
+
Requires-Dist: python-dotenv~=1.0.0
|
15
|
+
Requires-Dist: requests>=2.0.0
|
16
|
+
Requires-Dist: rich
|
24
17
|
Description-Content-Type: text/markdown
|
25
18
|
|
26
19
|
<!-- This file is compiled from plain-dev/plain/dev/README.md. Do not edit this file directly. -->
|
@@ -85,7 +78,7 @@ Runs:
|
|
85
78
|
|
86
79
|
- Custom commands defined in `pyproject.toml` at `tool.plain.pre-commit.run`
|
87
80
|
- `plain code check`, if [`plain.code`](https://plainframework.com/docs/plain-code/plain/code/) is installed
|
88
|
-
- `
|
81
|
+
- `uv lock --locked`, if using uv
|
89
82
|
- `plain preflight --database default`
|
90
83
|
- `plain migrate --check`
|
91
84
|
- `plain makemigrations --dry-run --check`
|
@@ -121,4 +114,3 @@ class HomeView(TemplateView):
|
|
121
114
|
When you load the page, you'll see "Waiting for debugger to attach...".
|
122
115
|
|
123
116
|
You can then run the VS Code debugger and attach to an existing Python process, at localhost:5678.
|
124
|
-
|
@@ -1,33 +1,33 @@
|
|
1
|
-
plain/dev/README.md,sha256
|
1
|
+
plain/dev/README.md,sha256=-yR4qzwEP7vDVvCAHJ22aaQHQ7rXVW9uy0KEZjCzmz4,3662
|
2
2
|
plain/dev/__init__.py,sha256=C1JrkNE5XX2DLgBXXLAV_UyhofwVd0ZPL59fPUMbOKo,139
|
3
|
-
plain/dev/cli.py,sha256=
|
4
|
-
plain/dev/contribute/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
5
|
-
plain/dev/contribute/cli.py,sha256=vrHSYM0Y2XtIUbxmNcJqssoPN-ZbkH4T_p65NVkYrV4,2339
|
6
|
-
plain/dev/db/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
7
|
-
plain/dev/db/cli.py,sha256=058HjRKLGz-FxauQEpwsPoh_LCiy-_NEIpRZl9W1ZKM,2855
|
8
|
-
plain/dev/db/container.py,sha256=RlPJU_CCMKA-zN8Kp0sYAu3jabOizxYAj8fSCsjCf60,5147
|
3
|
+
plain/dev/cli.py,sha256=3vA6ekQ3WdXFMst6TLeT982mUb3EiSsBkCnTZcSU5Gc,10605
|
9
4
|
plain/dev/debug.py,sha256=fIrecLfAK_lXSDyn3WmYikzZSse3KY47xcVVbZqJGhk,294
|
10
5
|
plain/dev/default_settings.py,sha256=uXWYORWP_aRDwXIFXdu5kHyiBFUZzARIJdhPeFaX35c,75
|
11
6
|
plain/dev/entrypoints.py,sha256=qBTP2A9pgxQmZ9hGV0OiBL92v9wa7TeJdOXnKZcX6AE,81
|
12
7
|
plain/dev/gunicorn_logging.json,sha256=yU23jzs5G4YGdDWBNiyAc3KypR4HirR6afIkD7w6DhU,1113
|
13
8
|
plain/dev/mkcert.py,sha256=u284XXQeTgwSkKKh0gMrYpnNGdd9OOUJKLQAXcvGnr4,3459
|
14
9
|
plain/dev/pid.py,sha256=gRMBf7aGndrra1TnmKtPghTijnd0i0Xeo63mzfPWp7M,436
|
10
|
+
plain/dev/requests.py,sha256=v4ucDL8d6I0s5kF8O8HRvSc6Snq1Z_SMQv7wGGAI_Us,6847
|
11
|
+
plain/dev/services.py,sha256=26WnVNjNAh37BA-wHQSGQY_9Ofw8oGgJdHhxnFaSKkg,2059
|
12
|
+
plain/dev/urls.py,sha256=b4NL2I6Ok-t7nTPjRnKoz_LQRttE3_mp8l2NlmeYQ9I,146
|
13
|
+
plain/dev/utils.py,sha256=4wMzpvj1Is_c0QxhsTu34_P9wAYlzw4glNPfVtZr_0A,123
|
14
|
+
plain/dev/views.py,sha256=r2Ivk7OXytpRhXq4DZpsb7FXNP9vzmEE3D5kLajYG4w,1073
|
15
|
+
plain/dev/contribute/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
16
|
+
plain/dev/contribute/cli.py,sha256=mIK4u1rhee8iMovUpuHTNjfWolqNgS24_gTb8ZaSY-8,2432
|
17
|
+
plain/dev/db/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
18
|
+
plain/dev/db/cli.py,sha256=058HjRKLGz-FxauQEpwsPoh_LCiy-_NEIpRZl9W1ZKM,2855
|
19
|
+
plain/dev/db/container.py,sha256=RlPJU_CCMKA-zN8Kp0sYAu3jabOizxYAj8fSCsjCf60,5147
|
15
20
|
plain/dev/poncho/__init__.py,sha256=MDOk2rhhoR3V-I-rg6tMHFeX60vTGJuQ14RI-_N6tQY,97
|
16
21
|
plain/dev/poncho/color.py,sha256=Dk77inPR9qNc9vCaZOGk8W9skXfRgoUlxp_E6mhPNns,610
|
17
|
-
plain/dev/poncho/compat.py,sha256=
|
18
|
-
plain/dev/poncho/manager.py,sha256=
|
19
|
-
plain/dev/poncho/printer.py,sha256=
|
22
|
+
plain/dev/poncho/compat.py,sha256=l66WZLR7kRpO8P8DI5-aUsbNlohPaXEurQ5xXESQYDs,1276
|
23
|
+
plain/dev/poncho/manager.py,sha256=l_m_RhNTF9Fs6p0Tk8pdjd5ZxQxU1kbGEgDD-qJaFGs,6366
|
24
|
+
plain/dev/poncho/printer.py,sha256=wt1ioaGcPnVyrPy-UjvdsR9zfcr4DTTycmapW1MIdSU,1785
|
20
25
|
plain/dev/poncho/process.py,sha256=JJOKy-C6vMCg7-6JMCtu6C649h7HmOBSJqDP_hnX49I,2637
|
21
26
|
plain/dev/precommit/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
22
|
-
plain/dev/precommit/cli.py,sha256=
|
23
|
-
plain/dev/requests.py,sha256=v4ucDL8d6I0s5kF8O8HRvSc6Snq1Z_SMQv7wGGAI_Us,6847
|
24
|
-
plain/dev/services.py,sha256=XwtMpTjyZzEB8RVgjRuW9PRMQSTuhUAN-zY4Kl_kSZY,2059
|
27
|
+
plain/dev/precommit/cli.py,sha256=D_A5Mk2eXqjJDSUE6qyCFFddhM7wBZR3C9hgkDRx_v8,3411
|
25
28
|
plain/dev/templates/dev/requests.html,sha256=kQKJZq5L77juuL_t8UjcAehEU61U4RXNnKaAET-wAm8,7627
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
plain_dev-0.
|
30
|
-
plain_dev-0.
|
31
|
-
plain_dev-0.14.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
32
|
-
plain_dev-0.14.1.dist-info/entry_points.txt,sha256=1FaE_73k95WYOJrmB0hcHBnEIFQa-Cfl56Z1LGxyvak,164
|
33
|
-
plain_dev-0.14.1.dist-info/RECORD,,
|
29
|
+
plain_dev-0.15.0.dist-info/METADATA,sha256=Im1HdbGL3G1q1WEh5eI2i-zxtsh5SUtsVVGQTSgfR5s,4274
|
30
|
+
plain_dev-0.15.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
31
|
+
plain_dev-0.15.0.dist-info/entry_points.txt,sha256=jncRPB4B7d27YWkzWqzt68y534ntliHPNukv_kQu5KY,171
|
32
|
+
plain_dev-0.15.0.dist-info/licenses/LICENSE,sha256=YDg-l_Rj7LVP5uDXy04eQPGb_DYVXAHAHYd9r3pU1Cg,2713
|
33
|
+
plain_dev-0.15.0.dist-info/RECORD,,
|
File without changes
|