Skip to main content

Easy decorators for deprecating flask views and blueprints

Project description

Flask-Deprecate Documentation Status

Easy decorators for deprecating flask views and blueprints


from flask import Flask, Response

from flask_deprecate import deprecate_view

app = Flask('myapp')

@deprecate_view("Don't use this!")
def myroute():
    return Response()

An HTTP compliant “Warning” header is injected indicating the route is deprecated and optionally providing an upgrade path.

You can also deprecate an entire blueprint in favor of a new one

from flask import Flask, Response, Blueprint

from flask_deprecate import deprecate_blueprint

old_bp = Blueprint('old', 'old', url_prefix='/v1')
new_bp = Blueprint('new', 'new', url_prefix='/v2')

def my_old_route():
    return Resonse()

def my_new_route():
    return Response()

deprecate_blueprint(old_bp, new_blueprint=new_bp)

This will inject the Warning header for every route on the old blueprint and additionally direct the client to use the new /v2 api.


You will need to install the package dependencies first, see the Installation section for details.

To build and open the documentation simply run:



If you need to install pyenv/virtualenvwrapper you can run the bin/setup-osx command Please note that this will modify your bash profile

Assuming you have virtualenv wrapper installed

mkvirtualenv flask-deprecate
workon flask-deprecate
pip install -r requirements_dev.txt
pip install -e .


This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.


0.1.0 (2018-02-07)

  • First release on PyPI.

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-deprecate-0.1.3.tar.gz (12.8 kB view hashes)

Uploaded source

Built Distribution

flask_deprecate-0.1.3-py2.py3-none-any.whl (6.3 kB view hashes)

Uploaded py2 py3

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