{"id":2173,"library":"orderedmultidict","title":"Ordered Multivalue Dictionary","description":"orderedmultidict is a Python library that provides an `omdict` class, an ordered multivalue dictionary. It retains the insertion order of both keys and their associated values, and aims for method parity with Python's built-in `dict`. The library is known for powering `furl` and supports both Python 2 and Python 3 environments. The current version is 1.0.2, with the last release dating back to 2019, indicating an infrequent release cadence.","status":"maintenance","version":"1.0.2","language":"python","source_language":"en","source_url":"https://github.com/gruns/orderedmultidict","tags":["dict","multidict","ordered","data-structure","legacy"],"install":[{"cmd":"pip install orderedmultidict","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"omdict","correct":"from orderedmultidict import omdict"}],"quickstart":{"code":"from orderedmultidict import omdict\n\n# Create an empty ordered multivalue dictionary\nomd = omdict()\n\n# Add values for keys\nomd[1] = 'apple'\nomd.add(2, 'banana')\nomd.add(1, 'apricot') # Add another value for key 1\n\n# Access values\nprint(omd[1]) # Accesses the first value for key 1: 'apple'\nprint(omd.getlist(1)) # Gets all values for key 1: ['apple', 'apricot']\n\n# See insertion order\nprint(list(omd.keys())) # Keys in insertion order: [1, 2, 1]\nprint(list(omd.items())) # Items in insertion order: [(1, 'apple'), (2, 'banana'), (1, 'apricot')]","lang":"python","description":"Demonstrates basic instantiation, adding multiple values to a key, and accessing values while preserving insertion order."},"warnings":[{"fix":"Consider migrating to more actively maintained alternatives if long-term support or compatibility with recent Python versions is required.","message":"The `orderedmultidict` library has not seen updates since its 1.0.2 release in July 2019. This means it may not be compatible with newer Python versions beyond 3.9 (as listed on PyPI) and is unlikely to receive bug fixes or new features, potentially leading to compatibility issues or unaddressed vulnerabilities in modern environments.","severity":"gotcha","affected_versions":"<=1.0.2"},{"fix":"For performance-critical applications, evaluate alternatives like `better-orderedmultidict` (PyPI: `better-orderedmultidict`) or `werkzeug.datastructures.MultiDict`, which offer improved speed and active development.","message":"Performance of `orderedmultidict` (omdict) can be significantly slower compared to more optimized alternatives, especially for operations like initialization and iteration over items. Benchmarks suggest an order of magnitude difference in some cases.","severity":"gotcha","affected_versions":"<=1.0.2"},{"fix":"For scenarios only requiring ordered keys with single values, a standard `dict` in Python 3.7+ may suffice. For multi-value requirements, assess if a `dict` of lists adequately meets needs before opting for a specialized multidict.","message":"Since Python 3.7, built-in `dict` objects officially preserve insertion order for keys. While `orderedmultidict` provides additional functionality for multiple values per key and preserves the order of *individual values* as well, the 'ordered' aspect for single-value entries is less unique than it once was.","severity":"gotcha","affected_versions":"<=1.0.2"}],"env_vars":null,"search_vec":"'1.0.2':62 '2':53 '2019':70 '3':56 'aim':31 'associ':28 'back':68 'built':39 'built-in':38 'cadenc':75 'class':13 'current':59 'data':80 'data-structur':79 'date':67 'dict':41,76 'dictionari':3,17 'environ':57 'furl':48 'indic':71 'infrequ':73 'insert':21 'key':25 'known':45 'last':65 'legaci':82 'librari':8,43 'method':33 'multidict':77 'multivalu':2,16 'omdict':12 'order':1,15,22,78 'orderedmultidict':4 'pariti':34 'power':47 'provid':10 'python':7,36,52,55 'releas':66,74 'retain':19 'structur':81 'support':50 'valu':29 'version':60","created_at":"2026-04-09T18:46:38.618171+00:00","updated_at":"2026-04-16T17:48:27.775329+00:00","problems":[{"fix":"Install the package using pip: `pip install orderedmultidict`","cause":"The 'orderedmultidict' package is not installed in the Python environment.","error":"ModuleNotFoundError: No module named 'orderedmultidict'"},{"fix":"Import the `omdict` class explicitly: `from orderedmultidict import omdict`","cause":"The `omdict` class was used without being correctly imported from the `orderedmultidict` library.","error":"NameError: name 'omdict' is not defined"},{"fix":"Use the `getlist()` method to retrieve all values associated with a key as a list: `omd.getlist(key)`","cause":"Unlike a standard dictionary, `orderedmultidict`'s `omdict[key]` access returns only the *last* value associated with that key, similar to Python's built-in `dict` behavior. Users often expect it to return all values due to its 'multivalue' nature.","error":"Retrieving only the last value for a key in orderedmultidict (e.g., `omd[key]` returns one value, not a list)"},{"fix":"Before accessing a key, check if it exists using `if key in omdict_instance:` or use the `get()` method with a default value: `omd.get(key, default_value)`","cause":"Attempting to access a non-existent key in an `omdict` instance using square bracket notation (`omd[key]`) will raise a `KeyError`.","error":"KeyError: 'some_key'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/gruns/orderedmultidict","docs":null,"changelog":null,"pypi":"https://pypi.org/project/orderedmultidict/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}