Click 7.1 Released

written by David Lord on 2020-03-09 in Releases

The Pallets team is pleased to release Click 7.1.

Read the full changelog to understand what may affect your code when upgrading.

  • Drop support for Python 3.4. This will be the last version to support Python 2.7 and 3.5.
  • Multiple fixes in low-level Windows compatibility code.
  • Colored output in Jupyter notebooks on Linux and Mac.
  • Updated Bash and ZSH tab completion support. Add support for Fish.
  • Better formatting when option help text contains newlines.

This also fixes a packaging issue from 7.0 where the project name in the package metadata was changed to "Click" with an upper case "C". This has been reverted, the name is now correctly reported in all lower case, "click".

Version 8.0 Coming Soon

As outlined in Ending Python 2 Support, 7.1.x will be the last version to support Python 2.7 and 3.5. The next version will be 8.0 and will support Python 3.6 and newer.

Install or Upgrade

Install from PyPI with pip:

pip install -U click

The Pallets organization accepts donations as part of the non-profit Python Software Foundation (PSF). Donations through the PSF support our efforts to maintain the projects and grow the community.

Click here to donate. ❤

Werkzeug 1.0.0 Released

written by David Lord on 2020-02-06 in Releases

The Pallets team is pleased to release Werkzeug 1.0. Werkzeug is the low-level WSGI and HTTP toolkit that powers Flask. It's been almost 13 years since the first commit, and this milestone for the project brings many fixes and changes. Read the full changelog to understand what may affect your code when upgrading.

  • Drop support for Python 3.4. This will be the last version to support Python 2.7 and 3.5.
  • Remove most top-level attributes provided by the werkzeug module in favor of direct imports. If you haven't already, use version 0.16 first to see deprecation warnings while upgrading.
  • Cookies support the samesite='None' option. Cookies are parsed as a MultiDict instead of overwriting repeated keys.
  • The development server supports 2-way TLS, making it easier to develop applications that inspect client certificates.
  • When building URLs with host matching, the current host is accounted for when deciding what rule to build.
  • When defining and matching URL rules, consecutive slashes are merged by default to match the behavior of common HTTP servers.
  • The Accept header preserves order for tags with equal quality and considers options on each value. The Accept-Language header can match the primary tag if the specific value is not present.
  • Added CORS header attributes to Request and Response.
  • A URL rule can be marked as a websocket, in which case it will only match for wss:// requests. This allows async web frameworks to use Werkzeug for routing.

Version 2.0 Coming Soon

As outlined in Ending Python 2 Support, 1.0.x will be the last version to support Python 2.7 and 3.5. The next version will be 2.0 and will support Python 3.6 and newer.

Install or Upgrade

Install from PyPI with pip:

pip install -U Werkzeug

The Pallets organization accepts donations as part of the non-profit Python Software Foundation (PSF). Donations through the PSF support our efforts to maintain the projects and grow the community.

Click here to donate. ❤

For Enterprise

The Pallets team and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use.

Learn more.

Jinja 2.11.0 Released

written by David Lord on 2020-01-27 in Releases

The Pallets team is pleased to release Jinja 2.11.0. Read the changelog for the full list of changes. Some of the bigger changes include:

  • Drop support for Python 2.6, 3.3, and 3.4. This will be the last version to support Python 2.7 and 3.5.
  • A new jinja2.ext.debug extension adds a {% debug %} tag to quickly dump the current template context.
  • A new ChainableUndefined type allows silently ignoring attribute access on undefined variables.
  • Loop context variables like loop.length and loop.nextitem work better in both sync and async environments.
  • Improved compile and runtime performance.

Version 3.0 Coming Soon

As outlined in Ending Python 2 Support, 2.11.x will be the last version to support Python 2.7 and 3.5. The next version will be 3.0 and will support Python 3.6 and newer.

The package name will remain "Jinja2" and imports will remain jinja2. "Jinja2 3.0" looks a little weird, but given the years of community momentum behind the name, we concluded it was less disruptive to keep it as-is.

Install or Upgrade

Install from PyPI with pip:

pip install -U Jinja2

The Pallets organization accepts donations as part of the non-profit Python Software Foundation (PSF). Donations through the PSF support our efforts to maintain the projects and grow the community.

Click here to donate. ❤

For Enterprise

The Pallets team and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use.

Learn more.

Ending Python 2 Support

written by David Lord on 2019-12-17 in Meta

