Ariadne 0.8.0
Ariadne 0.8 release brings improvements to API modularization, makes python-multipart
optional dependency, and updates dependencies to latest versions. We have also added Python 3.8 to the list of officially supported Python versions.
Modularization improvements
We've noticed an emerging pattern in GraphQL APIs implemented with Ariadne where developers create dedicated modules/packages in their project for scalars, mutations or types and then use their __init__.py's
to gather all bindables into single lists:
from .scalars import scalars # [date_scalar, datetime_scalar]
from .types import types # [query, book, user]
from .mutations import mutations # [login, register, add_book, edit_book, publish_book, delete_book]
Those lists were then combined into single large list at the time of passing them to make_executable_schema
:
schema = make_executable_schema(type_defs, scalars + types + mutations)
This code didn't look too pleasant to us, and things only became worse when single bindable was thrown into the mix:
from somewhere import library_type
schema = make_executable_schema(type_defs, scalars + types + mutations + [library_type])
We've decided to change make_executable_schema
implementation and turn bindables
into *args
, enabling much cleaner syntax:
schema = make_executable_schema(type_defs, scalars, types, mutations, library_type)
For the time being both approaches are be supported (and also can be mixed at same time), but we recommend all developers to migrate their projects to new approach.
In future version of Ariadne mixing lists with single bindables will require explicit syntax:
schema = make_executable_schema(type_defs, *scalars, *types, *mutations, library_type])
We have also fixed load_schema_from_path
implementation to actually walk subdirectories in given path to find and parse *.graphql
files, as it was documented.
python-multipart
is now an optional dependency
We have received a feedback that always installing python-multipart
dependency is unwarranted behavior due to library being only required for file uploads in ASGI-based GraphQL servers and having potential name conflict with other library.
To address this we have made library optional. Developers may opt-in to install it by using asgi-file-uploads
extra flag:
pip install ariadne[asgi-file-uploads]
CHANGELOG
- Added recursive loading of GraphQL schema files from provided path.
- Added support for passing multiple bindables as
*args
tomake_executable_schema
. - Updated Starlette dependency to 0.13.
- Made
python-multipart
optional dependency forasgi-file-uploads
. - Added Python 3.8 to officially supported versions.