plain 0.21.3__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}")
plain/packages/config.py CHANGED
@@ -15,11 +15,11 @@ class PackageConfig:
15
15
  migrations_module = "migrations"
16
16
 
17
17
  def __init__(self, package_name, package_module):
18
- # Full Python path to the application e.g. 'plain.staff.admin'.
18
+ # Full Python path to the application e.g. 'plain.admin.admin'.
19
19
  self.name = package_name
20
20
 
21
- # Root module for the application e.g. <module 'plain.staff.admin'
22
- # from 'staff/__init__.py'>.
21
+ # Root module for the application e.g. <module 'plain.admin.admin'
22
+ # from 'admin/__init__.py'>.
23
23
  self.module = package_module
24
24
 
25
25
  # Reference to the Packages registry that holds this PackageConfig. Set by the
@@ -43,8 +43,8 @@ class PackageConfig:
43
43
  if not hasattr(self, "path"):
44
44
  self.path = self._path_from_module(package_module)
45
45
 
46
- # Module containing models e.g. <module 'plain.staff.models'
47
- # from 'staff/models.py'>. Set by import_models().
46
+ # Module containing models e.g. <module 'plain.admin.models'
47
+ # from 'admin/models.py'>. Set by import_models().
48
48
  # None if the application doesn't have a models module.
49
49
  self.models_module = None
50
50
 
@@ -242,7 +242,7 @@ class Packages:
242
242
  """
243
243
  Check whether an application with this name exists in the registry.
244
244
 
245
- package_name is the full name of the app e.g. 'plain.staff'.
245
+ package_name is the full name of the app e.g. 'plain.admin'.
246
246
  """
247
247
  self.check_packages_ready()
248
248
  return any(ac.name == package_name for ac in self.package_configs.values())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain
3
- Version: 0.21.3
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
@@ -61,8 +61,8 @@ plain/logs/loggers.py,sha256=iz9SYcwP9w5QAuwpULl48SFkVyJuuMoQ_fdLgdCHpNg,2121
61
61
  plain/logs/utils.py,sha256=9UzdCCQXJinGDs71Ngw297mlWkhgZStSd67ya4NOW98,1257
62
62
  plain/packages/README.md,sha256=Vq1Nw3mmEmZ2IriQavuVi4BjcQC2nb8k7YIbnm8QjIg,799
63
63
  plain/packages/__init__.py,sha256=DnHN1wwHXiXib4Y9BV__x9WrbUaTovoTIxW-tVyScTU,106
64
- plain/packages/config.py,sha256=-je13ViDkXMEQXCSi0G539dG5_HPoFBKaK7cBEd_NAY,11070
65
- plain/packages/registry.py,sha256=C1yv-JlzMs4HE-AYam_EdiTKNQwE8IN4qgt22PKxHDE,17920
64
+ plain/packages/config.py,sha256=6j6Y9Uw4Lbye1M7LVgOhL4rAMkSSkleTzHQU9JRBW7k,11070
65
+ plain/packages/registry.py,sha256=WlCGssmtjPss4KhDAyXyEkIUlKtzQcu17c45iqM2bbA,17920
66
66
  plain/preflight/README.md,sha256=-PKVd0RBMh4ROiMkegPS2PgvT1Kq9qqN1KfNkmUSdFc,177
67
67
  plain/preflight/__init__.py,sha256=H-TNRvaddPtOGmv4RXoc1fxDV1AOb7_K3u7ECF8mV58,607
68
68
  plain/preflight/files.py,sha256=wbHCNgps7o1c1zQNBd8FDCaVaqX90UwuvLgEQ_DbUpY,510
@@ -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.3.dist-info/METADATA,sha256=Xt4e1YhLUehsJ9MIYBDJ5RgR0vid8vtDopIxK-VjMZM,319
142
- plain-0.21.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
143
- plain-0.21.3.dist-info/entry_points.txt,sha256=DHHprvufgd7xypiBiqMANYRnpJ9xPPYhYbnPGwOkWqE,40
144
- plain-0.21.3.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
145
- plain-0.21.3.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