--- id: fractional-indexing version: "0.1.3" license: CC0 1.0 Universal license_treatment: permissive maintenance: active --- # fractional-indexing — Provides functions for generating ordering strings License: permissive · Maintenance: active · Downloads: 217.5K/mo ## 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 above — 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 pip install fractional-indexing uv add fractional-indexing poetry add fractional-indexing ## Installing 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: unspecified - Install friction: low - Maintenance: active - Downloads: 217.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags fractional indexing keys, ordered sequence insertion, realtime collaborative editing, generate sort keys between values, ordering without reindexing, position keys for lists, collaborative-editing, ordering-algorithm, distributed-systems [View on SkillFed](https://skillfed.io/packages/fractional-indexing) · [View on PyPI](https://pypi.org/project/fractional-indexing/)