muffin 1.0.1__py3-none-any.whl → 1.1.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.
muffin/manage.py CHANGED
@@ -57,9 +57,7 @@ class Manager:
57
57
  def __init__(self, app: "Application"):
58
58
  """Initialize the manager."""
59
59
  self.app = app
60
- self.parser = argparse.ArgumentParser(
61
- description="Manage %s" % app.cfg.name.capitalize(),
62
- )
60
+ self.parser = argparse.ArgumentParser(description="Manage %s" % app.cfg.name.capitalize())
63
61
 
64
62
  if len(AIOLIBS) > 1:
65
63
  self.parser.add_argument(
@@ -141,7 +139,7 @@ class Manager:
141
139
  def __call__(self, fn=None, *, lifespan=False): # noqa: C901
142
140
  """Register a command."""
143
141
 
144
- def wrapper(fn): # noqa: PLR0912, C901
142
+ def wrapper(fn): # noqa: C901, PLR0912
145
143
  if not inspect.iscoroutinefunction(fn) and lifespan:
146
144
  raise AsyncRequiredError(fn)
147
145
 
@@ -155,7 +153,9 @@ class Manager:
155
153
  self.app.logger.warning("Command %s already registered", command_name)
156
154
  return fn
157
155
 
158
- parser = self.subparsers.add_parser(command_name, description=description)
156
+ parser = self.subparsers.add_parser(
157
+ command_name, description=description, help=description
158
+ )
159
159
  sig = inspect.signature(fn)
160
160
  docs = dict(PARAM_RE.findall(fn.__doc__ or ""))
161
161
 
@@ -281,8 +281,13 @@ def cli():
281
281
  try:
282
282
  app = import_app(args_.app)
283
283
  app.logger.info("Application is loaded: %s", app.cfg.name)
284
- app.manage.run(*subargs_, prog="muffin %s" % args_.app)
285
284
 
285
+ except ImportError:
286
+ logging.exception("Failed to import application")
287
+ return sys.exit(1)
288
+
289
+ try:
290
+ app.manage.run(*subargs_, prog="muffin %s" % args_.app)
286
291
  except Exception:
287
292
  logging.exception("Command failed")
288
293
  return sys.exit(1)
@@ -290,4 +295,4 @@ def cli():
290
295
  sys.exit(0)
291
296
 
292
297
 
293
- # ruff: noqa: T100
298
+ # ruff: noqa: T100, LOG015
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: muffin
3
- Version: 1.0.1
3
+ Version: 1.1.0
4
4
  Summary: Muffin is a fast, simple and asyncronous web-framework for Python 3 (asyncio, trio, curio)
5
5
  License: MIT
6
6
  Keywords: asgi,web,web framework,asyncio,trio,curio
@@ -55,6 +55,8 @@ Description-Content-Type: text/x-rst
55
55
 
56
56
  ----------
57
57
 
58
+ .. _description:
59
+
58
60
  Why Muffin?
59
61
  -----------
60
62
 
@@ -69,6 +71,8 @@ Key Features
69
71
  - Multiple response types: text, HTML, JSON, streams, files, SSE, WebSockets
70
72
  - First-class plugin system for templating, databases, auth, and more
71
73
 
74
+ .. _installation:
75
+
72
76
  Installation
73
77
  ------------
74
78
 
@@ -97,6 +101,8 @@ These packages will be installed automatically:
97
101
  .. _ASGI-Tools: https://klen.github.io/asgi-tools/
98
102
  .. _Modconfig: https://pypi.org/project/modconfig/
99
103
 
104
+ .. _quickstart:
105
+
100
106
  Quickstart
101
107
  ----------
102
108
 
@@ -121,6 +127,8 @@ Save this as `example.py` and run:
121
127
 
122
128
  Visit http://localhost:8000 or http://localhost:8000/hello/username in your browser.
123
129
 
130
+ .. _plugins:
131
+
124
132
  Plugins
125
133
  -------
126
134
 
@@ -141,11 +149,15 @@ Muffin has a rich ecosystem of plugins:
141
149
 
142
150
  See each repo for usage and installation instructions.
143
151
 
152
+ .. _benchmarks:
153
+
144
154
  Benchmarks
145
155
  ----------
146
156
 
147
157
  Performance comparisons are available at: http://klen.github.io/py-frameworks-bench/
148
158
 
159
+ .. _links:
160
+
149
161
  Bug tracker
150
162
  -----------
151
163
 
@@ -3,13 +3,13 @@ muffin/app.py,sha256=6gPJUhWn9QSdzSwIl_8eP1uwOGaFIkHI-aXQrYwU1gY,5318
3
3
  muffin/constants.py,sha256=Ga1UJiEdXUk6dIEH_IEVYkFSZxQFPhxie7fCJwQY8V0,71
4
4
  muffin/errors.py,sha256=I-vKbMMBiMU07zPdKvoJKqA7s4xYAUA-4oZXrRMRzcM,701
5
5
  muffin/handler.py,sha256=_cvF0TV87YH5_ZDnwgsks-h_e0yI14P27j4HG5tWanc,3673
6
- muffin/manage.py,sha256=g4DilPjOyXyUcAiNs0m31BSikkvsmGkMZCZcOb0cnuQ,9511
6
+ muffin/manage.py,sha256=bXJqQf0pHjtgn3lyKqcvP9SBlh67v5vhQE3oZopF5JY,9663
7
7
  muffin/plugins.py,sha256=fGIocty5hHGTTY3zQrYBvkXjETlLndqRwAe5jmpyi3I,3417
8
8
  muffin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  muffin/pytest.py,sha256=51pJ-JJ2vwqiPhR9TPqXvT78X35l3v3oEkN5LBnfY8E,2679
10
10
  muffin/types.py,sha256=wsUj5oAfqSZMoEf-wyFJLBlWa8Mc-eJGqKLr02HxuXE,153
11
11
  muffin/utils.py,sha256=O3JXRkFyDlZ3kJZeaHz2WHMTY6-lvHGDu7qFy0x8Zls,2896
12
- muffin-1.0.1.dist-info/METADATA,sha256=d-OFvchOz41_JjiD6I2-tbdFluwNpROG1c0baK-8osg,6146
13
- muffin-1.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
- muffin-1.0.1.dist-info/entry_points.txt,sha256=GvPS3M-tNVPzhUS5jnUpOmWw2NAqedY34VRCYgPYzlM,84
15
- muffin-1.0.1.dist-info/RECORD,,
12
+ muffin-1.1.0.dist-info/METADATA,sha256=gq18wriPaxEZAy8-EOpKeXEdyzFwBwkklgzZ2OIh9rk,6243
13
+ muffin-1.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
+ muffin-1.1.0.dist-info/entry_points.txt,sha256=GvPS3M-tNVPzhUS5jnUpOmWw2NAqedY34VRCYgPYzlM,84
15
+ muffin-1.1.0.dist-info/RECORD,,
File without changes