Total Complexity | 1 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | """ |
||
2 | byceps.cli.command.shell |
||
3 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
||
4 | |||
5 | Run an interactive Python shell in the context of the BYCEPS application. |
||
6 | |||
7 | :Copyright: 2014-2024 Jochen Kupperschmidt |
||
8 | :License: Revised BSD (see `LICENSE` file for details) |
||
9 | """ |
||
10 | |||
11 | from platform import python_version |
||
12 | |||
13 | import bpython |
||
14 | import click |
||
15 | from flask import current_app |
||
16 | from flask.cli import with_appcontext |
||
17 | |||
18 | |||
19 | @click.command() |
||
20 | @with_appcontext |
||
21 | def shell() -> None: |
||
22 | """Run interactive Python shell.""" |
||
23 | ctx = current_app.make_shell_context() |
||
24 | banner = ( |
||
25 | f'Welcome to the interactive BYCEPS shell on Python {python_version()}!' |
||
26 | ) |
||
27 | |||
28 | bpython.embed(locals_=ctx, banner=banner) |
||
29 |