{"id":1635,"library":"prison","title":"Python Rison Encoder/Decoder","description":"\"prison\" is a Python library providing an encoder and decoder for the Rison data serialization format. Rison (Recursive object notation) is a compact, URL-safe data format designed for representing simple data structures, often used in URLs. The current version is 0.2.1. The library is largely feature-complete for the Rison specification and has a low release cadence.","status":"maintenance","version":"0.2.1","language":"en","source_language":"en","source_url":"https://github.com/betodealmeida/python-rison","tags":["serialization","data-format","rison","url-safe"],"install":[{"cmd":"pip install prison","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"loads","correct":"from prison import loads"},{"symbol":"dumps","correct":"from prison import dumps"}],"quickstart":{"code":"import prison\n\ndata = {'name': 'Alice', 'age': 30, 'tags': ['dev', 'python']}\n\n# Encode Python dict to Rison string\nrison_string = prison.dumps(data)\nprint(f\"Encoded Rison: {rison_string}\")\n# Expected: (name:Alice,age:30,tags:!(dev,python))\n\n# Decode Rison string back to Python dict\ndecoded_data = prison.loads(rison_string)\nprint(f\"Decoded data: {decoded_data}\")\n# Expected: {'name': 'Alice', 'age': 30, 'tags': ['dev', 'python']}","lang":"python","description":"Demonstrates encoding a Python dictionary to a Rison string and then decoding it back. Rison is optimized for URL-safe representation of simple data structures."},"warnings":[{"fix":"Familiarize yourself with the Rison specification, especially regarding object and array delimiters, string quoting rules, and special values like `!n` for null.","message":"Rison is not JSON. Its syntax and supported data types differ significantly. Direct mental mapping from JSON to Rison often leads to parsing errors or unexpected output. For example, objects use parentheses `()` instead of curly braces `{}`, and unquoted identifiers are common.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware that the library's development is quiescent. For mission-critical applications, consider a review of its source code or potential maintenance forks if advanced features or active support become necessary.","message":"The `prison` library has not been updated since August 2021 (v0.2.1). While stable and functional for the existing Rison specification, new Python features, performance optimizations, or edge-case bug fixes are unlikely to be implemented.","severity":"gotcha","affected_versions":"0.2.1 and potentially future versions if no updates occur"},{"fix":"Always validate or sanitize Rison input from untrusted sources. Limit the depth of nested structures and verify data types if parsing user-supplied data.","message":"Deserializing Rison data from untrusted sources with `prison.loads()` carries inherent security risks. While Rison's simplicity mitigates some complex attack vectors found in formats like YAML or Pickle, malicious input could still lead to resource exhaustion (e.g., deep nesting) or unexpected data structures.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}