{"id":23617,"library":"djangorestframework-yaml","title":"djangorestframework-yaml","description":"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.","status":"active","version":"2.0.0","language":"python","source_language":"en","source_url":"https://github.com/jpadilla/django-rest-framework-yaml","tags":["django","rest-framework","yaml","serialization"],"install":[{"cmd":"pip install djangorestframework-yaml","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency; DRF 3.11+ required.","package":"djangorestframework","optional":false},{"reason":"Required for YAML serialization.","package":"PyYAML","optional":false},{"reason":"Django 2.2+ required.","package":"Django","optional":false}],"imports":[{"note":"","wrong":"","symbol":"YAMLParser","correct":"from rest_framework_yaml.parsers import YAMLParser"},{"note":"","wrong":"","symbol":"YAMLRenderer","correct":"from rest_framework_yaml.renderers import YAMLRenderer"}],"quickstart":{"code":"from rest_framework import routers, serializers, viewsets\nfrom rest_framework_yaml.renderers import YAMLRenderer\nfrom rest_framework_yaml.parsers import YAMLParser\n\nclass UserSerializer(serializers.Serializer):\n    name = serializers.CharField()\n\nclass UserViewSet(viewsets.ViewSet):\n    serializer_class = UserSerializer\n    renderer_classes = [YAMLRenderer]\n    parser_classes = [YAMLParser]\n\nrouter = routers.DefaultRouter()\nrouter.register(r'users', UserViewSet)\n# Then include router.urls in urlpatterns","lang":"python","description":"Add YAML support to a DRF view by including the parser and renderer classes."},"warnings":[{"fix":"Upgrade to 2.0.0 and ensure Python 3.5+.","message":"Version 2.0.0 drops Python 2 support. Upgrade if still on Python 2.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Install using `pip install djangorestframework-yaml`.","message":"The install package name is `djangorestframework-yaml`, not `djangorestframework-yaml` (common typo).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install djangorestframework-yaml` and import from `rest_framework_yaml`.","cause":"Package not installed or wrong import path.","error":"ImportError: No module named 'rest_framework_yaml'"},{"fix":"Use `from rest_framework_yaml.parsers import YAMLParser`.","cause":"Incorrect import path e.g., `from rest_framework_yaml import YAMLParser`.","error":"AttributeError: module 'rest_framework_yaml' has no attribute 'YAMLParser'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}