Upstream support for Python 2.7 is ending on January 1, 2020. Pallets is joining the community of open source projects ending support for Python 2 at that time. Our statement and support plan are based on PyTest's announcement.

We will be dropping support for Python 2.7 as well as Python 3.5 and below, as their support windows have ended or will end around the same time. Future releases of each Pallets project will only support Python versions still supported upstream, which can be found in the Python Developer's Guide.

The last version branch of each core project to support Python 2.7 and Python 3.5 are:

  • Flask 1.1.x
  • Werkzeug 1.0.x
  • Click 7.x
  • Jinja 2.11.x
  • ItsDangerous 1.1.x
  • MarkupSafe 1.1.x

Each project will receive a major version bump to indicate support for only 3.6+:

  • Flask 2.0
  • Werkzeug 2.0
  • Click 8.0
  • Jinja 3.0
  • ItsDangerous 2.0
  • MarkupSafe 2.0

Thanks to the python_requires package metadata, Python 2.7 and 3.5 users with a modern pip version will install the last supported version automatically even if later versions are available.

The team will no longer backport patches for unsupported versions, but the branches will continue to exist. The team will be happy to accept patches contributed by the community for any severe security and usability issues until mid-2020.

We made this decision based on multiple factors. Foremost is ease of community contribution and maintainer availability. As time goes on, fewer contributors have used or are familiar with the differences between Python 2 and 3. Contributors and maintainers must keep track of an ever growing list of obscure compatibility issues and workarounds, and cannot use many modern features.

Over the last two years, we've talked to many developers and teams at conferences and meetups and heard overwhelming support for the move to Python 3. This is backed up by data collected from our community in a survey we ran during January 2019, with 92% of respondents already using or actively upgrading to Python 3. The PSF developer survey and PyPI statistics report similar majorities and show adoption continuing to increase.

Thank you to everyone in the community for your support, and to everyone who has made this transition a reality. We look forward to continuing to develop the Pallets projects with you!

Werkzeug 0.16.0 Released

written by David Lord on 2019-09-19 in Releases

Werkzeug 0.16.0 has been released. The only change is that most of the top-level attributes in the werkzeug module are now deprecated, and will be removed in 1.0.0.

For example, instead of import werkzeug; werkzeug.url_quote, do from werkzeug.urls import url_quote. If you are using these imports in your project, a deprecation warning will show the correct import to use. werkzeug.exceptions and werkzeug.routing should also be imported instead of accessed, but for technical reasons can’t show a warning.

These imports were supported by patching the werkzeug module to support lazy imports, but the implementation added complexity, and there was no clear design reason why some things were available and some weren't. It also masked some circular dependency issues. IDEs like PyCharm didn't know those lazy imports existed and were already correctly using the full imports.

Werkzeug 0.15.5 Released

written by David Lord on 2019-07-17 in Releases , Security

Werkzeug 0.15.5 has been released, containing bug and security fixes. The changelog lists the changes in detail, which include:

  • SharedDataMiddleware safely handles drive names in paths on Windows.
  • The reloader no longer causes an Exec format error in many common situations.
  • The reloader works around an issue when using the pydev debugger.

Security fix for SharedDataMiddleware on Windows

Prior to 0.15.5, it was possible for a third party to potentially access arbitrary files when the application used SharedDataMiddleware on Windows. This issue was assigned CVE-2019-14322.

Due to the way Python's os.path.join() function works on Windows, a path segment with a drive name will change the drive of the final path. This was previously addressed in the safe_join() function in Werkzeug 0.12.2, but SharedDataMiddleware used a separate implementation and so was not secured by the previous fix.

SharedDataMiddlware now uses safe_join() when fetching requested files. Projects using SharedDataMiddleware on Windows should update as soon as possible to receive the fix.

Thank you to Emre Övünç and Olivier Dony for responsibly reporting the issue. If you think you have discovered a security issue in Werkzeug or another of the Pallets projects, please email security@palletsprojects.com with details.

Install or Upgrade

Install from PyPI with pip:

pip install -U Werkzeug

Flask 1.1 Released

written by David Lord on 2019-07-04 in Releases

The Pallets team is pleased to release Flask 1.1. The latest version is 1.1.1. Version 1.0.4 was also released.

  • Drop support for Python 3.4.
  • Bump minimum Werkzeug version to 0.15.
  • The way error handlers for InternalServerError and 500 work has been made more consistent. See below for more information.
  • app.logger once again takes the same name as app.name, reverting 1.0.x's behavior of hard-coding "flask.app". See below for more information.
  • jsonify supports Python's dataclasses.
  • Returning a dict from a view function will produce a JSON response. This makes it even easier to get started building an API.
  • A clearer error message is shown when a view returns an unsupported type.
  • URL routing is performed after the request context is pushed. This allows custom URL converters to access current_app and request. This makes it possible to implement converters such as one that queries the database for a model based on the ID in the URL.
  • CLI commands can be registered with blueprints using the new bp.cli attribute. These will be available as nested commands, for example flask user create.

