Skip to main content

namekit

PyPI Python versions License

Deterministic pop-culture name generator. Map any string key to a stable, memorable name. Filter by franchise, entity type, or affiliation; choose how the name is formatted.

pip install namekit
import namekit

namekit.name("user-42")                              # 'fred_weasley'
namekit.name("user-42", franchise="lotr")            # 'gollum'
namekit.name("user-42", case="title")                # 'Fred Weasley'
namekit.name("user-42", name_part="last")            # 'weasley'
namekit.name("user-42", suffix=True)                 # 'fred_weasley_6d894'

The same key always produces the same name. The mapping is stable across processes, machines, and Python versions because it uses SHA-256 rather than Python's salted built-in hash().

Install

pip install namekit

Or, from source:

pip install -e .

Why namekit?

Common use cases:

  • Naming training runs, experiments, or sweeps from a config hash, so the same config always lands on the same name.
  • Generating friendly identifiers for users, sessions, or test fixtures.
  • Replacing opaque hashes with human-readable labels in logs and dashboards.

Filtering

Three independent filters compose freely.

Each filter accepts a single value, a list/tuple of values, or None (no filter).

Filter Values
franchise one or more from FRANCHISES, e.g., "lotr" or ["lotr", "ghibli"]
entity_type one or more of "character", "place", e.g., "place" or ["character", "place"]
affiliation one or more of "good", "bad", "neutral", e.g., ["good", "neutral"] (no villains)
from namekit import name, list_names

# A villain from Game of Thrones (rendered Title Case)
name("user-1", franchise="got", affiliation="bad", case="title")
# 'Petyr Baelish'

# LOTR strongholds (the bad guys' places)
list_names(franchise="lotr", entity_type="place", affiliation="bad", case="title")
# ['Mordor', 'Isengard', 'Mount Doom']

# Disney villains
list_names(franchise="disney", affiliation="bad", case="title")
# ['Scar', 'Ursula', 'Gaston', 'Jafar']

If a filter combination yields no entries (e.g., bad scientists), name() raises ValueError.

Format options

Two more knobs control the shape of the returned string.

name_part — which slice of the name

name_part Returns Notes
"full" All parts joined (default) "Frodo Baggins", "Yoda", "Ba Sing Se"
"first" First part only "Frodo", "Yoda", "Ba"
"last" Last part only "Baggins"; entities with no last name are filtered out
list_names(franchise="scientists", name_part="last", case="title")[:8]
# ['Newton', 'Einstein', 'Curie', 'Darwin', 'Galilei', 'Tesla', 'Feynman', 'Hawking']

case — how the parts are joined

case Example
"snake" frodo_baggins (default)
"title" Frodo Baggins
"compact" frodobaggins
"kebab" frodo-baggins

Apostrophes and hyphens are preserved in title only; other cases strip them (e.g., King's Landingkings_landing / kingslanding / kings-landing).

Hash suffix for uniqueness

A short hex suffix makes collisions vanishingly rare while keeping the prefix readable.

name("config-v3", suffix=True)
# 'aragorn_8c1d2'

name("config-v3", suffix=True, suffix_length=8, separator="-")
# 'aragorn-8c1d24a9'

Reusable namer

When you call the namer many times with the same configuration, build a NameKit once.

from namekit import NameKit

kit = NameKit(
    franchise=["lotr", "ghibli"],
    affiliation="good",
    case="title",
    suffix=True,
)
for user_id in user_ids:
    print(kit(user_id))

Inspecting the corpus

from namekit import (
    FRANCHISES, ENTITY_TYPES, AFFILIATIONS, NAME_PARTS, CASES,
    ENTITIES, list_names, list_entities, format_name,
)

FRANCHISES                              # ('avatar', 'starwars', 'lotr', ...)
ENTITY_TYPES                            # ('character', 'place')
AFFILIATIONS                            # ('good', 'bad', 'neutral')
NAME_PARTS                              # ('first', 'last', 'full')
CASES                                   # ('snake', 'title', 'compact', 'kebab')

list_names(franchise="harrypotter", affiliation="good", case="title")
list_entities(entity_type="place")      # full Entity dataclasses

# Format a single Entity yourself
e = ENTITIES[0]
format_name(e, name_part="last", case="title")

Each Entity is a frozen dataclass:

from namekit import Entity
Entity(parts=("Frodo", "Baggins"), franchise="lotr",
       entity_type="character", affiliation="good")

The parts tuple holds Title Case word pieces. entity.first and entity.last are convenience properties (last is None when there is only one part).

Bundled franchises

avatar, starwars, lotr, pokemon, harrypotter, marvel, got, ghibli, mario, zelda, disney, greek, norse, scientists, philosophers.

The corpus has 434 entries (~430 unique formatted names) across 361 characters and 73 places. Affiliation tags are best-effort labels for casual filtering; places default to neutral and only explicit villain strongholds (Mordor, Bowser's Castle, etc.) are tagged bad.

Notes on collisions

Without a suffix, the chance of two different keys producing the same name is roughly 1 / len(corpus). For the default corpus that's about 0.23% per pair. If uniqueness matters, pass suffix=True; with the default 5-char hex suffix, collisions become astronomically unlikely.

Development

pip install -e '.[dev]'
pytest

License

MIT

Download files

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

Source Distribution

namekit-0.1.3.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

namekit-0.1.3-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file namekit-0.1.3.tar.gz.

File metadata

  • Download URL: namekit-0.1.3.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for namekit-0.1.3.tar.gz
Algorithm Hash digest
SHA256 db62498521b36a02a2174bcee5dda75d7af5015d41cd81d18d8ad6d104ad44dd
MD5 4a40045feadcf9c9ee6c838f50a6a760
BLAKE2b-256 6116249342d020a1c0953443ae2cabe98ea41713ebe915d3989b5399dafcf346

See more details on using hashes here.

Provenance

The following attestation bundles were made for namekit-0.1.3.tar.gz:

Publisher: release.yml on bviggiano/namekit

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

File details

Details for the file namekit-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: namekit-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for namekit-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 005e8db8d66a7d902f58e82b4a7046f0164f673f02ab7c1f491de6a3afdc95f2
MD5 5a33f5e31b6e23fa2b636810409069e8
BLAKE2b-256 44cf4938c63bd9402da9761a5edb0a1478d604a79127f26a3c5c56770e3a1eea

See more details on using hashes here.

Provenance

The following attestation bundles were made for namekit-0.1.3-py3-none-any.whl:

Publisher: release.yml on bviggiano/namekit

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

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page