httpie/fractional-indexing-python is one of the open-source repositories TopGit tracks, currently at 39 stars, written primarily in Python. Fractional Indexing in Python
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
This is based on Implementing Fractional Indexing
by David Greenspan.
Fractional indexing is a technique to create an ordering that can be used
for Realtime Editing of Ordered Sequences.
This implementation includes variable-length integers and the prepend/append optimization described in David's article.
[!NOTE]
This is a Python port of the original JavaScript implementation from rocicorp/fractional-indexing.
The current version is compatible with v4 of the original (see changelog).
Installation
$ pip install fractional-indexing
Usage
Generate a single key
from fractional_indexing import generate_key_between
# Insert at the beginning
first = generate_key_between(None, None)
assert first == 'a0'
# Insert after 1st
second = generate_key_between(first, None)
assert second == 'a1'
# Insert after 2nd
third = generate_key_between(second, None)
assert third == 'a2'
# Insert before 1st
zeroth = generate_key_between(None, first)
assert zeroth == 'Zz'
# Insert in between 2nd and 3rd (midpoint)
second_and_half = generate_key_between(second, third)
assert second_and_half == 'a1V'
Generate multiple keys
Use this when generating multiple keys at some known position, as it spaces out indexes more evenly and leads to shorter keys.
from fractional_indexing import generate_n_keys_between
# Insert 3 at the beginning
keys = generate_n_keys_between(None, None, n=3)
assert keys == ['a0', 'a1', 'a2']
# Insert 3 after 1st
keys = generate_n_keys_between('a0', None, n=3)
assert keys == ['a1', 'a2', 'a3']
# Insert 3 before 1st
keys = generate_n_keys_between(None, 'a0', n=3)
assert keys == ['Zx', 'Zy', 'Zz']
# Insert 3 in between 2nd and 3rd (midpoint)
keys = generate_n_keys_between('a1', 'a2', n=3)
assert keys == ['a1G', 'a1V', 'a1l']
Validate a key
from fractional_indexing import validate_order_key, FIError
validate_order_key('a0')
try:
validate_order_key('foo')
except FIError as e:
print(e) # fractional_indexing.FIError: invalid order key: foo
Use custom base digits
By default, this library uses Base62 character encoding. To use a different set of digits, pass them in as the digits
argument to generate_key_between(), generate_n_keys_between(), and validate_order_key().
Every key starts with a "head" character that encodes the length of its integer part. Since v4.0.0 (matching the
JS reference v4.0.0), the head alphabet (int_digits) defaults to digits itself, so a custom alphabet produces
self-contained keys drawn only from that alphabet:
To keep the pre-0.2 behaviour (A-Z/a-z head markers, e.g. a0), pass BASE_52_DIGITS as int_digits.
An odd-length alphabet such as Base95 cannot supply its own (even-length) head alphabet, so it must be paired
with an explicit int_digits:
Alphabets are validated: they must be at least two characters, single-byte (char code 0-255), and in strictly
ascending character-code order; int_digits must also have even length. Invalid alphabets raise FIError.
Other Languages
[!IMPORTANT]
See changelog for version compatibility.
This is a Python port of the original JavaScript implementation by @rocicorp. That means that this implementation is byte-for-byte compatible with:
Language
Repo
JavaScript
rocicorp/fractional-indexing
Go
rocicorp/fracdex
Kotlin
darvelo/fractional-indexing-kotlin
Ruby
kazu-2020/fractional_indexer
Changelog
[!NOTE]
Starting with v4, we mirror the major version number of the original JS implementation to indicate compatibility.
4.0.0 (2026-08-06)
Brings the library to parity with rocicorp/fractional-indexing
v4.0.0:
Breaking: the head alphabet now defaults to digits itself, so custom alphabets produce self-contained keys
(e.g. generate_key_between(None, None, digits='0123456789') returns '50', not 'a0'). Pass
int_digits=BASE_52_DIGITS to restore the previous A-Z/a-z head markers. Keys generated with the default
Base62 alphabet are unchanged.
New int_digits argument on generate_key_between(), generate_n_keys_between(), and validate_order_key()
to customise the head alphabet, plus a new BASE_52_DIGITS export.
generate_key_between() now accepts its bounds in either order and swaps them, instead of raising FIError.
Alphabets are validated (length, ascending character-code order, single-byte); invalid alphabets and unknown
digits now raise FIError consistently instead of leaking ValueError.
Digit lookups are cached per alphabet, and the midpoint calculation uses integer arithmetic (the decimal
dependency is gone).
Does httpie/fractional-indexing-python have any tags?
TopGit's last sync did not record any GitHub topics for httpie/fractional-indexing-python. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on httpie/fractional-indexing-python?
The most recent commit recorded on httpie/fractional-indexing-python was 1 month ago, based on the GitHub push timestamp. The repository has 8 forks — one of the better signals of community interest.
How many stars does httpie/fractional-indexing-python have?
httpie/fractional-indexing-python has 39 GitHub stars — refresh the page for the live number, or check github.com/httpie/fractional-indexing-python. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is httpie/fractional-indexing-python?
httpie/fractional-indexing-python (httpie/fractional-indexing-python) is a Python project on GitHub. From the project's own README: Fractional Indexing in Python
What language is httpie/fractional-indexing-python written in?
httpie/fractional-indexing-python is written primarily in Python. GitHub's language field is based on the largest share of bytes in the default branch.
Read full README in the tab above.
Want a second opinion on fractional-indexing-python?
Ask an AI that can read this page — one click and you get its take on fractional-indexing-python.