{"id":24717,"library":"toml-rs","title":"toml-rs","description":"A high-performance TOML parser for Python written in Rust, supporting TOML 1.0 and 1.1. Current version is 0.3.12, released regularly with wheel builds for many platforms including wasm. Requires Python >=3.10.","status":"active","version":"0.3.12","language":"python","source_language":"en","source_url":"https://github.com/lava-sh/toml-rs","tags":["toml","parser","rust","high-performance","TOML 1.0","TOML 1.1"],"install":[{"cmd":"pip install toml-rs","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"toml-rs is not the standard library toml; it's a separate package with module name toml_rs.","wrong":"import toml; toml.loads(...)","symbol":"loads","correct":"from toml_rs import loads"},{"note":"No common wrong import known.","symbol":"dumps","correct":"from toml_rs import dumps"},{"note":"Load from file.","symbol":"load","correct":"from toml_rs import load"},{"note":"Returns parsed TOML with metadata.","symbol":"load_with_metadata","correct":"from toml_rs import load_with_metadata"}],"quickstart":{"code":"import toml_rs\n\ntoml_string = \"\"\"\ntitle = \"Example\"\n[owner]\nname = \"Alice\"\n\"\"\"\n\nparsed = toml_rs.loads(toml_string)\nprint(parsed[\"title\"])  # Example\nprint(parsed[\"owner\"][\"name\"])  # Alice\n\n# With metadata\ntoml_string = \"x = 1\"\nresult = toml_rs.load_with_metadata(toml_string, toml_version=\"1.0.0\")\nprint(result.data)  # {'x': 1}\nprint(result.meta)  # metadata object","lang":"python","description":"Basic parsing with loads() and load_with_metadata()."},"warnings":[{"fix":"Use 'import toml_rs'.","message":"The module name is 'toml_rs' (underscore), not 'toml'. Do not import toml (standard library) or toml-rs (hyphen).","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass toml_version='1.0.0' or '1.1.0' explicitly.","message":"The toml_version parameter in loads() and load() defaults to '1.0.0' but may be removed in future; specify explicitly if you rely on 1.0 behavior.","severity":"deprecated","affected_versions":"0.3.x"},{"fix":"Normalize input to use '\\n' line endings.","message":"TOML strings with carriage return ('\\r') not followed by newline ('\\n') raise TOMLDecodeError. This is stricter than some parsers.","severity":"gotcha","affected_versions":">=0.3.3"},{"fix":"Access via result.data and result.meta.","message":"load_with_metadata() returns an object with .data and .meta attributes; it does not return a tuple.","severity":"gotcha","affected_versions":">=0.3.4"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'import toml_rs' (the module name is toml_rs, not toml).","cause":"Trying to import 'toml' instead of 'toml_rs'.","error":"ModuleNotFoundError: No module named 'toml'"},{"fix":"Replace '\\r' with '\\r\\n' or '\\n' before parsing.","cause":"Input contains a bare carriage return character (\\r) not followed by newline (\\n).","error":"toml_rs._lib.TOMLDecodeError: TOML parse error at line 1, column 9 ... carriage return must be followed by newline, expected newline"},{"fix":"Upgrade to latest: pip install --upgrade toml-rs","cause":"Using an older version (<0.2.0?) that doesn't support toml_version.","error":"TypeError: loads() got an unexpected keyword argument 'toml_version'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}