fractional-indexing
Provides functions for generating ordering strings
What it is and what it does
Fractional indexing is a technique for generating sortable string keys that represent positions in an ordered sequence. Instead of storing explicit numeric indices that require recalculation when items are inserted, you generate a key that sorts between any two existing keys—or at the beginning or end if no neighbors exist. This is particularly useful in collaborative editing systems where multiple clients insert items concurrently without coordinating a central sequence number.
The package provides three main functions: `generate_key_between()` to create a single key between two positions, `generate_n_keys_between()` to generate multiple keys at once, and `validate_order_key()` to check if a key is valid. By default it uses Base62 encoding, but you can supply custom digit sets. The implementation includes variable-length integers and prepend/append optimizations from the original design.
Use it for:
- Collaborative document editors where multiple users insert paragraphs/sections concurrently without a central server assigning indices
- Todo list applications storing item order as string keys in a database, allowing insertions between items without updating all subsequent records
- Real-time multiplayer games maintaining player action order or entity positions in a way that merges concurrent updates
- CMS systems storing content hierarchy where new pages can be inserted between existing ones without reordering the entire tree
- Distributed databases or event logs where you need a total ordering that can be computed locally without coordination
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates sortable string keys for inserting items into ordered sequences without requiring full re-indexing, using fractional indexing to compute positions between existing keys.
Yes, if you need to maintain ordered sequences in a collaborative or distributed context. The package is lightweight, permissively licensed, and solves a specific problem well. The main caveat is that the last release was over a year ago despite active repository commits—verify it works with your target Python version before relying on it in production.
Install
fractional-indexing on PyPI
pip
pip install fractional-indexinguv
uv add fractional-indexingpoetry
poetry add fractional-indexingInstalling fractional-indexing
Before you install
Low friction: pure Python wheel with only setuptools as a runtime dependency. Repository is active with a recent commit (2026-08-06), though the last release was over a year ago (2023-08-13).
License in practice
CC0 1.0 Universal (public domain equivalent) means no restrictions on use, modification, or distribution—you can use this freely in any project without attribution requirements.
Quickstart
from fractional_indexing import generate_key_between
# Insert at the beginning
first = generate_key_between(None, None)
# Returns 'a0'
# Insert after first
second = generate_key_between(first, None)
# Returns 'a1'
Verify before relying
- Whether the package works with modern Python versions (requires_python is empty in metadata)
Package facts
| License | CC0 1.0 Universal (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — setuptools |
| Maintenance | actively maintained — 1,097 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 217,545/month — #9,356 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fractional_indexing-0.1.3-py3-none-any.whl
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
ksuidGenerates sortable unique identifiers (KSUIDs)…
permissive · top 15,000 on PyPI
orderedmultidictorderedmultidict provides a dictionary that…
permissive · top 5,000 on PyPI
ordereddictProvides an OrderedDict implementation for…
permissive · top 15,000 on PyPI
sortedcollectionsProvides specialized sorted collection data…
permissive · top 15,000 on PyPI
django-ordered-modelAdds ordering and reordering capabilities to…
permissive · top 15,000 on PyPI
orderingsProvides an Ordering enumeration and Compare…
permissive · top 15,000 on PyPI
django-sequencesProvides gapless sequence generation for Django…
permissive · top 15,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
fxpmathFxpmath provides fixed-point arithmetic with…
permissive · top 15,000 on PyPI
ulid-pyGenerates and parses ULIDs (Universally Unique…
permissive · top 5,000 on PyPI