Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sloria/flask-konch
An improved shell command for the Flask CLI
https://github.com/sloria/flask-konch
cli flask python repl shell
Last synced: 2 days ago
JSON representation
An improved shell command for the Flask CLI
- Host: GitHub
- URL: https://github.com/sloria/flask-konch
- Owner: sloria
- License: mit
- Created: 2016-06-02T02:54:49.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T20:07:02.000Z (3 months ago)
- Last Synced: 2024-10-29T15:17:26.652Z (about 2 months ago)
- Topics: cli, flask, python, repl, shell
- Language: Python
- Size: 85 KB
- Stars: 69
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
***********
Flask-Konch
***********|pypi-package| |build-status|
.. image:: https://github.com/sloria/flask-konch/assets/2379650/9f6b0518-50d3-422f-af63-17c61f7eb7d8
:alt: Flask-Konch screenshotAn improved shell command for Flask
===================================Flask-Konch adds an improved shell command, ``flask konch``, to the `Flask CLI `_.
Benefits of ``flask konch`` over ``flask shell``
================================================- Uses IPython, BPython, or ptpython if available, and falls back to built-in interpreter
- Automatically imports top-level Flask functions and classes by default
- Define additional variables to include in the shell context
- Configurable banner and promptFlask-Konch uses `konch `_, a shell configuration utility, under the hood.
Get it now
==========
::pip install flask-konch
Usage
=====To run the shell:
.. code-block:: bash
export FLASK_APP=path/to/app.py
flask konchTo add additional variables to the shell context:
.. code-block:: python
app = Flask(__name__)
app.config.update({"KONCH_CONTEXT": {"db": database, "User": User}})Configuration options
=====================- ``KONCH_FLASK_IMPORTS``: Whether to automatically import top-level Flask functions and classes. Defaults to ``True``.
- ``KONCH_FLASK_SHELL_CONTEXT``: Whether to automatically import Flask shell context, as registered by `shell_context_processor(f) `_. Defaults to ``True``.
- ``KONCH_CONTEXT``: Dictionary of additional variables to include in the shell context.
- ``KONCH_SHELL``: May be ``'ipy'``, ``'bpy'``, ``'ptpy'``, ``'ptipy'``, ``'py'``, or ``'auto'`` (default).
- ``KONCH_BANNER``: Custom banner.
- ``KONCH_PROMPT``: Custom input prompt.
- ``KONCH_OUTPUT``: Custom output prompt.
- ``KONCH_CONTEXT_FORMAT``: Format to display shell context. May be ``'full'``, ``'short'``, or a function that receives the context dictionary as input and returns a string.
- ``KONCH_IPY_AUTORELOAD``: Whether to load and enable the IPython autoreload extension (must be using ``ipython`` shell).
- ``KONCH_IPY_EXTENSIONS``: List of IPython extension names to load (must be using ``ipython`` shell).
- ``KONCH_IPY_COLORS``: IPython color style.
- ``KONCH_IPY_HIGHLIGHTING_STYLE``: IPython code highlighting style.
- ``KONCH_PTPY_VI_MODE``: Enable vi mode (must be using ``ptpython`` shell).License
=======MIT licensed. See the bundled `LICENSE `_ file for more details.
.. |pypi-package| image:: https://badgen.net/pypi/v/flask-konch
:target: https://pypi.org/project/flask-konch/
:alt: Latest PyPI version
.. |build-status| image:: https://github.com/sloria/flask-konch/actions/workflows/build-release.yml/badge.svg
:target: https://github.com/sloria/flask-konch/actions/workflows/build-release.yml
:alt: Build status