timeflake
Timeflake is a 128-bit, roughly-ordered, URL-safe UUID. Inspired by Twitter's Snowflake, Instagram's ID and Firebase's PushID.
What it is and what it does
Timeflake is a 128-bit unique identifier that combines a 48-bit millisecond timestamp with an 80-bit cryptographically random component, designed to be both sortable and collision-resistant. Unlike UUID v1 (which leaks network info) or UUID v4 (which is random and fragments database indices), Timeflake orders by time in its most significant bits, keeping database indices compact and fast while remaining unpredictable within each millisecond.
The package provides multiple encodings—128-bit unsigned int, hex, URL-safe base62 (22 chars), and raw bytes—and is fully compatible with Python's standard uuid.UUID type. It includes optional extensions for Django ORM and Peewee, making it practical for use as a primary key in relational databases. No external dependencies are required.
Use it for:
- Use as a primary key in MySQL, Postgres, or SQLite3 to maintain insertion order and avoid index fragmentation.
- Generate unpredictable but sortable IDs for URLs and APIs where auto-increment integers are too predictable.
- Create distributed IDs across multiple machines without coordination or a centralized ID service.
- Replace UUID v4 in applications where both randomness and temporal ordering improve query performance.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates 128-bit, time-ordered, URL-safe unique identifiers (UUIDs) with millisecond-precision timestamps and cryptographic randomness, compatible with standard uuid.UUID.
Yes, if you need sortable, collision-resistant IDs for databases or URLs and want zero external dependencies. The library is stable and well-tested, but note that maintenance is dormant (last update 2023-09-01). Not suitable for security-sensitive use (password tokens, API keys); use Python's secrets module for those. Be aware that time-encoded IDs can leak privacy information about when and where content was created.
Install
timeflake on PyPI
pip
pip install timeflakeuv
uv add timeflakepoetry
poetry add timeflakeInstalling timeflake
Before you install
Low install friction; pure Python with no runtime dependencies. Dormant maintenance (last commit 2023-09-01, 1078 days ago) but stable and archived repository shows no active development planned.
License in practice
MIT license permits commercial and private use with minimal restrictions; attribution required but no copyleft obligations.
Quickstart
import timeflake
# Create a random Timeflake
flake = timeflake.random()
print(flake.base62) # '00mx79Rjxvfgr8qat2CeQDs'
print(flake.timestamp) # 1579091935216
# Parse existing flake
flake = timeflake.parse(from_base62='0002HCZffkHWhKPVdXxs0YH')
Verify before relying
- Whether the 2^80 random bits per millisecond provide sufficient collision avoidance for your specific throughput and scale requirements.
- Current maintenance status and whether dormancy affects production readiness for your use case.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,078 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 190,387/month — #9,912 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: timeflake-0.4.3-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
ksuidGenerates sortable unique identifiers (KSUIDs)…
permissive · top 15,000 on PyPI
ulid-pyGenerates and parses ULIDs (Universally Unique…
permissive · top 5,000 on PyPI
python-ulidGenerates and manipulates ULIDs (universally…
permissive · top 5,000 on PyPI
uuid-extensionGenerates UUID version 7…
unclear · top 15,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
uuid7Generates version 7 UUIDs that are…
permissive · top 5,000 on PyPI
pksuidGenerates prefixed, k-sortable unique…
permissive · top 15,000 on PyPI
svix-ksuidGenerates and parses KSUIDs (K-sorted unique…
permissive · top 15,000 on PyPI
shortuuidGenerates concise, URL-safe unique identifiers…
permissive · top 1,000 on PyPI
nanoidGenerates cryptographically secure,…
permissive · top 5,000 on PyPI