plain.dev 0.13.0__py3-none-any.whl → 0.14.1__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
@@ -1,3 +1,4 @@
1
+ import importlib
1
2
  import json
2
3
  import os
3
4
  import platform
@@ -120,6 +121,8 @@ class Dev:
120
121
  domain=self.hostname,
121
122
  storage_path=Path(settings.PLAIN_TEMP_PATH) / "dev" / "certs",
122
123
  )
124
+
125
+ self.symlink_plain_src()
123
126
  self.modify_hosts_file()
124
127
  self.set_csrf_and_allowed_hosts()
125
128
  self.run_preflight()
@@ -144,6 +147,17 @@ class Dev:
144
147
  finally:
145
148
  pid.rm()
146
149
 
150
+ def symlink_plain_src(self):
151
+ """Symlink the plain package into .plain so we can look at it easily"""
152
+ plain_path = Path(
153
+ importlib.util.find_spec("plain.runtime").origin
154
+ ).parent.parent
155
+ if not settings.PLAIN_TEMP_PATH.exists():
156
+ settings.PLAIN_TEMP_PATH.mkdir()
157
+ src_path = settings.PLAIN_TEMP_PATH / "src"
158
+ if plain_path.exists() and not src_path.exists():
159
+ src_path.symlink_to(plain_path)
160
+
147
161
  def modify_hosts_file(self):
148
162
  """Modify the hosts file to map the custom domain to 127.0.0.1."""
149
163
  entry_identifier = "# Added by plain"
@@ -7,11 +7,11 @@ import click
7
7
 
8
8
  @click.command("contribute")
9
9
  @click.option("--repo", default="../plain", help="Path to the plain repo")
10
- @click.argument("package")
11
- def cli(package, repo):
12
- """Contribute to plain by linking a package locally."""
10
+ @click.argument("packages", nargs=-1)
11
+ def cli(packages, repo):
12
+ """Contribute to plain by linking packages locally."""
13
13
 
14
- if package == "reset":
14
+ if "reset" in packages:
15
15
  click.secho("Undoing any changes to pyproject.toml and uv.lock", bold=True)
16
16
  result = subprocess.run(["git", "checkout", "pyproject.toml", "uv.lock"])
17
17
  if result.returncode:
@@ -46,33 +46,28 @@ def cli(package, repo):
46
46
  )
47
47
  click.secho(f"Using repo at {repo} ({repo_branch} branch)", bold=True)
48
48
 
49
- click.secho(f"Linking {package} to {repo}", bold=True)
50
- if package == "plain" or package.startswith("plain-"):
51
- result = subprocess.run(
52
- [
53
- "uv",
54
- "add",
55
- "--editable",
56
- "--dev",
57
- str(repo / package), # Link a subdirectory
58
- ]
59
- )
49
+ plain_packages = []
50
+ plainx_packages = []
51
+
52
+ for package in packages:
53
+ package = package.replace(".", "-")
54
+ click.secho(f"Linking {package} to {repo}", bold=True)
55
+ if package == "plain" or package.startswith("plain-"):
56
+ plain_packages.append(str(repo / package))
57
+ elif package.startswith("plainx-"):
58
+ plainx_packages.append(str(repo))
59
+ else:
60
+ click.secho(f"Unknown package {package}", fg="red")
61
+ sys.exit(2)
62
+
63
+ if plain_packages:
64
+ result = subprocess.run(["uv", "add", "--editable", "--dev"] + plain_packages)
60
65
  if result.returncode:
61
- click.secho("Failed to link the package", fg="red")
66
+ click.secho("Failed to link plain packages", fg="red")
62
67
  sys.exit(result.returncode)
63
- elif package.startswith("plainx-"):
64
- result = subprocess.run(
65
- [
66
- "uv",
67
- "add",
68
- "--editable",
69
- "--dev",
70
- str(repo),
71
- ]
72
- )
68
+
69
+ if plainx_packages:
70
+ result = subprocess.run(["uv", "add", "--editable", "--dev"] + plainx_packages)
73
71
  if result.returncode:
74
- click.secho("Failed to link the package", fg="red")
72
+ click.secho("Failed to link plainx packages", fg="red")
75
73
  sys.exit(result.returncode)
76
- else:
77
- click.secho(f"Unknown package {package}", fg="red")
78
- sys.exit(2)
plain/dev/requests.py CHANGED
@@ -18,7 +18,7 @@ class RequestLog:
18
18
 
19
19
  @staticmethod
20
20
  def storage_path():
21
- return str(settings.PLAIN_TEMP_PATH / "requestlog")
21
+ return str(settings.PLAIN_TEMP_PATH / "dev" / "requestlog")
22
22
 
23
23
  @classmethod
24
24
  def replay_request(cls, name):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plain.dev
3
- Version: 0.13.0
3
+ Version: 0.14.1
4
4
  Summary: Local development tools for Plain.
5
5
  Home-page: https://plainframework.com
