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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cdjs-0.1.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e261ffc3a268dce9281f2ddbbac6e72f32a8520c689d1c0a564007bff7751fd1 |
|
MD5 | c30680c8f9f671ddbec77118ae1d1777 |
|
BLAKE2b-256 | aa84d9d0efc12225e36af25930a935bb9f654122c5b4c6f495c00020a30e6eaf |