collections-extended
Extra Python Collections - bags (multisets) and setlists (ordered sets)
What it is and what it does
collections_extended is a pure Python library that adds four specialized collection types to Python's standard library. It provides bag (a multiset that tracks element counts), setlist (an ordered set combining list indexing with set uniqueness), bijection (a bidirectional one-to-one mapping), and IndexedDict (a dictionary that also supports integer index access). Each type has a frozen (hashable) variant. The library has no external dependencies and works with Python 3.6, 3.7, 3.8, 3.9, 3.10 and PyPy3.
The package is useful when you need collections with specific semantics that the standard library doesn't provide—for instance, when you need to count occurrences of items like a Counter but with removal semantics, or when you need both fast membership testing and positional access like a set and a list combined. However, the project is no longer maintained: the last release was 2022-01-23 and the last commit 2023-03-12, so it will not receive updates or bug fixes.
Use it for:
- Track element frequencies with removal: use bag when you need multiset semantics with count() and remove() operations.
- Maintain insertion order with uniqueness: use setlist when you need a list that forbids duplicates and supports fast membership testing.
- Bidirectional key-value mapping: use bijection when you need to look up values by key and keys by value interchangeably.
- Access dictionary entries by position: use IndexedDict when you need both key-based and index-based access to an ordered mapping.
- Range-based lookups: use RangeMap to map contiguous ranges (dates, numbers) to values and query which range contains a given point.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides four specialized collection types—bag (multiset), setlist (ordered set), bijection (one-to-one mapping), and IndexedDict (ordered dict with index access)—as pure Python implementations with no external dependencies.
Yes, if you need one of these specialized collection types and can accept that the package will not receive updates. The code is stable, has no dependencies, and works with current Python versions. No, if you require active maintenance or plan to rely on future bug fixes—consider whether the standard library or a maintained alternative meets your needs instead.
Install
collections-extended on PyPI
pip
pip install collections-extendeduv
uv add collections-extendedpoetry
poetry add collections-extendedInstalling collections-extended
Before you install
Installation is frictionless—a pure Python wheel with no runtime dependencies. However, the package is marked abandoned with no commits since 2023-03-12 and no releases for over a year, so expect no maintenance or bug fixes going forward.
License in practice
Licensed under Apache-2.0 (permissive), which allows commercial and private use with minimal restrictions—suitable for most projects without legal concern.
Quickstart
pip install collections-extended
from collections_extended import bag, setlist, bijection, IndexedDict
b = bag('abracadabra')
print(b.count('a')) # 5
sl = setlist('abracadabra')
print(sl[0]) # 'a'
bij = bijection({'a': 1, 'b': 2})
print(bij.inverse[1]) # 'a'
idict = IndexedDict()
idict['key'] = 'value'
print(idict.get(index=0)) # 'value'
Requires Python >=3.7,<4.0; Python 2 is not supported.
Verify before relying
- Performance characteristics compared to standard dict/set for large datasets
- Real-world adoption patterns and whether abandonment poses practical risk for your use case
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.7,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,664 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 731,821/month — #5,204 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: collections_extended-2.0.2-py3-none-any.whl
Keywords: collections, bag, multiset, ordered set, unique list
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
jaraco.collectionsProvides specialized collection classes that…
permissive · top 5,000 on PyPI
multisetProvides a mutable and immutable multiset data…
permissive · top 15,000 on PyPI
sortedcollectionsProvides specialized sorted collection data…
permissive · top 15,000 on PyPI
ordered-setOrderedSet is a mutable collection that…
permissive · top 1,000 on PyPI
frozenlistProvides a list-like container that starts…
permissive · top 100 on PyPI
sortedcontainersProvides sorted list, dict, and set data…
permissive · top 1,000 on PyPI
immutablesProvides an immutable mapping type backed by a…
permissive · top 5,000 on PyPI
frozendictProvides an immutable, hashable dictionary…
copyleft · top 5,000 on PyPI
itypesProvides immutable container types (Dict and…
permissive · top 5,000 on PyPI
orderly-setProvides multiple ordered set implementations…
permissive · top 1,000 on PyPI