muffin 1.1.0__py3-none-any.whl → 1.1.2__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
@@ -86,7 +86,7 @@ class Manager:
|
|
86
86
|
|
87
87
|
# We have to use sync mode here because of eventloop conflict with ipython/promt-toolkit
|
88
88
|
def shell(*, ipython: bool = True):
|
89
|
-
"""Start the application
|
89
|
+
"""Start an interactive shell with the application context.
|
90
90
|
|
91
91
|
:param ipython: Use IPython as a shell
|
92
92
|
"""
|
@@ -108,7 +108,7 @@ class Manager:
|
|
108
108
|
self(shell)
|
109
109
|
|
110
110
|
def run(host: str = "localhost", port: int = 5000):
|
111
|
-
"""
|
111
|
+
"""Run the application with the given host and port."""
|
112
112
|
from uvicorn.main import run as urun
|
113
113
|
|
114
114
|
cfg = self.app.cfg
|
@@ -235,6 +235,14 @@ class Manager:
|
|
235
235
|
if prog:
|
236
236
|
self.parser.prog = prog
|
237
237
|
|
238
|
+
# Sort subparsers by name
|
239
|
+
choices_actions = getattr(self.subparsers, "_choices_actions", None)
|
240
|
+
if choices_actions:
|
241
|
+
sorted_actions = sorted(choices_actions, key=lambda a: a.dest)
|
242
|
+
choices_actions.clear()
|
243
|
+
choices_actions.extend(sorted_actions)
|
244
|
+
self.subparsers.metavar = "{" + ",".join(a.dest for a in sorted_actions) + "}"
|
245
|
+
|
238
246
|
ns, _ = self.parser.parse_known_args(args or sys.argv[1:])
|
239
247
|
kwargs = dict(ns._get_kwargs())
|
240
248
|
fn = self.commands.get(kwargs.pop("subparser"))
|
@@ -245,7 +253,11 @@ class Manager:
|
|
245
253
|
self.parser.print_help()
|
246
254
|
sys.exit(1)
|
247
255
|
|
248
|
-
pargs =
|
256
|
+
pargs = []
|
257
|
+
sig = inspect.signature(fn)
|
258
|
+
for name, param in sig.parameters.items():
|
259
|
+
if param.kind == param.VAR_POSITIONAL:
|
260
|
+
pargs.extend(kwargs.pop(name, []))
|
249
261
|
|
250
262
|
if not inspect.iscoroutinefunction(fn):
|
251
263
|
return fn(*pargs, **kwargs)
|
@@ -282,7 +294,7 @@ def cli():
|
|
282
294
|
app = import_app(args_.app)
|
283
295
|
app.logger.info("Application is loaded: %s", app.cfg.name)
|
284
296
|
|
285
|
-
except ImportError:
|
297
|
+
except (ImportError, ModuleNotFoundError):
|
286
298
|
logging.exception("Failed to import application")
|
287
299
|
return sys.exit(1)
|
288
300
|
|
@@ -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=
|
6
|
+
muffin/manage.py,sha256=NWtjR8NfJ6O7-K3xZe2yWOmFO_ZUIyYO4VTGq20KWso,10295
|
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.1.
|
13
|
-
muffin-1.1.
|
14
|
-
muffin-1.1.
|
15
|
-
muffin-1.1.
|
12
|
+
muffin-1.1.2.dist-info/METADATA,sha256=Ot4Jz08JJA-E7osf0u8d3qkI4lVCOcxCLE52pEoUDyk,6243
|
13
|
+
muffin-1.1.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
14
|
+
muffin-1.1.2.dist-info/entry_points.txt,sha256=GvPS3M-tNVPzhUS5jnUpOmWw2NAqedY34VRCYgPYzlM,84
|
15
|
+
muffin-1.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|