plain 0.8.1__py3-none-any.whl → 0.10.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/runtime/__init__.py CHANGED
@@ -1,10 +1,8 @@
1
1
  import importlib.metadata
2
2
  import sys
3
- from os import environ
3
+ from importlib.metadata import entry_points
4
4
  from pathlib import Path
5
5
 
6
- from dotenv import load_dotenv
7
-
8
6
  from .user_settings import Settings
9
7
 
10
8
  try:
@@ -16,7 +14,6 @@ except importlib.metadata.PackageNotFoundError:
16
14
  # Made available without setup or settings
17
15
  APP_PATH = Path.cwd() / "app"
18
16
 
19
-
20
17
  # from plain.runtime import settings
21
18
  settings = Settings()
22
19
 
@@ -30,6 +27,11 @@ def setup():
30
27
  Configure the settings (this happens as a side effect of accessing the
31
28
  first setting), configure logging and populate the app registry.
32
29
  """
30
+
31
+ # Packages can hook into the setup process through an entrypoint.
32
+ for entry_point in entry_points().select(group="plain.setup"):
33
+ entry_point.load()()
34
+
33
35
  from plain.logs import configure_logging
34
36
  from plain.packages import packages
35
37
 
@@ -38,15 +40,11 @@ def setup():
38
40
  "No app directory found. Are you sure you're in a Plain project?"
39
41
  )
40
42
 
41
- # Automatically put the app dir on the Python path for convenience
42
- if APP_PATH not in sys.path:
43
- sys.path.insert(0, APP_PATH.as_posix())
44
-
45
- # Load .env files automatically before settings
46
- if app_env := environ.get("PLAIN_ENV", ""):
47
- load_dotenv(f".env.{app_env}")
48
- else:
49
- load_dotenv(".env")
43
+ # Automatically put the project dir on the Python path
44
+ # which doesn't otherwise happen when you run `plain` commands.
45
+ # This makes "app.<module>" imports and relative imports work.
46
+ if APP_PATH.parent not in sys.path:
47
+ sys.path.insert(0, APP_PATH.parent.as_posix())
50
48
 
51
49
  configure_logging(settings.LOGGING)
52
50
 
@@ -59,7 +59,7 @@ SECRET_KEY: str
59
59
  # secret key rotation.
60
60
  SECRET_KEY_FALLBACKS: list[str] = []
61
61
 
62
- ROOT_URLCONF = "urls"
62
+ ROOT_URLCONF = "app.urls"
63
63
 
64
64
  # List of upload handler classes to be applied in order.
65
65
  FILE_UPLOAD_HANDLERS = [
@@ -41,7 +41,7 @@ class Settings:
41
41
 
42
42
  # Determine the settings module
43
43
  if self._settings_module is None:
44
- self._settings_module = os.environ.get(ENVIRONMENT_VARIABLE, "settings")
44
+ self._settings_module = os.environ.get(ENVIRONMENT_VARIABLE, "app.settings")
45
45
 
46
46
  # First load the global settings from plain
47
47
  self._load_module_settings(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plain
3
- Version: 0.8.1
3
+ Version: 0.10.0
4
4
  Summary: A web framework for building products with Python.
5
5
  Author: Dave Gaeddert
6
6
  Author-email: dave.gaeddert@dropseed.dev
@@ -11,7 +11,6 @@ Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
12
  Requires-Dist: click (>=8.0.0)
13
13
  Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
14
- Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
15
14
  Description-Content-Type: text/markdown
16
15
 
17
16
  <!-- This file is compiled from plain/plain/README.md. Do not edit this file directly. -->
@@ -70,9 +70,9 @@ plain/preflight/security/base.py,sha256=nsv-g-bFr_188mkOQwC1ZDnyS0rE6eZED8xZT-FE
70
70
  plain/preflight/security/csrf.py,sha256=8dKzs5kQwTTKeyfHbkrzdPk3OEoUN8mc-0xhSBo1KmM,1175
71
71
  plain/preflight/urls.py,sha256=O4PQ_v205VA2872fQlhPfxaihDDRCsVp0ZVKQ92aX4k,3019
72
72
  plain/runtime/README.md,sha256=Q8VVO7JRGuYrDxzuYL6ptoilhclbecxKzpRXKgbWGkU,2061
73
- plain/runtime/__init__.py,sha256=vIh77lL4e5CoQZz-HxvXeJL5329s8VfPFpNxx9rHgxs,1384
74
- plain/runtime/global_settings.py,sha256=3SLuQjPAHFv5F6QJBiuVy41yxsAoI446Rp4FoK8_A6o,5434
75
- plain/runtime/user_settings.py,sha256=JhxmCCOmEMk0QHh82l5iTpEie-UdZh13aXGsLhE5PBw,11255
73
+ plain/runtime/__init__.py,sha256=DH8TwKTGJhjviOy4yh_d051v8YGaAWMlFBPhK8ZuC9g,1499
74
+ plain/runtime/global_settings.py,sha256=SeW8vVk4rOQyABhRa_5USe8ru_ZDhyiNYz0yhGx0blg,5438
75
+ plain/runtime/user_settings.py,sha256=-1xXUggueuOF3YlgnLfeyG55CUvR3azOGWr2UkTOmfs,11259
76
76
  plain/signals/README.md,sha256=cd3tKEgH-xc88CUWyDxl4-qv-HBXx8VT32BXVwA5azA,230
77
77
  plain/signals/__init__.py,sha256=eAs0kLqptuP6I31dWXeAqRNji3svplpAV4Ez6ktjwXM,131
78
78
  plain/signals/dispatch/__init__.py,sha256=FzEygqV9HsM6gopio7O2Oh_X230nA4d5Q9s0sUjMq0E,292
@@ -141,8 +141,8 @@ plain/views/objects.py,sha256=9QBYyb8PgkRirXCQ8-Pms4_yMzP37dfeL30hWRYmtZg,7909
141
141
  plain/views/redirect.py,sha256=KLnlktzK6ZNMTlaEiZpMKQMEP5zeTgGLJ9BIkIJfwBo,1733
142
142
  plain/views/templates.py,sha256=nF9CcdhhjAyp3LB0RrSYnBaHpHzMfPSw719RCdcXk7o,2007
143
143
  plain/wsgi.py,sha256=R6k5FiAElvGDApEbMPTT0MPqSD7n2e2Az5chQqJZU0I,236
144
- plain-0.8.1.dist-info/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
145
- plain-0.8.1.dist-info/METADATA,sha256=IYwJiO41pD4qRMlpvuecs8ggbM-cQh3l3ohjjo7KJs4,2767
146
- plain-0.8.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
147
- plain-0.8.1.dist-info/entry_points.txt,sha256=7O1RZTmMasKYB73bfqQcTwIhsXo7RjEIKv2WbtTtOIM,39
148
- plain-0.8.1.dist-info/RECORD,,
144
+ plain-0.10.0.dist-info/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
145
+ plain-0.10.0.dist-info/METADATA,sha256=SwlNbU7qUpXXojHWCorLfkK8RYYI03YyVPgfv3Y19yY,2722
146
+ plain-0.10.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
147
+ plain-0.10.0.dist-info/entry_points.txt,sha256=7O1RZTmMasKYB73bfqQcTwIhsXo7RjEIKv2WbtTtOIM,39
148
+ plain-0.10.0.dist-info/RECORD,,
File without changes