Registry / serialization / fractional-indexing

fractional-indexing

JSON →
library0.1.3pypypi✓ verified 85d ago

A Python implementation of fractional indexing for generating ordering strings (keys) between others, commonly used for sortable IDs in collaborative applications. Current version 0.1.3, stable maintenance mode.

pip install fractional-indexing
INSTALL
IMPORT
SIG · FRACTIONAL-INDEXIN
F
fractional-indexing
serializationpythonv0.1.3
Install
1.8s avg
Import
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 18MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

generate_key_between
from fractional_indexing import generate_key_between
from fractional_indexing import generate_key
generate_n_keys_between
from fractional_indexing import generate_n_keys_between
validate_order_key
from fractional_indexing import validate_order_key

Basic usage of generate_key to create ordering strings.

from fractional_indexing import generate_key # Generate first key key1 = generate_key() print(key1) # e.g., 'a0' # Generate key after key1 key2 = generate_key(after=key1) print(key2) # e.g., 'a1' # Generate key between key1 and key2 key_between = generate_key(between=key1, after=key2) print(key_between) # e.g., 'a0V'
Debug
Known issues
gotchaThe library is not widely tested for concurrent generation; concurrent calls may produce duplicate keys if shared state is not managed.
fix
Ensure single-threaded or use a locking mechanism if generating keys in a multithreaded context.
affects: all
gotchaKeys are not guaranteed to be unique across multiple independent generators with the same initial state. Always start with no arguments to get a unique initial key per session.
fix
Do not reuse keys across different datasets without proper context separation; generate a fresh initial key for each independent ordering.
affects: all
gotchaThe library does not support specifiying a custom base-digit set. It uses a fixed 62-digit set internally.
fix
If you need custom encoding, consider forking the library or using another approach.
affects: all
Upgrade
Version history
0.1.3latest on PyPI · released Aug 13, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources
fractional-indexing — pip install fractional-indexing · libregistry