freshcrate
Skin:/
Home > RAG & Memory > srsly

srsly

Modern high-performance serialization utilities for Python

Why this rank:Strong adoptionRelease freshnessHealthy release cadence

Description

<a href="https://explosion.ai"><img src="https://explosion.ai/assets/img/logo.svg" width="125" height="125" align="right" /></a> # srsly: Modern high-performance serialization utilities for Python This package bundles some of the best Python serialization libraries into one standalone package, with a high-level API that makes it easy to write code that's correct across platforms and Pythons. This allows us to provide all the serialization utilities we need in a single binary wheel. Currently supports **JSON**, **JSONL**, **MessagePack**, **Pickle** and **YAML**. [![tests](https://github.com/explosion/srsly/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/srsly/actions/workflows/tests.yml) [![PyPi](https://img.shields.io/pypi/v/srsly.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.python.org/pypi/srsly) [![conda](https://img.shields.io/conda/vn/conda-forge/srsly.svg?style=flat-square&logo=conda-forge&logoColor=white)](https://anaconda.org/conda-forge/srsly) [![GitHub](https://img.shields.io/github/release/explosion/srsly/all.svg?style=flat-square&logo=github)](https://github.com/explosion/srsly) [![Python wheels](https://img.shields.io/badge/wheels-%E2%9C%93-4c1.svg?longCache=true&style=flat-square&logo=python&logoColor=white)](https://github.com/explosion/wheelwright/releases) ## Motivation Serialization is hard, especially across Python versions and multiple platforms. After dealing with many subtle bugs over the years (encodings, locales, large files) our libraries like [spaCy](https://github.com/explosion/spaCy) and [Prodigy](https://prodi.gy) had steadily grown a number of utility functions to wrap the multiple serialization formats we need to support (especially `json`, `msgpack` and `pickle`). These wrapping functions ended up duplicated across our codebases, so we wanted to put them in one place. At the same time, we noticed that having a lot of small dependencies was making maintenance harder, and making installation slower. To solve this, we've made `srsly` standalone, by including the component packages directly within it. This way we can provide all the serialization utilities we need in a single binary wheel. `srsly` currently includes forks of the following packages: - [`ujson`](https://github.com/esnme/ultrajson) - [`msgpack`](https://github.com/msgpack/msgpack-python) - [`msgpack-numpy`](https://github.com/lebedov/msgpack-numpy) - [`cloudpickle`](https://github.com/cloudpipe/cloudpickle) - [`ruamel.yaml`](https://github.com/pycontribs/ruamel-yaml) (without unsafe implementations!) ## Installation > âš ī¸ Note that `v2.x` is only compatible with **Python 3.6+**. For 2.7+ > compatibility, use `v1.x`. `srsly` can be installed from pip. Before installing, make sure that your `pip`, `setuptools` and `wheel` are up to date. ```bash python -m pip install -U pip setuptools wheel python -m pip install srsly ``` Or from conda via conda-forge: ```bash conda install -c conda-forge srsly ``` Alternatively, you can also compile the library from source. You'll need to make sure that you have a development environment with a Python distribution including header files, a compiler (XCode command-line tools on macOS / OS X or Visual C++ build tools on Windows), pip and git installed. Install from source: ```bash # clone the repo git clone https://github.com/explosion/srsly cd srsly # create a virtual environment python -m venv .env source .env/bin/activate # update pip python -m pip install -U pip setuptools wheel # compile and install from source python -m pip install . ``` For developers, install requirements separately and then install in editable mode without build isolation: ```bash # install in editable mode python -m pip install -r requirements.txt python -m pip install --no-build-isolation --editable . # run test suite python -m pytest --pyargs srsly ``` ## API ### JSON > đŸ“Ļ The underlying module is exposed via `srsly.ujson`. However, we normally > interact with it via the utility functions only. #### <kbd>function</kbd> `srsly.json_dumps` Serialize an object to a JSON string. Falls back to `json` if `sort_keys=True` is used (until it's fixed in `ujson`). ```python data = {"foo": "bar", "baz": 123} json_string = srsly.json_dumps(data) ``` | Argument | Type | Description | | ----------- | ---- | ------------------------------------------------------ | | `data` | - | The JSON-serializable data to output. | | `indent` | int | Number of spaces used to indent JSON. Defaults to `0`. | | `sort_keys` | bool | Sort dictionary keys. Defaults to `False`. | | **RETURNS** | str | The serialized string. | #### <kbd>function</kbd> `srsly.json_loads` Deserialize unicode or bytes to a Python object. ```python data = '{"foo": "bar", "baz": 123}' obj = srsly.json_loads(data) ``` | Argument | Type | Description

Release History

