Skip to main content

DRF renderer and parser based on orjson

Project description

DRF orjson renderer and parser

Rendering and parsing JSON with orjson. Made on example drf_orjson_renderer package.

Installation

  • Rewrite settings by example.

    REST_FRAMEWORK = {
        'DEFAULT_RENDERER_CLASSES': [
            # replace default json on orjson renderer
            'drf_orjson_rp.renderers.ORJSONRenderer',
            # defaults
            'rest_framework.renderers.BrowsableAPIRenderer',
        ],
        'DEFAULT_PARSER_CLASSES': [
            # replace default json on orjson parser
            'drf_orjson_rp.parsers.ORJSONParser',
            # defaults
            'rest_framework.parsers.FormParser',
            'rest_framework.parsers.MultiPartParser'
        ],
        # add orjson renderer option
        'ORJSON_RENDERER_OPTION': orjson.OPT_APPEND_NEWLINE | orjson.OPT_INDENT_2,
    }
    
  • Check settings by default in source code DRF. DEFAULTS

  • Renderer and parser made by example from source code DRF.

Developing

  • Install uv and dev dependencies

    pip install uv
    bash scripts/install.bash
    
  • Run tests

    bash scripts/test.bash
    
  • Run linters

    bash scripts/lint.bash
    
  • Run test coverage

    bash scripts/coverage.bash
    

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drf_orjson_rp-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drf_orjson_rp-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file drf_orjson_rp-0.1.0.tar.gz.

File metadata

  • Download URL: drf_orjson_rp-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for drf_orjson_rp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e94865aac2b49a0e8f4f96f8b0b1897dff73220458931d5d802f9a8d06a081ac
MD5 2faaac0d26e6fa3e3c67a142645505cc
BLAKE2b-256 151c262383309d1614d10887329d800193e9f74b75f160d34b0abf93491f7001

See more details on using hashes here.

Provenance

The following attestation bundles were made for drf_orjson_rp-0.1.0.tar.gz:

Publisher: python-publish.yml on ArtemIsmagilov/drf_orjson_rp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file drf_orjson_rp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: drf_orjson_rp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for drf_orjson_rp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfbcafacd8962ca44e85dc5279985f9ffcc06352b66f1be4f81dc45d345c3290
MD5 2515fa03670a4efb021c000b06d58969
BLAKE2b-256 11406103ef3ed522203f1703769b2e48ff3410e06c151e9e48bfebb2882f97d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for drf_orjson_rp-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on ArtemIsmagilov/drf_orjson_rp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page