Skip to main content

DRF renderer and parser based on orjson

Project description

DRF orjson renderer and parse

CI Upload Python Package

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

Installation

  • Install package

    pip install drf_orjson_rp
    
  • 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

  • Clone your fork and cd into the repo directory
  git clone git@github.com:<your username>/drf_orjson_rp.git
  cd drf_orjson_rp
  • Create a virtual environment

    python3 -m venv .venv
    source .venv/bin/activate
    
  • 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.2.0.tar.gz (5.0 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.2.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: drf_orjson_rp-0.2.0.tar.gz
  • Upload date:
  • Size: 5.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 687cbab3ea64f2fd05bce39194955480d1ac7ff2646919dc458232466aedbf11
MD5 73419eb8bb1ccfa20849a4ccf0048e31
BLAKE2b-256 70fba71ee22fbbc3ae0f0433edb987e85c4d133f15c5349454e63810286a8847

See more details on using hashes here.

Provenance

The following attestation bundles were made for drf_orjson_rp-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: drf_orjson_rp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15fdac3e1f3cd8244f2f1e829bf8dd1d16e902e76c408c410698746a10f20c01
MD5 4c58fda5ffc53a2334d1ba71665b1551
BLAKE2b-256 ff6c5946d3b949dad85616ed59176b4a2227faab743e72182baf227d3426ec02

See more details on using hashes here.

Provenance

The following attestation bundles were made for drf_orjson_rp-0.2.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