Flask v2.1.0 Release Notes

  • ๐Ÿš€ Released 2022-03-28

    • ๐Ÿ‘ Drop support for Python 3.6. :pr:4335
    • โšก๏ธ Update Click dependency to >= 8.0. :pr:4008
    • ๐Ÿšš Remove previously deprecated code. :pr:4337

      • The CLI does not pass script_info to app factory functions.
      • config.from_json is replaced by config.from_file(name, load=json.load).
      • json functions no longer take an encoding parameter.
      • safe_join is removed, use werkzeug.utils.safe_join instead.
      • total_seconds is removed, use timedelta.total_seconds instead.
      • The same blueprint cannot be registered with the same name. Use name= when registering to specify a unique name.
      • The test client's as_tuple parameter is removed. Use response.request.environ instead. :pr:4417
    • Some parameters in send_file and send_from_directory were renamed in 2.0. The deprecation period for the old names is extended to 2.2. Be sure to test with deprecation warnings visible.

      • attachment_filename is renamed to download_name.
      • cache_timeout is renamed to max_age.
      • add_etags is renamed to etag.
      • filename is renamed to path.
    • ๐Ÿ—„ The RequestContext.g property is deprecated. Use g directly or AppContext.g instead. :issue:3898

    • copy_current_request_context can decorate async functions. :pr:4303

    • ๐Ÿ“‡ The CLI uses importlib.metadata instead of setuptools to load command entry points. :issue:4419

    • Overriding FlaskClient.open will not cause an error on redirect. :issue:3396

    • Add an --exclude-patterns option to the flask run CLI command to specify patterns that will be ignored by the reloader. :issue:4188

    • 0๏ธโƒฃ When using lazy loading (the default with the debugger), the Click context from the flask run command remains available in the loader thread. :issue:4460

    • Deleting the session cookie uses the httponly flag. :issue:4485

    • Relax typing for errorhandler to allow the user to use more precise types and decorate the same function multiple times. :issue:4095, 4295, 4297

    • Fix typing for __exit__ methods for better compatibility with ExitStack. :issue:4474

    • From Werkzeug, for redirect responses the Location header URL will remain relative, and exclude the scheme and domain, by default. :pr:4496

    • ๐Ÿ›  Add Config.from_prefixed_env() to load config values from environment variables that start with FLASK_ or another prefix. This parses values as JSON by default, and allows setting keys in nested dicts. :pr:4479