muffin 1.0.2__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.2
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
@@ -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.2.dist-info/METADATA,sha256=tEGhvBFJLjkE-B0BKoGWk6D9dgHLM1GxW1wA_Ci0-QI,6243
13
- muffin-1.0.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
- muffin-1.0.2.dist-info/entry_points.txt,sha256=GvPS3M-tNVPzhUS5jnUpOmWw2NAqedY34VRCYgPYzlM,84
15
- muffin-1.0.2.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