6
6
  License: BSD-3-Clause
@@ -1,9 +1,8 @@
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=IzO14253uPogLV2emmZHKhBQgc7mCtr8VmfhR_g2O7g,10082
4
- plain/dev/config.py,sha256=h6o5YZtJhg-cFIWoqIDWuMCC5T09cxEsBaa3BP4Nii0,632
3
+ plain/dev/cli.py,sha256=4JHTRxMvUcpoZNBah2ZEWTZF6KarEi6M51kSBdw-BMQ,10612
5
4
  plain/dev/contribute/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
6
- plain/dev/contribute/cli.py,sha256=qZ7YmE_upbw-Y5NRpvaHnJTPp9kvn21fPQ7G0n1LAkg,2277
5
+ plain/dev/contribute/cli.py,sha256=vrHSYM0Y2XtIUbxmNcJqssoPN-ZbkH4T_p65NVkYrV4,2339
7
6
  plain/dev/db/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
8
7
  plain/dev/db/cli.py,sha256=058HjRKLGz-FxauQEpwsPoh_LCiy-_NEIpRZl9W1ZKM,2855
9
8
  plain/dev/db/container.py,sha256=RlPJU_CCMKA-zN8Kp0sYAu3jabOizxYAj8fSCsjCf60,5147
@@ -21,14 +20,14 @@ plain/dev/poncho/printer.py,sha256=KSkSXx6KiejekJ9e4bzutIAIL8oZPDGimtVHNRJyFbQ,2
21
20
  plain/dev/poncho/process.py,sha256=JJOKy-C6vMCg7-6JMCtu6C649h7HmOBSJqDP_hnX49I,2637
22
21
  plain/dev/precommit/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
23
22
  plain/dev/precommit/cli.py,sha256=UNrQmWRKrkZ6WbzrrcnjZl8VHwNorOVTHGoRQsR4jp8,3422
24
- plain/dev/requests.py,sha256=0HyCH7iZ32ne94ypMdE96z5iYb_Qbd705WItVik1SyA,6839
23
+ plain/dev/requests.py,sha256=v4ucDL8d6I0s5kF8O8HRvSc6Snq1Z_SMQv7wGGAI_Us,6847
25
24
  plain/dev/services.py,sha256=XwtMpTjyZzEB8RVgjRuW9PRMQSTuhUAN-zY4Kl_kSZY,2059
26
25
  plain/dev/templates/dev/requests.html,sha256=kQKJZq5L77juuL_t8UjcAehEU61U4RXNnKaAET-wAm8,7627
27
26
  plain/dev/urls.py,sha256=b4NL2I6Ok-t7nTPjRnKoz_LQRttE3_mp8l2NlmeYQ9I,146
28
27
  plain/dev/utils.py,sha256=4wMzpvj1Is_c0QxhsTu34_P9wAYlzw4glNPfVtZr_0A,123
29
28
  plain/dev/views.py,sha256=r2Ivk7OXytpRhXq4DZpsb7FXNP9vzmEE3D5kLajYG4w,1073
30
- plain_dev-0.13.0.dist-info/LICENSE,sha256=YDg-l_Rj7LVP5uDXy04eQPGb_DYVXAHAHYd9r3pU1Cg,2713
31
- plain_dev-0.13.0.dist-info/METADATA,sha256=6EtnSY-Be2p9DZNOB5nactlYNSpUl5z09ACD42ywjyM,4722
32
- plain_dev-0.13.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
33
- plain_dev-0.13.0.dist-info/entry_points.txt,sha256=1FaE_73k95WYOJrmB0hcHBnEIFQa-Cfl56Z1LGxyvak,164
34
- plain_dev-0.13.0.dist-info/RECORD,,
29
+ plain_dev-0.14.1.dist-info/LICENSE,sha256=YDg-l_Rj7LVP5uDXy04eQPGb_DYVXAHAHYd9r3pU1Cg,2713
30
+ plain_dev-0.14.1.dist-info/METADATA,sha256=3O2OFs2HpjrG8Iv3U6CAJYJAR9yCk7Q2j6-lcRvp7gw,4722
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,,
plain/dev/config.py DELETED
@@ -1,20 +0,0 @@
1
- import importlib
2
- from pathlib import Path
3
-
4
- from plain.packages import PackageConfig
5
- from plain.runtime import settings
6
-
7
-
8
- class Config(PackageConfig):
9
- name = "plain.dev"
10
-
11
- def ready(self):
12
- # Symlink the plain package into .plain so we can look at it easily
13
- plain_path = Path(
14
- importlib.util.find_spec("plain.runtime").origin
15
- ).parent.parent
16
- if not settings.PLAIN_TEMP_PATH.exists():
17
- settings.PLAIN_TEMP_PATH.mkdir()
18
- src_path = settings.PLAIN_TEMP_PATH / "src"
19
- if plain_path.exists() and not src_path.exists():
20
- src_path.symlink_to(plain_path)