plain 0.21.4__py3-none-any.whl → 0.21.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/cli/packages.py CHANGED
@@ -14,10 +14,11 @@ class InstalledPackagesGroup(click.Group):
14
14
  """
15
15
 
16
16
  PLAIN_APPS_PREFIX = "plain."
17
+ APP_PREFIX = "app."
17
18
  MODULE_NAME = "cli"
18
19
 
19
20
  def list_commands(self, ctx):
20
- packages_with_commands = []
21
+ command_names = []
21
22
 
22
23
  # Get installed packages with a cli.py module
23
24
  for app in packages.get_package_configs():
@@ -26,21 +27,37 @@ class InstalledPackagesGroup(click.Group):
26
27
 
27
28
  cli_name = app.name
28
29
 
30
+ # Change plain.{pkg} to just {pkg}
29
31
  if cli_name.startswith(self.PLAIN_APPS_PREFIX):
30
32
  cli_name = cli_name[len(self.PLAIN_APPS_PREFIX) :]
31
33
 
32
- packages_with_commands.append(cli_name)
34
+ # Change app.{pkg} to just {pkg}
35
+ if cli_name.startswith(self.APP_PREFIX):
36
+ cli_name = cli_name[len(self.APP_PREFIX) :]
33
37
 
34
- return packages_with_commands
38
+ if cli_name in command_names:
39
+ raise ValueError(
40
+ f"Duplicate command name {cli_name} found in installed packages."
41
+ )
42
+
43
+ command_names.append(cli_name)
44
+
45
+ return command_names
35
46
 
36
47
  def get_command(self, ctx, name):
37
- # Try it as plain.x and just x (we don't know ahead of time which it is, but prefer plain.x)
38
- for n in [self.PLAIN_APPS_PREFIX + name, name]:
39
- if not find_spec(n):
40
- # plain.<name> doesn't exist at all
48
+ # Try it as plain.x, app.x, and just x (we don't know ahead of time which it is)
49
+ for n in [self.PLAIN_APPS_PREFIX + name, self.APP_PREFIX + name, name]:
50
+ try:
51
+ if not find_spec(n):
52
+ # plain.<name> doesn't exist at all
53
+ continue
54
+ except ModuleNotFoundError:
41
55
  continue
42
56
 
43
- if not find_spec(f"{n}.{self.MODULE_NAME}"):
57
+ try:
58
+ if not find_spec(f"{n}.{self.MODULE_NAME}"):
59
+ continue
60
+ except ModuleNotFoundError:
44
61
  continue
45
62
 
46
63
  cli = importlib.import_module(f"{n}.{self.MODULE_NAME}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain
3
- Version: 0.21.4
3
+ Version: 0.21.5
4
4
  Summary: A web framework for building products with Python.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-File: LICENSE
@@ -18,7 +18,7 @@ plain/cli/README.md,sha256=TvWCnNwb1rNthPzJglCRMKacN5H_RLeEjYBMe62Uz4M,2461
18
18
  plain/cli/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
19
19
  plain/cli/cli.py,sha256=UNWIVnx2r2qn-eZejh2F_UA9C80HDNFysDd1rAWh2K4,14593
20
20
  plain/cli/formatting.py,sha256=1hZH13y1qwHcU2K2_Na388nw9uvoeQH8LrWL-O9h8Yc,2207
21
- plain/cli/packages.py,sha256=FqRJaizaxpQ8lSS4nYNjqIGpYGDbeTmCXCvkGxusGOM,2160
21
+ plain/cli/packages.py,sha256=TiLirp0ccj5K96jOfp_pS18rOnk1aQS9ckiTi27aRwE,2740
22
22
  plain/cli/print.py,sha256=XraUYrgODOJquIiEv78wSCYGRBplHXtXSS9QtFG5hqY,217
23
23
  plain/cli/startup.py,sha256=3LIz9JrIZoF52Sa0j0SCypQwEaBDkhvuGaBdtiQLr5Q,680
24
24
  plain/csrf/README.md,sha256=RXMWMtHmzf30gVVNOfj0kD4xlSqFIPgJh-n7dIciaEM,163
@@ -138,8 +138,8 @@ plain/views/forms.py,sha256=RhlaUcZCkeqokY_fvv-NOS-kgZAG4XhDLOPbf9K_Zlc,2691
138
138
  plain/views/objects.py,sha256=g5Lzno0Zsv0K449UpcCtxwCoO7WMRAWqKlxxV2V0_qg,8263
139
139
  plain/views/redirect.py,sha256=KLnlktzK6ZNMTlaEiZpMKQMEP5zeTgGLJ9BIkIJfwBo,1733
140
140
  plain/views/templates.py,sha256=nF9CcdhhjAyp3LB0RrSYnBaHpHzMfPSw719RCdcXk7o,2007
141
- plain-0.21.4.dist-info/METADATA,sha256=vkgTcZHb7c8a8ks2-AjrBiYsRwKY-ZJ4K5gYUM8_Nfc,319
142
- plain-0.21.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
143
- plain-0.21.4.dist-info/entry_points.txt,sha256=DHHprvufgd7xypiBiqMANYRnpJ9xPPYhYbnPGwOkWqE,40
144
- plain-0.21.4.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
145
- plain-0.21.4.dist-info/RECORD,,
141
+ plain-0.21.5.dist-info/METADATA,sha256=0oF_0zeaLk49ni4P08nQzXF_3biuj_9pLd2TO68BLeA,319
142
+ plain-0.21.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
143
+ plain-0.21.5.dist-info/entry_points.txt,sha256=DHHprvufgd7xypiBiqMANYRnpJ9xPPYhYbnPGwOkWqE,40
144
+ plain-0.21.5.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
145
+ plain-0.21.5.dist-info/RECORD,,
File without changes