
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Tiny, dependency-free Snowflake-style and random short ID generator for Python.
Tiny, dependency-free Snowflake-style ordered IDs and ultra-short random IDs for Python 3.9 +
Need a sortable primary-key like Twitter’s Snowflake, or just a compact URL-safe slug?
short-unique-id
gives you both—without C extensions or heavy dependencies.
pip install short-unique-id
Or grab the latest dev build:
pip install git+https://github.com/Purushot14/short-unique-id.git
import short_unique_id as suid
# 12-character, URL-safe string (random)
slug = suid.generate_short_id()
print(slug) # → "aZ8Ft1jK2L3q"
# Ordered, 64-bit Snowflake integer
snowflake = suid.get_next_snowflake_id()
print(snowflake) # → 489683493715968001
Need higher entropy or longer range? Pass a custom mult
(time multiplier):
slug = suid.generate_short_id(mult=1_000_000)
snowflake = suid.get_next_snowflake_id(mult=1_000_000)
Generator | Mean time / 1 000 ids | Bytes / id |
---|---|---|
short-unique-id | 0.75 ms | 12 |
uuid.uuid4() | 1.90 ms | 36 |
ulid-py (ULID) | 2.15 ms | 26 |
† MacBook M3, Python 3.13, single thread, timeit.repeat
5 × 1000.
Function | Returns | Description | Key Args |
---|---|---|---|
generate_short_id(mult: int = 10_000) → str | 12-char base‑62 string | Random but unique within the given time bucket. | mult – bucket size (↑ = ↑ entropy) |
get_next_snowflake_id(mult: int = 10_000) → int | 64-bit int | Monotonic, timestamp‑encoded Snowflake ID. | mult – ticks per ms |
BIGINT
)git clone https://github.com/Purushot14/short-unique-id && cd short-unique-id
poetry install
– sets up venv & dev toolspoetry run pytest
– all green? start hacking!ruff check . --fix && ruff format .
before PRsMake sure you’ve added pre-commit as a dev dependency:
poetry add --dev pre-commit
Set up the Git hook and run it against all files:
poetry run pre-commit install
poetry run pre-commit run --all-files
See CHANGELOG. Notable releases:
Version | Date | Highlights |
---|---|---|
0.2.1 | 2025-05-20 | Python3.13 support added and Badges added on readme |
0.2.0 | 2025-05-19 | Repo rename, Poetry build, SEO README, classifiers & keywords |
0.1.2 | 2018-11-25 | Initial public release |
Distributed under the MIT License © 2018–2025 Purushot14. See LICENSE.
Made with ❤️ for hackers who hate 36‑byte IDs.
FAQs
Tiny, dependency-free Snowflake-style and random short ID generator for Python.
We found that short-unique-id demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.