--- id: ordered-set version: "4.1.0" license: unclear license_treatment: permissive maintenance: dormant --- # ordered-set — An OrderedSet is a custom MutableSet that remembers its order, so that every License: permissive · Maintenance: dormant · Popularity: top 1,000 on PyPI ## Install pip install ordered-set uv add ordered-set poetry add ordered-set ## Description [![Pypi](https://img.shields.io/pypi/v/ordered-set.svg)](https://pypi.python.org/pypi/ordered-set) An OrderedSet is a mutable data structure that is a hybrid of a list and a set. It remembers the order of its entries, and every entry has an index number that can be looked up. ## Installation `ordered_set` is available on PyPI and packaged as a wheel. You can list it as a dependency of your project, in whatever form that takes. To install it into your current Python environment: pip install ordered-set To install the code for development, after checking out the repository: pip install flit flit install ## Usage examples An OrderedSet is created and used like a set: >>> from ordered_set import OrderedSet >>> letters = OrderedSet('abracadabra') >>> letters OrderedSet(['a', 'b', 'r', 'c', 'd']) >>> 'r' in letters True It is efficient to find the index of an entry in an OrderedSet, or find an entry by its index. To help with this use case, the `.add()` method returns the index of the added item, whether it was already in the set or not. >>> letters.index('r') 2 >>> letters[2] 'r' >>> letters.add('r') 2... ## AI interpretation — verify before relying A mutable set that preserves insertion order and supports index-based access, combining set operations with list-like random lookup and slicing. Verdict: A lightweight, dependency-free ordered set implementation suitable for production use. Dormant maintenance and a two-year gap since the last release are typical for a stable, feature-complete library, but users should be aware that bug fixes or compatibility updates may be slow. No known vulnerabilities. [View on SkillFed](https://skillfed.io/packages/ordered-set) · [View on PyPI](https://pypi.org/project/ordered-set/)