Read the changelog for the full list of changes. Be sure to check the notes for the 1.0.x versions as well.

Change to Error Handling

Prior to 1.0, unhandled errors caused a generic InternalServerError to be returned, but only the handler for 500 was looked up for that, and the original error was passed to it. 1.0 made 500 an alias for InternalServerError, but these inconsistencies caused confusion over what errors were passed to what handlers.

As of 1.1, an error handler registered for InternalServerError or 500 means the same thing in all cases. It will always be passed an instance of InternalServerError, even if it was caused by an unhandled error of another type. The original error is available as e.original_exception.

If your project uses a 500 error handler that expects any exception to be passed to it, it should use e.original_exception instead of e.

Change to Logging

In 1.0, Flask's logging setup was greatly simplified. Part of that was hard-coding the name "flask.app" for the logger. However, that made it less clear whether Flask or the app was doing the logging, and made it impossible to distinguish between multiple apps in logs.

As of 1.1, app.logger again takes the same name as app.name. Flask will warn you if it detects logging configuration for "flask" or "flask.app" so you can rename that configuration appropriately.

For example, if your project is named example.py and you initialize your Flask app as Flask(__name__), then the logger will be named "example".

Install or Upgrade

Install from PyPI with pip:

pip install -U Flask

Pallets now accepts donations through the PSF in order to support our efforts to maintain the projects and grow the community. We greatly appreciate any support you can provide. Click here to donate.

Werkzeug 0.15.3 Released

written by David Lord on 2019-05-14 in Releases , Security

Werkzeug 0.15.3 has been released, followed closely by 0.15.4. Both fix bugs and compatibility issues. The changelog lists the changes in detail, which include:

  • The debugger pin is unique per Docker container.
  • Fix issues with the arguments to the Unauthorized HTTP exception.
  • Fix ProfilerMiddleware filenames, and get LintMiddleware working on Python 3.
  • Bytes passed to URLs will be correctly decoded rather than having a b prefix.

Debugger Pin Security

A minor security issue was addressed in this release. The debugger generates a unique pin per host to prevent unauthorized code execution. However, in Docker this pin would be identical across all containers. This release ensures each container uses a unique pin.

Thank you to Nikita Tikhomirov for responsibly reporting the issue. If you think you have discovered a security issue in Werkzeug or another of the Pallets projects, please email security@palletsprojects.com with details.

Install or Upgrade

Install from PyPI with pip:

pip install -U Werkzeug

Flask-SQLAlchemy 2.4.0 Released

written by Randy Syring on 2019-04-24 in Releases

Flask-SQLAlchemy 2.4.0. has been released. The changelog lists the changes in detail, which include:

  • Make SQLAlchemy engine configuration more flexible
  • Address SQLAlchemy 1.3 deprecations

Deprecation Warnings

New deprecation warnings have been added for configuration and __init__ params that are no longer needed due to the engine configuration now being more customizable. Those options will be removed in release 3.0.

Install or Upgrade

Install from PyPI with pip:

pip install -U Flask-SQLAlchemy

Jinja 2.10.1 Security Release

written by David Lord on 2019-04-06 in Releases , Security

Jinja 2.10.1 has been released and includes a security-related fix. If you are using the Jinja sandboxed environment you are encouraged to upgrade.

MITRE has assigned CVE-2019-10906 to this issue.

Thank you to Brian Welch for responsibly reporting the issue, and to Armin Ronacher for writing the fix.

The sandbox is used to restrict what code can be evaluated when rendering untrusted, user-provided templates. Due to the way string formatting works in Python, the str.format_map method could be used to escape the sandbox.

This issue was previously addressed for the str.format method in Jinja 2.8.1, which discusses the issue in detail. However, the less-common str.format_map method was overlooked. This release applies the same sandboxing to both methods.

If you cannot upgrade Jinja, you can override the is_safe_attribute method on the sandbox and explicitly disallow the format_map method on string objects.

Reporting Security Issues

If you think you have discovered a security issue in Jinja or another of the Pallets projects, please email security@palletsprojects.com with details.