"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.
pip install prisonVerified import paths — ran on the pinned version, not inferred.
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.
Familiarize yourself with the Rison specification, especially regarding object and array delimiters, string quoting rules, and special values like `!n` for null.
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.
Always validate or sanitize Rison input from untrusted sources. Limit the depth of nested structures and verify data types if parsing user-supplied data.
pip install prison
Ensure the Rison string conforms to the Rison specification. If constructing the string manually, be mindful of characters like '!', '(', ')', ':', and ',' and use `prison.dumps()` to serialize Python objects into valid Rison. For example, `prison.loads("(key:value)")` for an object, or `prison.loads("!(item1,item2)")` for an array.Verify that your Rison string adheres to the correct syntax. For object keys, ensure they are followed by a colon and a value, e.g., `(key:value)`. Use `prison.dumps()` to reliably generate correct Rison strings.
Import the 'prison' module and access its functions as attributes, e.g., `import prison` then `prison.dumps()` or `prison.loads()`.
No dependency data recorded yet.