VCollab Short UID - short, URL-safe unique identifier generator
Project description
Short UID Generator
Purpose
VCollab applications frequently need short, unique identifiers for temporary file names, directory names, session IDs, or other scenarios where brief, collision-resistant strings are needed.
The vcti-short-uid package provides ShortUID -- a generator that
produces URL-safe identifiers by hashing a combination of entropy,
salt, timestamp, and randomness. The result is truncated to a
configurable length (default: 8 characters).
This package has zero external dependencies.
Installation
From GitHub (recommended for development)
# Latest main branch
pip install vcti-short-uid
### From a GitHub Release
Download the wheel from the
[Releases](https://github.com/vcollab/vcti-python-short-uid/releases)
page and install directly:
```bash
pip install vcti-short-uid>=1.2.1
In requirements.txt
vcti-short-uid>=1.2.1
In pyproject.toml dependencies
dependencies = [
"vcti-short-uid>=1.2.1",
]
Quick Start
from vcti.shortuid import ShortUID
# One-shot generation (no instance needed)
uid = ShortUID.quick() # e.g. "a3Bx9kLm"
# Reusable generator with entropy seed
gen = ShortUID(entropy="my-app")
uid1 = gen.generate() # 8-char default
uid2 = gen.generate(salt="report.pdf") # salt adds context
# Custom length
long_uid = ShortUID.quick(length=16) # 16-char ID
Public API
ShortUID(entropy=None, length=8)
Create a generator instance.
| Parameter | Type | Default | Description |
|---|---|---|---|
entropy |
str | None |
None |
Optional base entropy seed |
length |
int |
8 |
Number of characters in generated IDs (range: 1--43) |
Raises:
TypeError-- iflengthis not an integer, orentropyis not a string/None.ValueError-- iflengthis outside the range[1, 43].
ShortUID.generate(salt=None) -> str
Generate a short, URL-safe unique identifier.
| Parameter | Type | Default | Description |
|---|---|---|---|
salt |
str | None |
None |
Additional context string |
Raises:
TypeError-- ifsaltis not a string/None.
ShortUID.quick(length=8) -> str (classmethod)
Convenience one-liner -- creates a temporary instance and generates one ID.
repr(ShortUID(...))
Returns a string like ShortUID(entropy='my-app', length=8) for debugging.
Documentation
- Design -- Concepts and trade-offs
- Source Guide -- Codebase walkthrough
- API Reference -- Autodoc for all modules
- Changelog -- Release history
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcti_short_uid-1.2.1.tar.gz.
File metadata
- Download URL: vcti_short_uid-1.2.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a15f908bd901dbb92615370349f3c44639bc75f074de88d582870db7f419c88b
|
|
| MD5 |
ffaabb13bafb7878f42c736900150589
|
|
| BLAKE2b-256 |
0f88d8dd0e09175ee5c0679f23109a0e7ecae43518cef1bda7a128e35bf00a01
|
Provenance
The following attestation bundles were made for vcti_short_uid-1.2.1.tar.gz:
Publisher:
publish.yml on vcollab/vcti-python-short-uid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_short_uid-1.2.1.tar.gz -
Subject digest:
a15f908bd901dbb92615370349f3c44639bc75f074de88d582870db7f419c88b - Sigstore transparency entry: 1155563573
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-short-uid@4b36058867d2db470be46e510d3ad8556237953d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4b36058867d2db470be46e510d3ad8556237953d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vcti_short_uid-1.2.1-py3-none-any.whl.
File metadata
- Download URL: vcti_short_uid-1.2.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52b474d8ea7353ed0914ebb6fa7c9dde9e1efbd255fce2a3f6e2aa0192e155ab
|
|
| MD5 |
9aa35093f670dc9968e2ea0f75f988a4
|
|
| BLAKE2b-256 |
e0510d1d167ebcad6a2789d8ec455379fae94651d89b22f8c9315cbbc7222ccc
|
Provenance
The following attestation bundles were made for vcti_short_uid-1.2.1-py3-none-any.whl:
Publisher:
publish.yml on vcollab/vcti-python-short-uid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_short_uid-1.2.1-py3-none-any.whl -
Subject digest:
52b474d8ea7353ed0914ebb6fa7c9dde9e1efbd255fce2a3f6e2aa0192e155ab - Sigstore transparency entry: 1155563575
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-short-uid@4b36058867d2db470be46e510d3ad8556237953d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4b36058867d2db470be46e510d3ad8556237953d -
Trigger Event:
workflow_dispatch
-
Statement type: