Registry / serialization / od
library2.0.2pypypi✓ verified 23d ago

od is a lightweight Python library (version 2.0.2) that provides a shorthand syntax for creating `collections.OrderedDict` instances. It aims to simplify the creation of ordered dictionaries with a concise and readable approach, leveraging Python's flexible syntax to make ordered dictionary construction more intuitive. The library is actively maintained.

pip install od
INSTALL
IMPORT
SIG · OD
O
od
serializationpythonv2.0.2
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.2 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

OrderedDictBuilder
from od import OrderedDictBuilder
from od import od

The quickstart demonstrates importing the 'od' function and using it to construct a `collections.OrderedDict` with a clean, dictionary-like syntax. It then prints the resulting ordered dictionary and its type, confirming that the order is preserved.

from od import od # Create an OrderedDict using shorthand syntax my_ordered_dict = od({ 'first_key': 1, 'second_key': 2, 'third_key': 3 }) print(my_ordered_dict) print(type(my_ordered_dict)) # Verification of order assert list(my_ordered_dict.keys()) == ['first_key', 'second_key', 'third_key']
Debug
Known issues
gotchaFor Python 3.7 and later, standard `dict` objects are guaranteed to preserve insertion order. This means that for many common use cases where `OrderedDict` was previously essential, a regular `dict` might now suffice and offer better performance or simpler code. Users should evaluate if they genuinely require `collections.OrderedDict`'s specific behaviors (like `move_to_end` or `popitem`'s LIFO/FIFO behavior) or if a standard `dict` meets their needs.
fix
Consider using a standard `dict` (e.g., `my_dict = {'a': 1, 'b': 2}`) unless the specific API or performance characteristics of `collections.OrderedDict` are required beyond simple insertion order preservation.
affects: Python 3.7+
gotchaThe `od` library provides a convenient shorthand for *constructing* `collections.OrderedDict` instances. It does not replace or extend the full `OrderedDict` API. If you need to use specific `OrderedDict` methods (e.g., `move_to_end()`, `popitem(last=False)`), you will still interact directly with the `collections.OrderedDict` object returned by `od`.
fix
After creating an ordered dictionary with `od`, interact with it as a standard `collections.OrderedDict` object to access its full range of methods.
affects: All versions of `od`
Upgrade
Version history
2.0.2latest on PyPI · released Feb 7, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
od — pip install od · libregistry