Metadata-Version: 2.4
Name: rhodochrosite
Version: 26.0.2
Summary: Ruby marshal and unmarshal library
Author: Lura Skye, Loris Lacuna
Author-email: Lura Skye <fuyukaii@proton.me>, Loris Lacuna <doriloris@protonmail.com>
License-Expression: MPL-2.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Ruby
Requires-Dist: attrs>=25.4.0
Requires-Python: >=3.13
Project-URL: Homepage, https://codeberg.org/lacusdoloris/rhodochrosite
Description-Content-Type: text/markdown

# Rhodochrosite

Rhodochrosite is a Python 3.13+ library for loading and saving objects in the Ruby marshal format.

## Support and limitations

Rhodochrosite supports nearly every feature of the Marshal library, up to Ruby 4.0. Some parts are
not supported:

- The writer never outputs object links, so both self-referential structures and identity equality
  are broken. Outputting object links will likely never be supported (reading them is supported)
- Ruby strings with custom encodings are not supported; any string that does not mark itself as
  UTF-8 will be treated as a bytestring.
- The "d" type (Data) will never be supported, as it related to native Ruby extensions which don't
  really make sense across the wire barrier

Some features may be supported in the future, but are not currently supported:

- Regular expression types; Ruby uses a different regexp execution engine to Python so these would
  not be very useful beyond being opaque types.
- Hashes with default values,
- Module references.
- Struct instances.

However, some esoteric features that are otherwise annoying to support *are* supported:

- Strings, arrays, and hashes with custom instance variables.
- Hashes with duplicate keys (requires passing ``return_native_dicts=False``)
- Unicode symbol names

## Basic usage

Use `read_object` to turn a marshal stream into a single high-level Python object:

```py
print(read_object(b'\x04\b"\babc'))  # => "abc"
```

Use `write_object` to turn a Python object into a marshal stream:

```py
print(write_object([1, 2, 3]))  # => b"\x04\b[\bi\x06i\ai\b"
```
