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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.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.fixConsider 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`.fixAfter 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.