prison
Rison encoder/decoder
What it is and what it does
This package provides a Python encoder and decoder for a data serialization format designed specifically for embedding structured data in URIs while remaining human-readable and compact. The format uses URI-safe syntax: parentheses for objects, exclamation-mark-prefixed arrays, single quotes for strings, and special tokens for literals. It expresses the same data model as JSON but produces strings that survive URI encoding with minimal bloat.
The package supports three output formats: full format with outer delimiters, object format with outer parentheses omitted, and array format with outer array markers omitted. A command-line tool converts between this format and JSON. Optional Pygments lexer support is available via an extra dependency.
Use it for:
- Encode nested query parameters in URLs without excessive percent-encoding bloat
- Pass structured configuration or filter data through URI query strings in web applications
- Convert between this format and JSON in command-line pipelines
- Syntax-highlight data in documentation or code editors via Pygments lexers
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Encodes and decodes a compact URI-friendly data serialization format that expresses the same data structures as JSON but with minimal URI encoding overhead.
Yes. The package is stable, has no known vulnerabilities, low install friction, and fills a specific niche: passing structured data through URIs compactly. Install it if you need to embed nested objects or arrays in query parameters without the verbosity of JSON or form encoding. Active repository maintenance supports continued reliability.
Install
prison on PyPI
pip
pip install prisonuv
uv add prisonpoetry
poetry add prisonInstalling prison
Before you install
Low install friction with a single runtime dependency (six). Actively maintained as of the last commit in 2026, though the latest release is from 2021.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install prison
import prison
prison.dumps({'foo': 'bar'})
# Returns: '(foo:bar)'
prison.loads('(foo:bar)')
# Returns: {'foo': 'bar'}
Verify before relying
- Whether the 2021 release date reflects active development or if the repository is maintained without frequent releases
- Performance characteristics when encoding or decoding deeply nested structures
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — six |
| Maintenance | actively maintained — 1,814 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 10,090,260/month — #1,481 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: prison-0.2.1-py2.py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
risonEncodes and decodes data to and from Rison, a…
permissive · top 15,000 on PyPI
python-datauriParses and creates data URIs, extracting or…
permissive · top 15,000 on PyPI
cborSerializes and deserializes data in CBOR…
permissive · top 5,000 on PyPI
prefixcommonsConverts between CURIEs (compact URI…
permissive · top 15,000 on PyPI
py-ubjsonEncodes and decodes data in Universal Binary…
permissive · top 5,000 on PyPI
curiesConverts between URIs and compact URIs (CURIEs)…
permissive · top 15,000 on PyPI
yarlyarl provides an immutable URL class for…
permissive · top 100 on PyPI
nestedtextNestedText is a human-friendly file format for…
permissive · top 15,000 on PyPI
canonicaljsonEncodes Python objects to canonical JSON with…
permissive · top 15,000 on PyPI
lazr.uriParse, manipulate, and generate URIs with a…
copyleft · top 15,000 on PyPI