Registry / serialization / kim-edn

kim-edn

JSON →
library1.4.1pypypi✓ verified 85d ago

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.

pip install kim-edn
INSTALL
IMPORT
SIG · KIM-EDN
K
kim-edn
serializationpythonv1.4.1
Install
1.6s avg
Import
9ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.007s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

loads, dumps
from kim_edn import loads, dumps
import kim_edn.reader
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.

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.

from kim_edn import loads, dumps # Example EDN string with a keyword and integer value edn_string = '{:a 1}' # Deserialize the EDN string to a Python dictionary python_dict = loads(edn_string) print(f"Deserialized: {python_dict} (type: {type(python_dict)})\n") # Modify the dictionary (EDN keywords become Python keywords for keys) python_dict[':b'] = "hello" # Serialize the Python dictionary back to an EDN string new_edn_string = dumps(python_dict) print(f"Serialized: {new_edn_string}") # Example with a list and map complex_edn = '[1 2 {:c "test"}]' complex_python = loads(complex_edn) print(f"\nComplex Deserialized: {complex_python}")
Debug
Known issues
breakingStarting 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.
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'`).
affects: >=1.4.0
breakingThe 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.
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`.
affects: >=1.1.0
gotchaAs 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.
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.
affects: >=1.4.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'kim_edn'
The 'kim-edn' package is not installed in your current Python environment.
fix
Run `pip install kim-edn` to install the package.
AttributeError: module 'kim_edn' has no attribute 'read_edn_string'
You are attempting to use an old API function (`read_edn_string`) that was removed or refactored in `kim-edn` v1.1.0.
fix
Replace `kim_edn.reader.read_edn_string` with `kim_edn.loads` and ensure you import `loads` directly: `from kim_edn import loads`.
kim_edn.reader.BadEDNString: Invalid EDN string: ...
The EDN string you are trying to parse has a syntax error or is malformed according to the EDN specification.
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.
Upgrade
Version history
1.4.1latest on PyPI · released Mar 22, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
kim-edn — pip install kim-edn · libregistry