Skip to main content

An improved shell command for the Flask CLI

Project description

Latest PyPI version Travis-CI Code style: Black

Flask-Konch

An 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 prompt

Flask-Konch uses konch, a shell configuration utility, under the hood.

Get it now

pip install flask-konch

Usage

To run the shell:

export FLASK_APP=path/to/app.py
flask konch

To add additional variables to the shell context:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-konch-2.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

flask_konch-2.0.0-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file flask-konch-2.0.0.tar.gz.

File metadata

  • Download URL: flask-konch-2.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.3

File hashes

Hashes for flask-konch-2.0.0.tar.gz
Algorithm Hash digest
SHA256 bda277e071c09161bb67e8081ce280a5b5738a6df7c577a15f771c6f88284422
MD5 015e2f2864720816d47c32a6ae1d501f
BLAKE2b-256 bc5764a48843e35e3e8fcce36530eebe1ef1b588c430d452d8e99f13044e1834

See more details on using hashes here.

Provenance

File details

Details for the file flask_konch-2.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: flask_konch-2.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.3

File hashes

Hashes for flask_konch-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 49cda035f89593a5e5f7389ec84cfb5d1efa66eef6011d552b5492fbba936e10
MD5 8d01b530af21031447da71160a1d53d6
BLAKE2b-256 dc2bf1f7f37643773bd31e5ef5d73a26f6368e3163c5cd93784203472e6585b9

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page