{"id":22006051,"url":"https://github.com/emmatyping/ryaml","last_synced_at":"2025-07-24T19:31:06.096Z","repository":{"id":45866462,"uuid":"384842356","full_name":"emmatyping/ryaml","owner":"emmatyping","description":"Python yaml library using Rust","archived":false,"fork":false,"pushed_at":"2024-02-22T21:48:39.000Z","size":37,"stargazers_count":26,"open_issues_count":5,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-23T01:43:44.519Z","etag":null,"topics":["parser","rust","yaml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emmatyping.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-11T02:11:28.000Z","updated_at":"2024-11-15T17:03:29.000Z","dependencies_parsed_at":"2024-01-16T10:36:18.828Z","dependency_job_id":"395e2c59-014e-49ce-8065-27662629e07b","html_url":"https://github.com/emmatyping/ryaml","commit_stats":null,"previous_names":["emmatyping/ryaml"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmatyping%2Fryaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmatyping%2Fryaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmatyping%2Fryaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmatyping%2Fryaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emmatyping","download_url":"https://codeload.github.com/emmatyping/ryaml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227470072,"owners_count":17778930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parser","rust","yaml"],"created_at":"2024-11-30T01:02:10.599Z","updated_at":"2024-12-01T02:13:32.694Z","avatar_url":"https://github.com/emmatyping.png","language":"Python","readme":"ryaml\n=====\n\n### *Quickly and safely parse yaml*\n\n### What is ryaml?\n\nryaml is a Python library that wraps a Rust yaml parser, [serde-yaml](https://github.com/dtolnay/serde-yaml), to quickly and safely parse and dump yaml to and from Python objects.\n\nIt is *not* compatible with PyYAML, but has a similar design to the `json` module.\n\nThe hope is this will be used as a safe and fast yaml parser in lieu of PyYAML.\n\n## Installation\n\nWe ship binary wheels for Windows, Linux, and macOS, so as long as you are using Python 3.7+,\nyou can run:\n\n```\n$ python -m pip install ryaml\n```\n\nOtherwise, you will need to build from source. To do so, first install Rust 1.41 stable.\n\nThen you should be able to just\n\n```shell\n$ git clone https://github.com/ethanhs/ryaml\n$ cd ryaml\n$ python -m pip install .\n```\n\nOr if you want to build a wheel:\n\n```shell\n$ git clone https://github.com/ethanhs/ryaml\n$ cd ryaml\n$ python -m pip install maturin\n$ maturin build --release --no-sdist\n# OR if you want an abi3 wheel (compatible with Python 3.7+)\n$ maturin build --release --no-sdist --cargo-extra-args=\"--features=abi3\"\n```\n\nAnd a wheel will be created in `target/wheels` which you can install.\n\n## Usage\n\nThe API of `ryaml` is very similar to that of `json` in the standard library:\n\nYou can use `ryaml.loads` to read from a `str`:\n\n```python\nimport ryaml\nobj = ryaml.loads('key: [10, \"hi\"]')\nassert isinstance(obj, dict) # True\nassert obj['key'][1] == \"hi\" # True\n```\n\nAnd `ryaml.dumps` to dump an object into a yaml file:\n\n```python\nimport ryaml\ns = ryaml.dumps({ 'key' : None })\nprint(s)\n# prints:\n# ---\n# key: ~\n```\n\nThere are also `ryaml.load` and `ryaml.load_all` to read yaml document(s) from files:\n\n```python\nimport ryaml\nobj = {'a': [{'b': 1}]}\nwith open('test.yaml', 'w') as w:\n    ryaml.dump(w, obj)\nwith open('test.yaml', 'r') as r:\n    assert ryaml.load(r) == obj\nwith open('multidoc.yaml', 'w') as multi:\n    multi.write('''\n---\na:\n  key:\n...\n---\nb:\n  key:\n    ''')\nwith open('multidoc.yaml', 'r') as multi:\n    docs = ryaml.load_all(multi)\nassert len(docs) == 2\nassert docs[0]['a']['key'] is None\n```\n\n`ryaml.load_all` will, as seen above, load multiple documents from a single file.\n\n\n## Thanks\n\nThis project is standing on the shoulders of giants, and would not be possible without:\n\n[pyo3](https://pyo3.rs/)\n\n[serde-yaml](https://github.com/dtolnay/serde-yaml)\n\n[yaml-rust](https://github.com/chyh1990/yaml-rust)\n\n[pyo3-file](https://github.com/omerbenamram/pyo3-file)\n\n[pythonize](https://github.com/davidhewitt/pythonize)\n","funding_links":[],"categories":["Python","Utilities"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmatyping%2Fryaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmatyping%2Fryaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmatyping%2Fryaml/lists"}