Skip to main content

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 -- if length is not an integer, or entropy is not a string/None.
  • ValueError -- if length is 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 -- if salt is 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcti_short_uid-1.2.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcti_short_uid-1.2.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Hashes for vcti_short_uid-1.2.1.tar.gz
Algorithm Hash digest
SHA256 a15f908bd901dbb92615370349f3c44639bc75f074de88d582870db7f419c88b
MD5 ffaabb13bafb7878f42c736900150589
BLAKE2b-256 0f88d8dd0e09175ee5c0679f23109a0e7ecae43518cef1bda7a128e35bf00a01

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for vcti_short_uid-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52b474d8ea7353ed0914ebb6fa7c9dde9e1efbd255fce2a3f6e2aa0192e155ab
MD5 9aa35093f670dc9968e2ea0f75f988a4
BLAKE2b-256 e0510d1d167ebcad6a2789d8ec455379fae94651d89b22f8c9315cbbc7222ccc

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page