VersionChangesUrgencyDate
2.5.3Imported from PyPI (2.5.3)Low4/21/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Medium3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.3# Generated notes (2026-03-23 12:38) Python 3.14 support via updated cloudpickle ## Features - Add Python 3.14 compatibility by updating vendored cloudpickle to 3.1.2Low3/23/2026
release-v2.5.2Release release-v2.5.2Low11/17/2025
release-v2.5.1Now that Github have runners for Linux ARM, we can build wheels for that again 🎉 Low1/17/2025
release-v2.5.0* Update vendored `msgpack-python` to v1.1.0 * Update build system and support Python 3.13 * Update metadata to accurately reflect Python version rangesLow12/10/2024
v2.4.8* Updates for Python 3.12 support (#102). * Add Python 3.12 wheels.Low9/22/2023
v2.4.7- Restrict to Cython 0.29.x due to incompatibilities with Cython 3.Low7/18/2023
v1.0.7- Port https://github.com/ultrajson/ultrajson/pull/550 and https://github.com/ultrajson/ultrajson/pull/555 to fix incorrect handling of invalid surrogate pair characters (CVE-2022-31116) - Port https://github.com/ultrajson/ultrajson/pull/519 to fix buffer overflows ([CVE-2021-4595](https://github.com/advisories/GHSA-fh56-85cw-5pq6))Low7/18/2023
v2.4.6* Fix typing for `JSONInput` and `JSONInputBin` (#79). * Add `read_gzip_jsonl` and `write_gzip_jsonl` (#84).Low2/28/2023
v1.0.6* Drop support for Python 3.5 and earlier. * Update to cloudpickle v2.2.0 for Python 3.11 support. * Add Python 3.11 wheels. Low10/18/2022
v2.4.5* Update to cloudpickle v2.2.0 for Python 3.11 support. * Add Python 3.11 wheels.Low10/18/2022
v2.4.4- Port https://github.com/ultrajson/ultrajson/pull/550 and https://github.com/ultrajson/ultrajson/pull/555 to fix incorrect handling of invalid surrogate pair characters (CVE-2022-31116)Low7/20/2022
v2.4.3- Port https://github.com/ultrajson/ultrajson/pull/519 to fix buffer overflows ([CVE-2021-4595](https://github.com/advisories/GHSA-fh56-85cw-5pq6))Low4/13/2022
v2.4.1* Use str with chdir in setup * Fix type of `write_jsonl` * Fix `json_loads` behaviour for string "-"Low4/12/2021
v2.4.0* Support custom `msgpack` serializers and deserializers via function registries (mostly internals). * Update setup.Low2/1/2021
v1.0.3* Update for python 3.9Low11/4/2020
v2.3.1* Update for python 3.9Low11/4/2020
v2.3.0* Adjust argument names. * Expose data loaders for spaCy v3.Low10/1/2020
v2.2.0* Remove unsafe YAML implementations, raising if called (see #28)Low6/30/2020
v2.1.0* Include vendorized [`ruamel.yaml`](https://github.com/pycontribs/ruamel-yaml). * Add YAML API for saving and loading YAML.Low6/21/2020
v2.0.1* Support `cupy.ndarray` in `msgpack_numpy`. * Make `msgpack` raise correct errors for unserializable objects if `numpy` is not installed.Low3/4/2020
v1.0.2* Support `cupy.ndarray` in `msgpack_numpy`. * Make `msgpack` raise correct errors for unserializable objects if `numpy` is not installed.Low3/4/2020
v1.0.1* Fix source distribution.Low1/6/2020
v2.0.0* Port over esnme/ultrajson#323 by @timdawborn. * Drop support for Python 2.7 and 3.5. * Tidy up code and remove compatibility helpers. * Add type hints. * Improve setup and compilation.Low1/2/2020
v1.0.0- Add official support for Python 3.8. - Fix typo in `README.md`. Thanks to @pfvosi for the pull request!Low1/2/2020
v0.2.0* Fix issue #10: Update cloudpickle to 1.2.2 to support Python 3.8. * Fix issue #13: Add `append_new_line` option to `write_jsonl` to control whether newline is appended. Thanks to @nyejon for the pull request!Low10/28/2019
v0.1.0* Add `read_gzip_json` and `write_gzip_json` for working with compressed JSON. Thanks to @polm for the pull request!Low8/18/2019
v0.0.7* Fix issue #6: Don't write to JSONL as `"a"` (append) by default.Low6/13/2019
v0.0.6* Fix issue #4: Fix memory leak. Thanks to @sadovnychyi for the pull request and to @Adriandorr for the fix.Low6/7/2019
v0.0.5* Fix length limits on `msgpack` serialization.Low12/2/2018
v0.0.4* Move `ujson` to `srsly.ujson` for API consistency. * Add pickle utilities: `pickle_loads` and `pickle_dumps`. * Add msgpack utilities: `msgpack_loads`, `msgpack_dumps`, `write_msgpack`, `read_msgpack`. * Improve test suite.Low12/2/2018
v0.0.3* Expose `json_dumps` and `json_loads` helpers. * Add support for `sort_keys` via `json`.Low12/2/2018
v0.0.2* Fix tests across Python versions and platforms. * Improve file path handling.Low12/2/2018
v0.0.1Release v0.0.1Low12/1/2018

Dependencies & License Audit

Loading dependencies...

Similar Packages

azure-search-documentsMicrosoft Azure Cognitive Search Client Library for Pythonazure-mgmt-computelimit_1.1.0
idnaInternationalized Domain Names in Applications (IDNA)v3.18
ultralyticsUltralytics YOLO 🚀 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.v8.4.60
biopythonFreely available tools for computational molecular biology.master@2026-06-01
cupy-cuda12xCuPy: NumPy & SciPy for GPUv14.1.1

More from Explosion

spacyIndustrial-strength Natural Language Processing (NLP) in Python
thincA refreshing functional take on deep learning, compatible with your favorite libraries
wasabiA lightweight console printing and formatting toolkit
confectionThe sweetest config system for Python

More in RAG & Memory

vllmA high-throughput and memory-efficient inference and serving engine for LLMs
spiceaiA portable accelerated SQL query, search, and LLM-inference engine, written in Rust, for data-grounded AI apps and agents.
awesome-opensource-aiCurated list of the best truly open-source AI projects, models, tools, and infrastructure.
antflyNo description