pksuid
Python package for generating prefixed ksuids.
What it is and what it does
PKSUID is a Python implementation of prefixed k-sortable unique identifiers, extending the KSUID specification (originally from Segment.io) by adding a human-readable prefix inspired by Stripe's ID format. When you generate a PKSUID with a prefix like 'usr', you get an identifier such as 'usr_24OnhzwMpa4sh0NQmTmICTYuFaD'—the prefix immediately signals the resource type, making logs and traces easier to read and debug.
The library encodes a timestamp and a random payload into each ID, making them sortable by creation time. You can extract the prefix, timestamp, datetime, and raw payload from any PKSUID, parse IDs back from string or byte representations, and compare IDs using standard comparison operators. The package depends only on pybase62 for base-62 encoding and is tested on Python 3.6 through 3.10.
Use it for:
- Generate resource IDs in APIs or databases where you want the type visible at a glance (e.g., 'usr_...', 'txn_...').
- Create sortable audit logs or event streams where IDs encode creation time and can be ordered without a separate timestamp field.
- Parse and extract metadata (prefix, timestamp, payload) from existing PKSUIDs for debugging or resource tracking.
- Replace generic UUIDs in microservices where human-readable prefixes improve operational visibility.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates prefixed, k-sortable unique identifiers (PKSUIDs) that combine a human-readable prefix with a timestamp and random payload, making resource types immediately visible in logs and traces.
No. The package is abandoned (last release 2022-05-07, no commits since) and receives no maintenance or security updates. While the code is simple and low-friction to install, relying on unmaintained ID generation in production is a risk. For new projects, consider an actively maintained alternative; for existing code already using pksuid, evaluate whether you can migrate to a supported library.
Install
pksuid on PyPI
pip
pip install pksuiduv
uv add pksuidpoetry
poetry add pksuidInstalling pksuid
Before you install
Low install friction; pure Python wheel with a single dependency (pybase62). However, the package is abandoned—last release was 2022-05-07 and no commits since then. No maintenance or security updates are forthcoming.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or redistribution in commercial or private projects.
Quickstart
pip install pksuid
from pksuid import PKSUID
# Generate a new prefixed ID
uid = PKSUID('usr')
print(uid) # e.g., 'usr_24OnhzwMpa4sh0NQmTmICTYuFaD'
# Extract components
print(uid.get_prefix()) # 'usr'
print(uid.get_timestamp()) # Unix timestamp
print(uid.get_datetime()) # Human-readable datetime
# Parse from string
uid_from_string = PKSUID.parse('usr_24OnhzwMpa4sh0NQmTmICTYuFaD')
print(uid_from_string.get_timestamp())
Verify before relying
- Whether the package remains compatible with Python versions released after 2022-05-07.
- Whether pybase62 has received security or compatibility updates that pksuid does not track.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pybase62 |
| Maintenance | abandoned — 1,560 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 359,190/month — #7,252 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pksuid-1.1.2-py3-none-any.whl
Keywords: uid, uuid, ksuid, pksuid
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
ksuidGenerates sortable unique identifiers (KSUIDs)…
permissive · top 15,000 on PyPI
cyksuidGenerates and parses KSUIDs (K-Sortable…
permissive · top 15,000 on PyPI
svix-ksuidGenerates and parses KSUIDs (K-sorted unique…
permissive · top 15,000 on PyPI
timeflakeGenerates 128-bit, time-ordered, URL-safe…
permissive · top 15,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
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
uuidProvides UUID object creation and RFC…
unclear · top 5,000 on PyPI
prefixedPrefixed provides a Float subclass that formats…
copyleft · top 5,000 on PyPI