Python: pallets publishes six new major versions for flask and co

Python: Pallets publishes six new major versions for Flask and Co

After two years of development, the development team behind pallets project has published six new major versions: flask 2.0, tool 2.0, jinja 3.0, click 8.0, itsdangerous 2.0 as well as markupsafe 2.0. The company offers a collection of open source libraries for web development with the programming language python.

With the new releases, pallets prefer a fundamental change: the company will look at projects such as PSF, cpython and django and names the main branch of his repositories in "main" around. Background is a sensitization of terms with a racist background, which has taken place in many technical fields in recent months.

Farewell to python 2 and 3.5

All six releases take farewell to python 2.X and 3.5 and set at least version 3.6 of the programming language ahead. Since october 2020 is python in version 3.9. The pallets development team plans to orient themselves for art versions on the supported versions of cpython. Removing the compatibility code should positively influence the performance and maintainability of the code. The releases were once removed as deprecated (outdated) features, but also introduced new deprecations. Test tools like pytest automatically output warnings from outdated versions, and can convert them to errors, so developers can recover what they should change to their project.

All releases together, the developer team has added comprehensive type annotations that help in their own code examples and should make better completion and help. In addition, developers are encouraged to use tools such as pre-commit, black, flake8 and pyupgrade to ensure that the code and new pull requests are consistent.

Flask 2.0

Version 2.0 of the web application framework for python now support async views and other callbacks, such as error handlers defined with asynch DEF. Regular sync views seem to work unchanged. Recently, blueprints can be nested under other blueprints, which should allow a multi-layered approach to the organization of applications. Blueprints provide the possibility to organize a group of coherent views and other code. In addition, developers receive the possibility of gehrigen HTTP API methods to add route decorators. This results, for example, @app.Post("/log in") as a short form for @app.Route("/log in", methods = ["POST"]).

The pallets developer team leads with config.From_file a new feature for loading the configurations from any file format. In addition, when delivering static files of the cache of browsers is based on the contents and not based on a 12-hour timer. Thus, flask changes to static content, such as the CSS styles, when recharging immediately, without the cache has to be emptied. The developer team indicates that developers should take into account the dependence on the other releases when they upgrade from flask.

Tool 2.0

Tool is a library for applications of the web server gateway interface (WSGI). Initially, it was just a simple collection of various utilities for WSGI applications, meanwhile she has grown over to a whole library. Version 2.0 stop innovations for parsing of multipart / form-data, which should lead to a 15-fold acceleration, especially when uploading coarse files. In addition, locals now use pythons contextvar to ensure working on asynchronous coroutines instead of only through threads. Instead of forming multiple mixin classes, the tool manages the entire request and response code in individual classes. These classes should go to the network protocol (SANS-IO) to better support sync and async application trap. At the present time this API is still private.

With version 2.0 the debugger adopts the use of the javascript library jquery, which should significantly reduce the size of the package. Datetime objects that are backed up by some heaters and functions are now dependent on time zones depending on time zones. In addition, windows colors in the server protocol should now display correctly.

Jinja 3.0 and click 8.0

As a release number three, the pallets developers have published the new major version of the template engine jinja. Special placeholders in the templates make the writing of code similar to the python syntax. Jinja 3.0 requires no patching for async environments and rendering. Is planned to continue to update this feature, since ninja asynchronous programming (async) is now called native. Furthermore, blocks can be marked immediately as required (required). Filters and tests used within IF blocks and conditioned (ternar) instructions can be undefined for runtime. Jinja 3.0 keeps more tests ready to ask if a filter or a test can be available to use this optional to use.

Even for the python package click is a new major version before. Click is used to create from parts composed command line interfaces (CLI), with as little code as necessary. It is configurable in a high mab, but also brings some presets with. The pallets developer team has written the shell tab completion system from scratch. It now allows for any command, each group, each parameter, and every type a custom resistance, supports the sending of metadata such as the type to the shell for better native support and offers a possibility to add support for new shells. In addition to some other innovations, music click 8.0 customizing core objects by newly added class attributes.

Itsdangerous 2.0 and markupsafe 2.0

To the size of smaller releases pay the tools itsdangerous and markupsafe. The former offers various helper to pass data on non-trustwurried environments and to be backed up safely. The data is signed cryptographically to ensure that a token was not manipulated. Version 2.0 brings support for key rotation by transfer of a list of valid key, instead of a single key. As with tool 2.0 are also datetime objects now time zone-dependent.

Markupsafe implements a text object that wraps around, so it can be used safely in HTML and XML. The second major version has wheels for 33 python versions / OS / architecture combinations in the luggage to facilitate the installation with speedups. Newly added manylinux 2014 and OSX universal 2 wheels.

Installation with pypi

All releases can be installed via the python package index pypi with PIP. The command fur flask is, for example, PIP install -u flask. The development team ames that, among other things, some flask extensions can still lead to incompatibility ies. Therefore, the OKO system should be further updated around the releases. Pallets recommends using developers to use tools such as PIP-compile and dependabot to set and control upgrades of their dependencies to avoid unexpected changes. Clear information about the releases can be found in the article on the blog of the pallets projects.