[email protected] release

Lobsters·0 points·sobolevn·about 2 hours ago

<p>Hi everyone, I am the release manager of <code>django-modern-rest</code> :)</p> <p>django-modern-rest 0.16.0 is out!</p> <p>Is this your first time that you hear about this project? django-modern-rest is a fully typed / fast / flexible / async-ready framework to create REST APIs for Django. It supports Pydantic, msgspec, attrs and many other models.</p> <p>Here's how the code looks like:</p> <pre><code>import uuid import pydantic from dmr import Body, Controller from dmr.plugins.pydantic import PydanticFastSerializer class UserCreateModel(pydantic.BaseModel): email: str class UserModel(UserCreateModel): uid: uuid.UUID class UserController(Controller[PydanticFastSerializer]): def post(self, parsed_body: Body[UserCreateModel]) -&gt; UserModel: return UserModel(uid=uuid.uuid4(), email=parsed_body.email) </code></pre> <p>Other notable features:</p> <ul> <li> <p>Builtin auth with sessions / JWT headers and cookies</p> </li> <li> <p>Validation of requests and responses according to the OpenAPI spec in debug mode, the spec is the source of truth</p> </li> <li> <p>Builtin content negotiation, supporting conditional request and response models for different content types</p> </li> <li> <p>Flexible error handling</p> </li> <li> <p>Optional error model negotiation and complete customization</p> </li> <li> <p>Streaming of SSE and JsonLines</p> </li> <li> <p>Code reuse is the first-class citizen, create your own typed abstractions and use them with ease and safety</p> </li> <li> <p>Advanced testing strategies, including OpenAPI coverage testing and property based tests with the help of schemathesis</p> </li> <li> <p>AI as the first-class feature: skills, contexts, mcps, etc. But, no slop inside.</p> </li> <li> <p>Repo: <a href="https://github.com/wemake-services/django-modern-rest" rel="ugc">https://github.com/wemake-services/django-modern-rest</a></p> </li> <li> <p>Docs: <a href="https://django-modern-rest.readthedocs.io" rel="ugc">https://django-modern-rest.readthedocs.io</a></p> </li> </ul> <p>Now, back to the 0.16.0 release!</p> <p>Built during <code>opensource_september</code> community event with 32 contributors and 144 commits. This is our fastest release ever.</p> <strong>Performance</strong> <ul> <li>PydanticFastSerializer: deserialize x2.2, serialize x1.33 faster</li> <li>New BodyMsgspec component: decodes request bytes straight into a msgspec.Struct, x1.6 faster than Body</li> <li>msgspec request context validation x2 faster</li> <li>Content negotiation is memoized per header: up to x65 faster for browser-style Accept headers</li> <li>msgspec 0.22.0, cheaper checks, cookies, headers, and responses</li> </ul> <strong>Features</strong> <ul> <li>Default values for components: Body[Model | None] = None just works</li> <li>concrete_views for JWT, token, and session auth: a login route in one line of urls.py, zero view code</li> <li>Cursor (keyset) pagination with sync and async APIs</li> <li> <code>extras=</code> for your own typed <code>@modify</code> / <code>@validate</code> parameters</li> <li>PEP 696 TypeVar defaults for reusable controllers</li> <li>First-class CSRF: proper 403 specs and REST error responses</li> <li>external_re_path and nested external_path</li> <li>Error handlers can re-raise a new error for the next layer</li> <li>OpenAPI: x-extensions on every object, security for gateways and mTLS, OpenAPI 3.2 fields, controller-level tags/deprecated/servers, deterministic schema output</li> </ul> <strong>One rule for all config</strong> <p>Settings are no longer merged across levels. Endpoint overrides controller, controller overrides settings. Explicit [] or None disables, EMPTY falls through. Merge explicitly when you want it: <code>@modify(auth=[*auth, other])</code>.</p> <strong>AI tooling</strong> <p>Agent skills now ship inside the package: uvx library-skills installs the ones matching your version. The new <code>$dmr-upgrade</code> skill carries the migration prompts, so ask your coding agent to upgrade you from 0.15.0. Every docs page is also served as Markdown.</p> <ul> <li>Repo: <a href="https://github.com/wemake-services/django-modern-rest" rel="ugc">https://github.com/wemake-services/django-modern-rest</a> </li> <li>Docs: <a href="https://django-modern-rest.readthedocs.io" rel="ugc">https://django-modern-rest.readthedocs.io</a> </li> <li>Changelog: <a href="https://github.com/wemake-services/django-modern-rest/blob/master/CHANGELOG.md" rel="ugc">https://github.com/wemake-services/django-modern-rest/blob/master/CHANGELOG.md</a> </li> <li>Full release notes: <a href="https://github.com/wemake-services/django-modern-rest/releases/tag/0.16.0" rel="ugc">https://github.com/wemake-services/django-modern-rest/releases/tag/0.16.0</a> </li> </ul>

Related stories

Related topics