plain.dev 0.14.2__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/cli.py +8 -10
- plain/dev/contribute/cli.py +5 -2
- plain/dev/poncho/printer.py +7 -33
- {plain_dev-0.14.2.dist-info → plain_dev-0.15.0.dist-info}/METADATA +2 -1
- {plain_dev-0.14.2.dist-info → plain_dev-0.15.0.dist-info}/RECORD +8 -8
- {plain_dev-0.14.2.dist-info → plain_dev-0.15.0.dist-info}/WHEEL +0 -0
- {plain_dev-0.14.2.dist-info → plain_dev-0.15.0.dist-info}/entry_points.txt +0 -0
- {plain_dev-0.14.2.dist-info → plain_dev-0.15.0.dist-info}/licenses/LICENSE +0 -0
plain/dev/cli.py
CHANGED
@@ -10,6 +10,7 @@ from importlib.util import find_spec
|
|
10
10
|
from pathlib import Path
|
11
11
|
|
12
12
|
import click
|
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/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)}"
|
@@ -1,6 +1,6 @@
|
|
1
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
5
|
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
6
6
|
License-Expression: BSD-3-Clause
|
@@ -13,6 +13,7 @@ Requires-Dist: plain<1.0.0
|
|
13
13
|
Requires-Dist: psycopg[binary]~=3.2.2
|
14
14
|
Requires-Dist: python-dotenv~=1.0.0
|
15
15
|
Requires-Dist: requests>=2.0.0
|
16
|
+
Requires-Dist: rich
|
16
17
|
Description-Content-Type: text/markdown
|
17
18
|
|
18
19
|
<!-- This file is compiled from plain-dev/plain/dev/README.md. Do not edit this file directly. -->
|
@@ -1,6 +1,6 @@
|
|
1
1
|
plain/dev/README.md,sha256=-yR4qzwEP7vDVvCAHJ22aaQHQ7rXVW9uy0KEZjCzmz4,3662
|
2
2
|
plain/dev/__init__.py,sha256=C1JrkNE5XX2DLgBXXLAV_UyhofwVd0ZPL59fPUMbOKo,139
|
3
|
-
plain/dev/cli.py,sha256=
|
3
|
+
plain/dev/cli.py,sha256=3vA6ekQ3WdXFMst6TLeT982mUb3EiSsBkCnTZcSU5Gc,10605
|
4
4
|
plain/dev/debug.py,sha256=fIrecLfAK_lXSDyn3WmYikzZSse3KY47xcVVbZqJGhk,294
|
5
5
|
plain/dev/default_settings.py,sha256=uXWYORWP_aRDwXIFXdu5kHyiBFUZzARIJdhPeFaX35c,75
|
6
6
|
plain/dev/entrypoints.py,sha256=qBTP2A9pgxQmZ9hGV0OiBL92v9wa7TeJdOXnKZcX6AE,81
|
@@ -13,7 +13,7 @@ plain/dev/urls.py,sha256=b4NL2I6Ok-t7nTPjRnKoz_LQRttE3_mp8l2NlmeYQ9I,146
|
|
13
13
|
plain/dev/utils.py,sha256=4wMzpvj1Is_c0QxhsTu34_P9wAYlzw4glNPfVtZr_0A,123
|
14
14
|
plain/dev/views.py,sha256=r2Ivk7OXytpRhXq4DZpsb7FXNP9vzmEE3D5kLajYG4w,1073
|
15
15
|
plain/dev/contribute/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
16
|
-
plain/dev/contribute/cli.py,sha256=
|
16
|
+
plain/dev/contribute/cli.py,sha256=mIK4u1rhee8iMovUpuHTNjfWolqNgS24_gTb8ZaSY-8,2432
|
17
17
|
plain/dev/db/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
18
18
|
plain/dev/db/cli.py,sha256=058HjRKLGz-FxauQEpwsPoh_LCiy-_NEIpRZl9W1ZKM,2855
|
19
19
|
plain/dev/db/container.py,sha256=RlPJU_CCMKA-zN8Kp0sYAu3jabOizxYAj8fSCsjCf60,5147
|
@@ -21,13 +21,13 @@ plain/dev/poncho/__init__.py,sha256=MDOk2rhhoR3V-I-rg6tMHFeX60vTGJuQ14RI-_N6tQY,
|
|
21
21
|
plain/dev/poncho/color.py,sha256=Dk77inPR9qNc9vCaZOGk8W9skXfRgoUlxp_E6mhPNns,610
|
22
22
|
plain/dev/poncho/compat.py,sha256=l66WZLR7kRpO8P8DI5-aUsbNlohPaXEurQ5xXESQYDs,1276
|
23
23
|
plain/dev/poncho/manager.py,sha256=l_m_RhNTF9Fs6p0Tk8pdjd5ZxQxU1kbGEgDD-qJaFGs,6366
|
24
|
-
plain/dev/poncho/printer.py,sha256=
|
24
|
+
plain/dev/poncho/printer.py,sha256=wt1ioaGcPnVyrPy-UjvdsR9zfcr4DTTycmapW1MIdSU,1785
|
25
25
|
plain/dev/poncho/process.py,sha256=JJOKy-C6vMCg7-6JMCtu6C649h7HmOBSJqDP_hnX49I,2637
|
26
26
|
plain/dev/precommit/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
|
27
27
|
plain/dev/precommit/cli.py,sha256=D_A5Mk2eXqjJDSUE6qyCFFddhM7wBZR3C9hgkDRx_v8,3411
|
28
28
|
plain/dev/templates/dev/requests.html,sha256=kQKJZq5L77juuL_t8UjcAehEU61U4RXNnKaAET-wAm8,7627
|
29
|
-
plain_dev-0.
|
30
|
-
plain_dev-0.
|
31
|
-
plain_dev-0.
|
32
|
-
plain_dev-0.
|
33
|
-
plain_dev-0.
|
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
|
File without changes
|
File without changes
|