Registry / web-framework / djangorestframework-yaml

djangorestframework-yaml

JSON →
library2.0.0pypypiunverified

Provides YAML parsing and rendering for Django REST Framework. Current version 2.0.0 supports Python 3.5+, Django 2.2+, and DRF 3.11+. Release cadence is low; last stable release was 2020.

pip install djangorestframework-yaml
INSTALL
IMPORT
SIG · DJANGORESTFRAMEWOR
D
djangorestframework-yaml
web-frameworkpythonv2.0.0
Install
1.7s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

YAMLParser
from rest_framework_yaml.parsers import YAMLParser
from rest_framework_yaml.parsers import YAMLParser
YAMLRenderer
from rest_framework_yaml.renderers import YAMLRenderer

Add YAML support to a DRF view by including the parser and renderer classes.

from rest_framework import routers, serializers, viewsets from rest_framework_yaml.renderers import YAMLRenderer from rest_framework_yaml.parsers import YAMLParser class UserSerializer(serializers.Serializer): name = serializers.CharField() class UserViewSet(viewsets.ViewSet): serializer_class = UserSerializer renderer_classes = [YAMLRenderer] parser_classes = [YAMLParser] router = routers.DefaultRouter() router.register(r'users', UserViewSet) # Then include router.urls in urlpatterns
Debug
Known issues
breakingVersion 2.0.0 drops Python 2 support. Upgrade if still on Python 2.
fix
Upgrade to 2.0.0 and ensure Python 3.5+.
affects: <2.0.0
gotchaThe install package name is `djangorestframework-yaml`, not `djangorestframework-yaml` (common typo).
fix
Install using `pip install djangorestframework-yaml`.
affects: all
Upgrade
Version history
2.0.0latest on PyPI · released Apr 27, 2020
Audit
Dependencies
djangorestframeworkrequiredCore dependency; DRF 3.11+ required.
PyYAMLrequiredRequired for YAML serialization.
DjangorequiredDjango 2.2+ required.
Agent activity
8 hits · last 30 days
node
8
Resources
djangorestframework-yaml — pip install djangorestframework-yaml · libregistry