lexid
Variable width build numbers with lexical ordering.
What it is and what it does
lexid is a micro library that generates sequential IDs with a special property: they maintain lexical ordering across their entire sequence, whether you treat them as strings or numbers. This solves a real problem: most tools that read version tags or build numbers use simple string sorting, which fails for normal numeric sequences. lexid works by preemptively incrementing the leftmost digit and expanding padding when needed, so sequences like "0999" → "11000" preserve order even under naive string comparison.
The package provides both a command-line tool and a Python API. It has minimal dependencies—only the standard library—and supports Python 2 and 3. The use case is narrow but concrete: anywhere you need version or build numbers that will be sorted by tools without semantic version parsing, such as git tags read by shell scripts.
Use it for:
- Generate git version tags that sort correctly when listed with standard sort commands
- Create build numbers for CI/CD systems that display versions without understanding semantic versioning
- Produce sequential IDs for systems that rely on lexical string comparison for ordering
- Maintain version sequences in environments where only basic string sorting is available
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates lexically ordered numerical IDs that maintain sort order whether compared as integers or strings, useful for build numbers and version tags that need to sort correctly without special parsing.
Yes, but only if you have a specific need for lexically sortable sequential IDs and accept the maintenance risk. The package is abandoned (last commit 2021-05-13) and receives no updates, so it's suitable only for stable, self-contained use cases where you don't expect to need fixes or Python version compatibility updates.
Install
lexid on PyPI
pip
pip install lexiduv
uv add lexidpoetry
poetry add lexidInstalling lexid
Before you install
Low install friction with only the standard library's typing module as a runtime dependency. Package is marked abandoned with last commit in 2021-05-13, over 1960 days ago, so expect no maintenance or updates.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or redistribution in commercial or private projects.
Quickstart
$ pip install lexid
$ lexid_incr 1001
1002
Or in Python:
>>> import lexid
>>> lexid.incr("1001")
'1002'
Verify before relying
- Whether the package remains compatible with Python versions released after 2021-04-02
- Real-world performance characteristics when generating large sequences of IDs
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=2.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing |
| Maintenance | abandoned — 1,960 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 534,302/month — #6,134 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lexid-2021.1006-py2.py3-none-any.whl
Keywords: lexical, build, number
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
nocasedictA case-insensitive ordered dictionary that…
copyleft · top 15,000 on PyPI
luhnGenerates and verifies Luhn check digits for…
permissive · top 15,000 on PyPI
release-tagAutomatically creates and optionally pushes…
permissive · top 15,000 on PyPI
indic-numtowordsConverts non-negative integers to their word…
permissive · top 15,000 on PyPI
unicode-rbnfConverts numbers to spelled-out text in…
permissive · top 15,000 on PyPI
natsortnatsort provides natural sorting for strings…
permissive · top 1,000 on PyPI
sqidsSqids encodes numbers into short, unique,…
permissive · top 15,000 on PyPI
orderingsProvides an Ordering enumeration and Compare…
permissive · top 15,000 on PyPI
ulid-pyGenerates and parses ULIDs (Universally Unique…
permissive · top 5,000 on PyPI