{"id":9868,"library":"kim-edn","title":"kim-edn","description":"kim-edn is a Python library providing an encoder and decoder for the EDN (Extensible Data Notation) format. It aims to offer a robust and efficient way to serialize and deserialize EDN data structures in Python. The current version is 1.4.1, and releases typically focus on packaging improvements, dependency updates, and minor fixes.","status":"active","version":"1.4.1","language":"en","source_language":"en","source_url":"https://github.com/openkim/kim-edn","tags":["EDN","serialization","data format","KIM","data interchange"],"install":[{"cmd":"pip install kim-edn","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"Pre-v1.1.0, functions like `read_edn_string` were directly accessible from submodules; current standard is `loads` and `dumps` from the top-level package.","wrong":"import kim_edn.reader","symbol":"loads, dumps","correct":"from kim_edn import loads, dumps"}],"quickstart":{"code":"from kim_edn import loads, dumps\n\n# Example EDN string with a keyword and integer value\nedn_string = '{:a 1}'\n\n# Deserialize the EDN string to a Python dictionary\npython_dict = loads(edn_string)\nprint(f\"Deserialized: {python_dict} (type: {type(python_dict)})\\n\")\n\n# Modify the dictionary (EDN keywords become Python keywords for keys)\npython_dict[':b'] = \"hello\"\n\n# Serialize the Python dictionary back to an EDN string\nnew_edn_string = dumps(python_dict)\nprint(f\"Serialized: {new_edn_string}\")\n\n# Example with a list and map\ncomplex_edn = '[1 2 {:c \"test\"}]'\ncomplex_python = loads(complex_edn)\nprint(f\"\\nComplex Deserialized: {complex_python}\")\n","lang":"python","description":"This quickstart demonstrates how to use `kim-edn` to deserialize an EDN string into a Python dictionary and then serialize a Python dictionary back into an EDN string. It covers basic keyword mapping and data structure conversion."},"warnings":[{"fix":"Upgrade your Python environment to 3.8 or newer, or pin `kim-edn` to a version <1.4.0 if older Python compatibility is critical (e.g., `pip install 'kim-edn<1.4.0'`).","message":"Starting from version 1.4.0, kim-edn officially requires Python 3.8 or higher. Installations or executions on older Python versions (e.g., Python 3.7) will fail.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Update your code to use `from kim_edn import loads, dumps` and replace calls to `read_edn_string` with `loads` and `write_edn_string` with `dumps`.","message":"The API underwent significant cleanup and interface changes in v1.1.0, including getting rid of unnecessary keywords and standardizing on `loads` and `dumps`. Older functions like `kim_edn.reader.read_edn_string` are no longer available.","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"To access the tests, you must clone the GitHub repository (`git clone https://github.com/openkim/kim-edn.git`) and find them in the source tree.","message":"As of v1.4.0, the package build process was improved, and tests are no longer included in the final distributed package. If you relied on examining the bundled tests, they will now be absent.","severity":"gotcha","affected_versions":">=1.4.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Run `pip install kim-edn` to install the package.","cause":"The 'kim-edn' package is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'kim_edn'"},{"fix":"Replace `kim_edn.reader.read_edn_string` with `kim_edn.loads` and ensure you import `loads` directly: `from kim_edn import loads`.","cause":"You are attempting to use an old API function (`read_edn_string`) that was removed or refactored in `kim-edn` v1.1.0.","error":"AttributeError: module 'kim_edn' has no attribute 'read_edn_string'"},{"fix":"Carefully review the EDN string for correctness (e.g., mismatched brackets, incorrect keyword syntax, missing spaces, unescaped characters). EDN is case-sensitive and strict about its format.","cause":"The EDN string you are trying to parse has a syntax error or is malformed according to the EDN specification.","error":"kim_edn.reader.BadEDNString: Invalid EDN string: ..."}]}