Skip to main content

disclaimer

i can't guarantee the quality of this software, don't rely on it for anything serious

(also parts of it were made with (or by) gen-AI)

probably better use it if you want to hack on it, and fork/submit PRs

what

a quick thing built with the goal to work with RON (Rust Object Notation) files in pure python

https://github.com/ron-rs/ron/issues/306

why

because I wanted to write some scripts against RON files, and couldn't find anything usable, so I threw some code together with gemini and ANTLR4

installation

PyPI link: https://pypi.org/project/ron-python/

pip install ron-python

Or with modern alternative

uv add ron-python

Or, if you want a development version, feel free to use something like that

uv add git+https://github.com/juliancoffee/ron-py

(I'd recomment to pin it to a specific commit though)

how to use

Stable docs: https://juliancoffee.github.io/ron-py/latest/ron.html

Main branch docs: https://juliancoffee.github.io/ron-py/dev/ron.html

There's FromRonMixin which gives you from_ron method.

from dataclasses import dataclass
from ron import FromRonMixin

@dataclass
class Click(FromRonMixin):
  x: int
  y: int

obj = Click.from_ron("Click(x: 10, y: 20)")
assert isinstance(res1, Click)
assert res1.x == 10

Or there's more low-level API if that's your thing.

from ron import parse_ron
from ron.models import RonStruct

def test_struct_as_key():
    data = r"""
    {
        UserID(123): "Admin",
        UserID(456): "Guest"
    }
    """
    # yes, you can just parse it to raw object
    obj = parse_ron(data)

    # type-narrow it
    raw_map = obj.expect_map()
    assert len(raw_map.entries) == 2

    keys = list(raw_map.entries.keys())
    target_key = keys[0]
    # or compare to internal types
    # sneak peek, we also have spans (only for struct field values though, as of now)
    # use `parse_ron(src, with_spans=True)`
    assert target_key == RonStruct("UserID", (123,), spans=None)
    assert raw_map.entries[target_key] == "Admin"

Alternatively, there's __getitem__ implementation, which loses some type strictness, but is super convenient.

def test_deep_chaining_nested_structures():
    ron_str = """
        Player(
            stats: { "attributes": [10, 15] },
            inventory: [ Item(name: "Sword") ]
        )
    """
    obj = parse_ron(ron_str)

    # use a struct like you'd use dict
    strength = obj["stats"]["attributes"][0]
    assert strength.expect_int() == 10

    # can be infinitely nested, until you jump out with `expect_*` method
    weapon = obj["inventory"][0]["name"]
    assert weapon.expect_str() == "Sword"

def test_unit_struct_lookup():
    obj = parse_ron('{ King: "Crown" }')

    # or even go bonkers and do this
    assert obj["King"].expect_str() == "Crown"

Check out tests and main.py in the root for more (and, potentially, more up-to-date examples).

limitations

doesn't support extensions, yet

contributions

PRs are probably welcome, I don't expect much in terms of the protocol, just use common sense

we even have CI now :D

notable mentions

Metadata

Release files for ron-python 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ron-python 0.0.5
File Size Uploaded Provenance Actions
ron_python-0.0.5.tar.gz 53.6 kB With provenance Details for ron_python-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ron-python 0.0.5
File Interpreter ABI Platform Actions
ron_python-0.0.5-py3-none-any.whl Python 3 none any Details for ron_python-0.0.5-py3-none-any.whl

Total release size: 82.0 kB

Release files / ron_python-0.0.5.tar.gz

Download URL ron_python-0.0.5.tar.gz
Size 53.6 kB
Tags Source
SHA-256 checksum
How to use checksums
433f3dacf5fde0ce9977c2e45b686835d8c0b128e756cd63edd825824030594c
BLAKE2b-256 checksum
How to use checksums
dfd845708245f30ced1ee756e6d182487aafc7aee462425ad264aba4c4c623b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

Release files / ron_python-0.0.5-py3-none-any.whl

Download URL ron_python-0.0.5-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c80955b32c7100fcad4d2f6390e0e625cfb80851681a289151cd9b101127c75
BLAKE2b-256 checksum
How to use checksums
8413fb897778935b239e0d73072a62916818f8538af4ed027f4113d5fc7b60eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

Security for ron-python 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ron_python-0.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page