dmr
wemake-services/django-modern-rest · skills.sh
Open source Repository Open in the app JSON README (API)
About
Skill publicada por wemake-services/django-modern-rest no skills.sh. Instale com: npx skills add wemake-services/django-modern-rest@dmr
Details
- Kind
- Agent skills
- Publisher
- wemake-services
- Origin
- skillssh
- Category
- ferramentas
- Stars
- 1,500
- Forks
- 223
- Open pull requests
- 12
- Last push
- 2026-10-08T05:44:27Z
- Repository state
- ativo
- Language
- Python
- License
- MIT
- Added
- 2026-10-07 05:37:40
- Updated
- 2026-10-07 05:37:40
- Origin id
wemake-services/django-modern-rest/dmr
README
<p align="center">
<a href="https://django-modern-rest.readthedocs.io/en/latest/">
<picture>
<source srcset="https://raw.githubusercontent.com/wemake-services/django-modern-rest/master/docs/_static/images/logo-dark.svg" media="(prefers-color-scheme: dark)">
<img src="https://raw.githubusercontent.com/wemake-services/django-modern-rest/master/docs/_static/images/logo-light.svg#gh-light-mode-only" alt="Modern REST Logo - Light" width="100%" height="auto" />
</picture>
</a>
</p>
<p align="center">
<em>Modern REST framework for Django with types and async support!</em>
</p>
<div align="center">
[](https://wemake-services.github.io)
[](https://github.com/wemake-services/django-modern-rest)
[](https://github.com/wemake-services/django-modern-rest/actions/workflows/test.yml)
[](https://codecov.io/gh/wemake-services/django-modern-rest)
[](https://github.com/wemake-services/django-modern-rest/blob/master/.github/AI_POLICY.md)
[](https://pepy.tech/projects/django-modern-rest)
[](https://pypi.org/project/django-modern-rest/)
[](https://github.com/wemake-services/wemake-python-styleguide)
[](https://deepwiki.com/wemake-services/django-modern-rest)
[](https://t.me/django_modern_rest)
</div>
## Features
- [x] [Blazingly fast](https://django-modern-rest.readthedocs.io/en/latest/pages/deep-dive/performance.html)
- [x] Supports async Django without any `sync_to_async` / `async_to_sync` calls inside, tested to work with free-threading builds
- [x] Supports `pydantic2`, `msgspec`, `attrs`, `dataclasses`, `TypedDict` as model schemas, but not bound to any of these libraries
- [x] Fully typed and checked with `mypy`, `pyright`, `ty`, and `pyrefly` in strict modes
- [x] Supports content negotiation, has default implementations for `json`, `msgpack`, SSE, Json Lines, and more
- [x] Strict schema validation of both requests and responses, including errors
- [x] Supports OpenAPI 3.1 / 3.2 semantic schema generation out of the box
- [x] Supports all your existing `django` primitives and packages, no custom runtimes
- [x] Great testing tools with [schemathesis](https://github.com/schemathesis/schemathesis), [polyfactory](https://github.com/litestar-org/polyfactory), [tracecov](https://django-modern-rest.readthedocs.io/en/latest/pages/testing/tracecov.html), bundled `pytest` plugin, and default Django's testing primitives
- [x] 100% test coverage with 4000+ of carefully designed unit, integration, typing, and property-based tests on different databases and caches
- [x] High [security standards](https://github.com/wemake-services/django-modern-rest/blob/master/.github/SECURITY.md)
- [x] Built [by the community](https://github.com/wemake-services/django-modern-rest/graphs/contributors) for the community, not a single-person project
- [x] Great [docs](https://django-modern-rest.readthedocs.io/en/latest/)
- [x] No AI slop, but [built for the LLM era](https://django-modern-rest.readthedocs.io/en/latest/pages/getting-started.html#llms-support)
- [x] No emojis 🌚️️
---------
<p align="center">
<a href="https://django-modern-rest.readthedocs.io/en/latest/pages/deep-dive/performance.html#sync"><picture>
<source srcset="docs/_static/images/benchmarks/sync-dark.svg" media="(prefers-color-scheme: dark)">
<img src="https://raw.githubusercontent.com/wemake-services/django-modern-rest/HEAD/docs/_static/images/benchmarks/sync-light.svg#gh-light-mode-only" alt="Sync benchmark" width="49%" /></picture></a>
<a href="https://django-modern-rest.readthedocs.io/en/latest/pages/deep-dive/performance.html#async"><picture>
<source srcset="docs/_static/images/benchmarks/async-dark.svg" media="(prefers-color-scheme: dark)">
<img src="https://raw.githubusercontent.com/wemake-services/django-modern-rest/HEAD/docs/_static/images/benchmarks/async-light.svg#gh-light-mode-only" alt="Async benchmark" width="49%" /></picture></a>
</p>
## Testimonials
> The one thing I really love about **django-modern-rest** is its pluggable
> serializers and validators. Frameworks that are tightly coupled
> with **pydantic** can be really painful to work with.
— **[Kirill Podoprigora](https://github.com/Eclips4)**, CPython core developer
> Using `django-modern-rest` has been a game-changer for my productivity. The strict type safety and schema validation for both requests and responses mean I spend less time debugging and more time building.
— **[Josiah Kaviani](https://github.com/proofit404)**, Django core developer
> I rarely see frameworks that treat their OpenAPI schema as a first-class citizen. `django-modern-rest` not only generates a schema that accurately reflects your code, but also gives you the tools to verify it.
— **[Dmitry Dygalo](https://github.com/Stranger6667)**, author of Schemathesis
## Installation
Works for:
- CPython 3.11+ or PyPy 3.11+
- Django 5.0, 5.1, 5.2, 6.0, 6.1
```bash
pip install django-modern-rest
```
There are several included extras:
- `'django-modern-rest[msgspec]'` provides [`msgspec`](https://github.com/msgspec/msgspec) support
and the fastest json parsing, recommended to be **always** included
- `'django-modern-rest[pydantic]'` provides [`pydantic`](https://github.com/pydantic/pydantic) support
- `'django-modern-rest[attrs]'` provides [`attrs`](https://github.com/python-attrs/attrs) support
- `'django-modern-rest[jwt]'` provides [`pyjwt`](https://github.com/jpadilla/pyjwt) auth support
- `'django-modern-rest[openapi]'` provides `OpenAPI` [schema validation](https://github.com/python-openapi/openapi-spec-validator),
`yaml` OpenAPI view,
and generates better OpenAPI examples with [`polyfactory`](https://github.com/litestar-org/polyfactory)
## Example
The shortest example [(click here to copy the whole file)](https://github.com/wemake-services/django-modern-rest/blob/master/docs/examples/getting_started/pydantic_controller.py):
```python
>>> import uuid
>>> import pydantic
>>> from dmr import Body, Controller, Headers
>>> # Or use `dmr.plugins.msgspec` or write your own!
>>> from dmr.plugins.pydantic import PydanticFastSerializer
>>> class UserCreateModel(pydantic.BaseModel):
... email: str
>>> class UserModel(UserCreateModel):
... uid: uuid.UUID
... consumer: str
>>> class HeaderModel(pydantic.BaseModel):
... consumer: str = pydantic.Field(alias='X-API-Consumer')
>>> class UserController(Controller[PydanticFastSerializer]):
... async def post( # <- can be sync as well!
... self,
... parsed_body: Body[UserCreateModel],
... parsed_headers: Headers[HeaderModel],
... ) -> UserModel:
... """All added props have the correct runtime and static types."""
... return UserModel(
... uid=uuid.uuid4(),
... email=parsed_body.email,
... consumer=parsed_headers.consumer,
... )
```
And then route this controller in your `urls.py`:
```python
>>> from django.urls import path
>>> from dmr.routing import Router
>>> router = Router(
... 'api/',
... [
... path('user/', UserController.as_view(), name='users'),
... ],
... )
>>> urlpatterns = [
... router.to_urlpatterns(namespace='api'),
... ]
```
Done! Now you have your shiny API with 100% type
safe validation and interactive docs.
Next steps:
- [The full documentation](https://django-modern-rest.readthedocs.io/en/latest/) has everything you need to get started!
- [wemake-django-template](https://github.com/wemake-services/wemake-django-template) can be used to jump-start your new project with `django-modern-rest`!
- [awesome-django-modern-rest](https://github.com/kondratevdev/awesome-django-modern-rest) - a curated list of resources related to `django-modern-rest`!
## Contributors
[](https://github.com/wemake-services/django-modern-rest/graphs/contributors)
## License
[MIT](https://github.com/wemake-services/django-modern-rest/blob/master/LICENSE)
## Credits
This project was generated with [`wemake-python-package`](https://github.com/wemake-services/wemake-python-package). Current template version is: [e1fcf312d7f715323dcff0d376a40b7e3b47f9b7](https://github.com/wemake-services/wemake-python-package/tree/e1fcf312d7f715323dcff0d376a40b7e3b47f9b7). See what is [updated](https://github.com/wemake-services/wemake-python-package/compare/e1fcf312d7f715323dcff0d376a40b7e3b47f9b7...master) since then.