Skip to main content

Custom Datetime JSON Serializer

Reason this release was yanked:

wrong build platform

Project description

CDJS (Custom Datetime JSON Serializer)

cdjs is an extension for orjson to serialize datetime in a custom way.

By default orjson serializes datetime according to RFC 3339 format which sometimes may not suit. orjson provides a mean to process datetime using custom serializer (via OPT_PASSTHROUGH_DATETIME flag and via default=custom_datetime_serializer). Serializers implemented in Python are usually not fast enough, that's the reason behind implementation of the custom datetime serializer written in Rust to gain optimal speed.

Example

import datetime
import orjson
from cdjs import serialize_date

mydate = datetime.datetime(2021, 1, 1, hour=0, minute=4, second=36, microsecond=123000)
orjson.dumps(mydate, option=orjson.OPT_PASSTHROUGH_DATETIME, default=serialize_date)

Benchmarks

TODO

Installation

pip install cdjs

Building

To make a develop build

python ./setup.py develop

To make a release build

Pre-requisites

# switch to nightly channel
RUSTUP_USE_CURL=1 rustup default nightly-2021-01-31
pip install maturin

To compile, package and publish to PyPI

maturin build --no-sdist --release --strip --manylinux off
maturin publish

Testing

To run tests

python -m unittest -v tests.test_serialization

Python/OS Version Support

  • Python 3.6 (tested)
  • Python 3.7+ (not tested)
  • Linux (with GLib 2.17+)

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

cdjs-0.1.4.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

cdjs-0.1.4-cp36-cp36m-manylinux2010_x86_64.whl (145.2 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

File details

Details for the file cdjs-0.1.4.tar.gz.

File metadata

  • Download URL: cdjs-0.1.4.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.9.4

File hashes

Hashes for cdjs-0.1.4.tar.gz
Algorithm Hash digest
SHA256 38193d3eb1230f3e450b81d66a324cffc238d341c2428a5a2d47809ebc13933a
MD5 1e987218259819fcbe92262cb4fc4a1d
BLAKE2b-256 8b61608bc71b7d8d33439a2f7e37786a5b66a132ab670edb1af388f384c4db18

See more details on using hashes here.

File details

Details for the file cdjs-0.1.4-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for cdjs-0.1.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e261ffc3a268dce9281f2ddbbac6e72f32a8520c689d1c0a564007bff7751fd1
MD5 c30680c8f9f671ddbec77118ae1d1777
BLAKE2b-256 aa84d9d0efc12225e36af25930a935bb9f654122c5b4c6f495c00020a30e6eaf

See more details on using hashes here.

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