Registry / web-framework / flask
library3.1.3pypypi✓ verified 10d ago

Flask is a lightweight WSGI web application framework in Python, designed with simplicity and flexibility in mind. The current version is 3.1.3, released on March 28, 2026, following a regular release cadence with feature and fix updates as needed.

pip install flask
INSTALL
IMPORT
SIG · FLASK
F
flask
web-frameworkpythonv3.1.3
Install
2.5s avg
Import
473ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.498s · 22.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.5s · import 0.448s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Flask
from flask import Flask
Ensure 'flask' is installed in your environment; otherwise, you'll encounter an ImportError.
render_template
from flask import render_template
Used for rendering HTML templates; requires Jinja2.
request
from flask import request
Provides access to request data; ensure 'werkzeug' is installed.

A minimal Flask application that renders an 'index.html' template when accessing the root URL.

from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') if __name__ == '__main__': app.run(debug=True)
flask --version
Debug
Known issues
breakingFlask 3.1.3 includes a security fix that may affect session behavior. Review the release notes for details.
fix
Update your Flask application to handle session changes introduced in version 3.1.3.
affects: 3.1.3
gotchaRelative imports can cause issues if not used correctly. Ensure your project structure supports them to avoid ImportError.
fix
Use absolute imports or adjust your project structure to support relative imports properly.
affects: All
breakingThe application experienced a timeout during testing. This can be caused by infinite loops, deadlocks, resource exhaustion, or long-running operations that exceed the test runner's timeout threshold.
fix
Review application logs for clues about activity before the timeout. Use a debugger to identify infinite loops or deadlocks. Optimize long-running operations or increase the test runner's timeout setting if appropriate. Check for resource leaks or excessive memory/CPU usage.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'flask'
The Flask library is not installed in the Python environment where the code is being executed, or the wrong Python interpreter/virtual environment is active.
fix
Install Flask using pip: `pip install Flask`. If using a virtual environment, ensure it is activated before installation.
RuntimeError: Working outside of application context
This error occurs when Flask functionality that relies on an active application context (like `current_app`, `g`, or database operations with extensions like Flask-SQLAlchemy) is accessed outside of a request or CLI command.
fix
Manually push an application context using `with app.app_context():` around the code block that requires it.
TypeError: The view function did not return a valid response
A Flask view function must return a valid response object, string, tuple, or an instance of `werkzeug.exceptions.HTTPException`. This error occurs when the function implicitly returns `None` or ends without an explicit return statement.
fix
Ensure that every execution path within a view function explicitly returns a valid Flask response, such as a string, a `render_template()` call, a `jsonify()` response, or a tuple like `('Error message', 400)`.
Method Not Allowed (405 Error)
The HTTP method used in the client's request (e.g., POST, PUT, DELETE) is not permitted for the requested URL by the Flask route definition. By default, Flask routes only accept GET requests.
fix
Explicitly specify the allowed HTTP methods in the route decorator using the `methods` argument: `@app.route('/my_route', methods=['GET', 'POST'])`.
Upgrade
Version history
3.1.3latest on PyPI · released Feb 19, 2026
Audit
Dependencies
werkzeugrequiredProvides WSGI utilities and functions for Flask
jinja2requiredTemplate engine for rendering HTML in Flask
itsdangerousrequiredProvides cryptographic signing for Flask
clickrequiredCommand-line interface toolkit for Flask
Agent activity
14 hits · last 30 days
node
12
Meta
1
Resources
flask — pip install flask · libregistry