Skip to main content

REST Framework YAML

build-status-image pypi-version

YAML support for Django REST Framework

Full documentation for the project is available at http://qu4tro.github.io/drf-yaml.

Overview

YAML support for the Django REST Framework, forked from https://github.com/jpadilla/django-rest-framework-yaml.

Requirements

  • Python (3.8, 3.9, 3.10, 3.11)
  • Django (3.2, 4.*)

Installation

Install using pip...

$ pip install drf-yaml

Example

REST_FRAMEWORK = {
    'DEFAULT_PARSER_CLASSES': (
        'drf_yaml.parsers.YAMLParser',
    ),
    'DEFAULT_RENDERER_CLASSES': (
        'drf_yaml.renderers.YAMLRenderer',
    ),
}

You can also set the renderer and parser used for an individual view, or viewset, using the APIView class based views.

from rest_framework import routers, serializers, viewsets
from drf_yaml.parsers import YAMLParser
from drf_yaml.renderers import YAMLRenderer

# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('url', 'username', 'email', 'is_staff')


# ViewSets define the view behavior.
class UserViewSet(viewsets.ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer
    parser_classes = (YAMLParser,)
    renderer_classes = (YAMLRenderer,)

Sample output

---
-
  email: jpadilla@example.com
  is_staff: true
  url: "http://127.0.0.1:8000/users/1/"
  username: jpadilla

Documentation & Support

Full documentation for the project is available at http://qu4tro.github.io/drf-yaml.

Metadata

Release files for drf-yaml 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drf-yaml 3.0.1
File Size Uploaded Provenance Actions
drf_yaml-3.0.1.tar.gz 5.5 kB Without provenance Details for drf_yaml-3.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for drf-yaml 3.0.1
File Interpreter ABI Platform Actions
drf_yaml-3.0.1-py3-none-any.whl Python 3 none any Details for drf_yaml-3.0.1-py3-none-any.whl

Total release size: 12.0 kB

Release files / drf_yaml-3.0.1.tar.gz

Download URL drf_yaml-3.0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b6aa05d34f66717d9973984e6d664de76999fa088aab2b91739e2dfb0877a202
BLAKE2b-256 checksum
How to use checksums
663a24e5e83ccbacab5dab91e9f64e79038fb65915859bcc7272c34584db4143
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1037-azure

Release files / drf_yaml-3.0.1-py3-none-any.whl

Download URL drf_yaml-3.0.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f3a0c15f5bea0c0f067c24b21789c83aa4c4b50d3ef74ad1a83007b4ad72f2f
BLAKE2b-256 checksum
How to use checksums
2bb186cff9292f00f169d76688a6ef9898de08426baf8266808a32ce7c9609db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1037-azure

Security for drf-yaml 3.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page