Skip to main content

DRF renderer and parser based on orjson

Project description

DRF orjson renderer and parser

CI Upload Python Package pypi

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.3.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.3.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: drf_orjson_rp-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 db9ed3b7e9fca1d0cc9e343b8ececd7149a2fb49970b44869b6806e352206e8e
MD5 550a081f3b4a2c326efdf50a30d72407
BLAKE2b-256 1895bde1d19a7a2adfe6723683d6b62c129c5b245bb28f2b15f1598230efa218

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: drf_orjson_rp-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8a70cb73d71797ce852ee6389e0cca77d4b56c1795e26a29a4218ca190cb5bd
MD5 a842cc4e035d1a37d1fc73a29930ffb6
BLAKE2b-256 c644ed69bc61866fc9d5586f9421b7da1de14ee5d895a2cb9cee4d8327e14833

See more details on using hashes here.

Provenance

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