Enhance Flask development workflow with powerful CLI commands for inspecting application.
Project description
Flask-CLI-Extend
Enhance Flask development workflow with powerful CLI commands for inspecting application.
Why this Plugin?
While Flask provides a robust framework for building web applications, the default CLI tools can sometimes be limited for developers who need to quickly inspect the structure and configuration of their application. This extension aims to fill that gap by providing clear, concise, and colorful outputs for commonly needed information, such as registered blueprints, URL routes, and application configurations. This helps to improve developer productivity and makes debugging and introspection easier.
Installation
pip install flask-cli-extend
Configuration
You can customize the behavior of this extension by setting the following variables in your Flask application's configuration file (e.g., config.py).
FLASK_CLI_EXTEND_TABLE_COLORS
This variable allows you to customize the colors of the output tables.
Type: list[str]
Default: ["yellow", "cyan", "green", "blue", "magenta"]
Available colors: click Supported color.
Example:
FLASK_CLI_EXTEND_TABLE_COLORS = ["red", "blue"]
FLASK_CLI_EXTEND_SENSITIVE_CONFIG_KEYS
This variable allows you to add to the list of sensitive keys that should be masked in the output of the flask configs command.
Type: list[str]
Default: ["SECRET", "KEY", "PASSWORD", "TOKEN"]
Example:
FLASK_CLI_EXTEND_SENSITIVE_CONFIG_KEYS = ["URI", "PWD"]
Usage
Once installed, the new commands will be available through the flask command.
flask blueprints
Displays information about registered Flask blueprints.
Options:
--sort,-s: Sorts the blueprints by name.
Output:
The command outputs a table with the following columns:
- Name: The name of the blueprint.
- Import Name: The import name of the blueprint.
- Relative Path: The relative path to the blueprint's root.
- URL Prefix: The URL prefix for the blueprint.
- Subdomain: The subdomain for the blueprint (if any).
Example output:
Name Import Name Relative Path URL Prefix
-------- --------------- ----------------- ------------
main app.main src/app/main
api app.api src/app/api /api
flask routes
Shows all registered routes with endpoints and methods.
Options:
--sort,-s{endpoint,methods,domain,rule,match}: Method to sort routes by. 'match' is the order that Flask will match routes when dispatching a request.--blueprint,-bTEXT: Show the routes for the blueprint.--all-methods,-A: Show HEAD and OPTIONS methods.
Output:
The command outputs a table with the following columns:
- Endpoint: The endpoint name.
- Methods: The HTTP methods allowed for the route.
- Rule: The URL rule.
- Host / Subdomain: The host or subdomain for the route (if any).
Example output:
Endpoint Methods Rule Host
---------- --------- ------------ ------
main.index GET /
main.about GET /about
api.users GET, POST /api/users
flask configs
Displays application configuration parameters.
Options:
--default,-d: Show default config parameters.--show-sensitive,-S: Show sensitive values.--diff,-D: Show differences between current app and default config settings.--namespace,-nTEXT: Show config parameters that match the specified namespace/prefix.--no-namespace,-NTEXT: Show config parameters excluding those that match the specified namespace/prefix.
Output:
The command outputs a table with the following columns:
- Key: The configuration key.
- Value: The configuration value.
Sensitive values are masked by default.
Example output:
Key Value
---------------- ----------------------
DEBUG False
SECRET_KEY ab0*******
SQLALCHEMY_DB_URI postgresql://...
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the BSD License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_cli_extend-0.1.0.tar.gz.
File metadata
- Download URL: flask_cli_extend-0.1.0.tar.gz
- Upload date:
- Size: 42.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72ffe7600be026ce7e8f8628e00703be235f1f41b67a82dd91ebdc9d27ec37d2
|
|
| MD5 |
240332b2f51cf3332c452102fdd0006c
|
|
| BLAKE2b-256 |
065ba1159c1349584759809e6c0a6367ba80999c16a561ec8058a9f7796654cd
|
Provenance
The following attestation bundles were made for flask_cli_extend-0.1.0.tar.gz:
Publisher:
publish.yaml on curskey/flask-cli-extend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_cli_extend-0.1.0.tar.gz -
Subject digest:
72ffe7600be026ce7e8f8628e00703be235f1f41b67a82dd91ebdc9d27ec37d2 - Sigstore transparency entry: 289550610
- Sigstore integration time:
-
Permalink:
curskey/flask-cli-extend@365f2778eb33eacee58c66994851f5bd7246f346 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/curskey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@365f2778eb33eacee58c66994851f5bd7246f346 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flask_cli_extend-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flask_cli_extend-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bef0872c6d46fce41a63cc2d4d5b0c59d7cff12f4cb2cec7e266dbcdb152341
|
|
| MD5 |
d475024b879118585f98e0484da3735d
|
|
| BLAKE2b-256 |
718c4e117edae9824f84de65ef43c6307d165aeb39c5061ee2d6bb94e697ee8f
|
Provenance
The following attestation bundles were made for flask_cli_extend-0.1.0-py3-none-any.whl:
Publisher:
publish.yaml on curskey/flask-cli-extend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_cli_extend-0.1.0-py3-none-any.whl -
Subject digest:
7bef0872c6d46fce41a63cc2d4d5b0c59d7cff12f4cb2cec7e266dbcdb152341 - Sigstore transparency entry: 289550647
- Sigstore integration time:
-
Permalink:
curskey/flask-cli-extend@365f2778eb33eacee58c66994851f5bd7246f346 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/curskey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@365f2778eb33eacee58c66994851f5bd7246f346 -
Trigger Event:
push
-
Statement type: