Skip to main content

Human Readable ID (hrid) generates short, human-readable, collision-aware, friendly IDs that are ideal for experiments, jobs, and filenames.

Project description

hrid logo Human Readable ID

PyPI Python Version Tests Copier Template License

Human Readable ID (hrid) generates short, human-readable, collision-aware, friendly IDs that are ideal for experiments, jobs, and filenames.

Why human-readable-id?

Traditional IDs (UUIDs, hashes) are:

  • hard to read
  • hard to remember
  • hard to communicate
  • unpleasant in logs, filenames, and UIs

human-readable-id produces identifiers like:

gentle_river_42
silent_orbit_a9f3c2d1

They are:

  • readable
  • easy to communicate
  • deterministic when seeded
  • configurable for collision safety

Features

  • Predicate–object word structure for human readable IDs
  • Friendly words only
  • Deterministic generation from a seed
  • Configurable number of words and suffix length
  • Optional hash-based suffixes
  • Collision-space analysis (--collision)
  • Word trimming for predictable ID length
  • Implementations in Bash and Python
  • No sudo required, HPC-readable

Installation

Python

You can install human-readable-id via pip (also includes CLI commands):

pip install human-readable-id

Bash (CLI)

The pure Bash version installs the hrid command and wordlists locally (no sudo) and does not require Python:

curl -fsSL "https://raw.githubusercontent.com/Karol-G/human-readable-id/main/bash/install.sh" | bash

This installs:

  • Binary: ~/.local/bin/hrid
  • Wordlists: ~/.local/share/human-readable-id/ (copied from the Python package’s canonical lists)

Make sure ~/.local/bin is on your $PATH:

export PATH="$HOME/.local/bin:$PATH"

Usage

CLI (Both Python and Bash)

Generate a human readable ID:

hrid # elastic_jargon_503, medieval_chess_277, nine_crayfish_660

Deterministic ID from a seed:

hrid my_seed # calm_menu_496

Use more words and a hash suffix:

hrid -w 3 -n 8 --hash # various_elegant_museum_2a750add

With a seed, the hash suffix is deterministic; without a seed it is random.

Trim words to enforce predictable length:

hrid -t 4 # clim_figu_144

Analyze collision space instead of generating an ID:

hrid --collision # scalloped_wombat_617

# predicates: 1450
# objects:    3062
# words:      2 (predicates=1, objects=1)
# suffix:     digits length 3 (space=10^3)
# combinations_M: 4439900000
# n_for_Ecollision_1: 94233

hrid -n 8 --hash --collision # distinct_sphere_3f9b7140

# predicates: 1450
# objects:    3062
# words:      2 (predicates=1, objects=1)
# suffix:     hex hash length 8 (space=16^8)
# combinations_M: ≈ 1,91e16 (< 2^63-1)
# n_for_Ecollision_1: 195290683

Python API

Basic usage:

from human_readable_id import generate_hrid

generate_hrid() # alert_tarn_100

Deterministic generation:

generate_hrid(seed="my_seed") # calm_menu_496

Custom configuration:

generate_hrid(
    seed="experiment-001",
    words=3,
    numbers=8,
    use_hash_suffix=True,
    trim=4,
) # nerv_oval_batt_c8597bc1

Collision awareness

human-readable-id explicitly exposes the size of its ID space.

Using --collision (or the Python equivalent) reports:

  • total number of possible IDs (exact)
  • smallest number of generated IDs needed for an expected collision of 1 (exact)

The Python implementation computes these values with integer arithmetic (no rounding); the Bash CLI falls back to approximate formatting for extremely large spaces.

This helps choose safe parameters instead of guessing.

Wordlists

IDs are built from curated wordlists:

  • predicates (verbs / adjectives)
  • objects (nouns)

Canonical wordlists live in python/src/human_readable_id/words/ and ship with the Python package. The Bash installer copies those same files into ~/.local/share/human-readable-id/ for the CLI. Update the canonical files and rerun the installer (or copy them manually) if you want custom lists.

Contributing

Contributions are welcome! Please open a pull request with clear changes and add tests when appropriate.

Issues

Found a bug or have a request? Open an issue at https://github.com/Karol-G/human-readable-id/issues.

License

Distributed under the MIT license. See LICENSE for details.

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

human_readable_id-0.0.3.tar.gz (301.0 kB view details)

Uploaded Source

Built Distribution

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

human_readable_id-0.0.3-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file human_readable_id-0.0.3.tar.gz.

File metadata

  • Download URL: human_readable_id-0.0.3.tar.gz
  • Upload date:
  • Size: 301.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for human_readable_id-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bd15167d854fe753b017ecab01ad7ea1ea077655c73c72f0c4eda1a4f738bf02
MD5 08e98d27dcbabaf0be07abc691db4b9a
BLAKE2b-256 d6966dc2be9a19fe1d373be991307d5fa66a79733f5d69b02c8604facef3da84

See more details on using hashes here.

Provenance

The following attestation bundles were made for human_readable_id-0.0.3.tar.gz:

Publisher: workflow.yml on Karol-G/human-readable-id

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

File details

Details for the file human_readable_id-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for human_readable_id-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bbbcd16f318e197e5e7947e01da208cba51f579f915fa81f9e15ce82e63ff73a
MD5 dd11fb2fddbaed20ca24cfa91b8884aa
BLAKE2b-256 f224d8f13f6749c1b4af3129481c1c2885396fe91084bf265b57b8806b0379d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for human_readable_id-0.0.3-py3-none-any.whl:

Publisher: workflow.yml on Karol-G/human-readable-id

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