A Python package and command-line utility to generate unique and memorable names (e.g., talented-toucan
, naughty-watermelon
) and IDs (e.g., broken-radio-7ab4g
). These names/IDs are ideal for naming temporary directories, user session IDs, gamer tags, project names, process names, or submitted jobs.
The generated names cover a wide range of thematic categories, including science, animals, or history, often with a humorous twist. While creating unique-namer, I was inspired by the creative names used by Docker for its containers and Nextflow for its processes.
- Over 17 million unique names
- Nearly infinite unique identifiers
- 20+ categories
- Customizable names and categories
- Categories
- Requirements
- Installation
- Using Without Installation
- Usage
- Command-line Utility
- Versioning
- Tests
- License
Categories enable customization of generated names to align with the specific topic or theme of the project.
- | Category | Nouns count | Example name | Possible combinations | |
---|---|---|---|---|---|
Names | IDs (suffix 4) | ||||
__all__ | 7170 | awful-deadline |
17,021,580 | 1013 | |
πΏοΈ | animals | 461 | tan-octopus |
1,094,414 | 1012 |
π¬ | architecture | 134 | blowing-facade |
318,116 | 1011 |
π | astronomy | 124 | ruthless-meteoroid |
294,376 | 1011 |
π | biology | 730 | shiny-centriole |
1,733,020 | 1012 |
π§ͺ | chemistry | 255 | junior-peroxide |
605,370 | 1012 |
πΊπΈ | countries | 182 | satisfying-tanzania |
432,068 | 1011 |
π» | computer_science | 280 | funny-malware |
664,720 | 1012 |
π | food | 217 | pretty-waffle |
515,158 | 1011 |
π | geography | 186 | enjoyed-tsunami |
441,564 | 1011 |
π° | history | 162 | cool-epoch |
384,588 | 1011 |
π | math | 157 | peachy-prime |
372,718 | 1011 |
π₯ | medicine | 706 | curly-diarrhea |
1,676,044 | 1012 |
π | microbiology | 130 | crazy-bacteria |
308,620 | 1011 |
π« | misc | 2823 | curvy-flight |
6,701,802 | 1013 |
π¬ | molecular_biology | 220 | retired-oligonucleotide |
522,280 | 1011 |
π΅ | music | 202 | solid-contrabassoon |
479,548 | 1011 |
![]() |
physics | 145 | terrible-pressure |
344,230 | 1011 |
π» | plants | 178 | anonymous-cactus |
422,572 | 1011 |
π | science | 874 | golden-hertz |
2,074,876 | 1012 |
π§βπ» | scientists | 101 | gifted-newton |
239,774 | 1011 |
π | sports | 191 | intergalactic-olympics |
453,434 | 1011 |
- Python version 3.6 or higher
- No external dependencies are required
Install unique-namer
from PyPI:
pip install unique-namer
Alternatively, you can install the latest version directly from GitHub:
pip install "git+https://github.com/aziele/unique-namer.git"
If you prefer to use unique-namer
without installation, you can clone or download the repository:
git clone https://github.com/aziele/unique-namer.git
cd unique-namer/src/
You can import namer
in Python:
python
>>> import namer
>>> namer.__doc__
'Generate unique, human-readable, and memorable names or identifiers'
You can also use unique-namer
as a command-line tool:
python -m namer
The generate
function returns a string with a randomly generated name consisting of an adjective and a noun.
import namer
name = namer.generate()
print(name) # Example: 'blushy-cyclist'
By default, generate
randomly selects one category to pick a noun from. Categories are selected with equal probability, regardless of the number of nouns they contain. You can specify one or more categories to restrict the selection.
import namer
name = namer.generate(category='astronomy')
print(name) # Example: 'crazy-supernova'
name = namer.generate(category=['physics', 'molecular_biology'])
print(name) # Example: 'pink-bacteria'
Adds a random suffix of the specified length to the generated name to create a unique identifier. The suffix consists of alphanumeric characters (0-9a-z
).
import namer
name = namer.generate(category='history', suffix_length=3)
print(name) # Example: 'annoying-cleopatra-9a1'
Specifies the separator to use between the adjective, noun, and suffix in the generated name.
import namer
name = namer.generate(category='sports', separator='_')
print(name) # Example: 'savage_judo'
Specifies the text case format of the generated name.
import namer
name = namer.generate(suffix_length=5, style='uppercase')
print(name) # Example: 'DAMAGED-ELECTRON-J20ZX'
name = namer.generate(separator=' ', style='title')
print(name) # Example: 'Lazy Unicorn'
To tailor the generated names to your specific project needs, such as adding a date or project name, use the _generate
function. This function returns a Python list of name components and a separator. You can modify the list and then format it into a string.
Here's an example:
import namer
# Generate name components
name_components, separator = _generate(category='food', suffix_length=3)
print(name_components) # Example: ['macho', 'pizza', '7dx']
# Create custom generate function
def my_generate(*args, **kwargs):
name_components, separator = namer_generate(*args, **kwargs)
name_components.insert(0, '2024')
return separator.join(name_components)
name = my_generate(category='food', suffix_length=3)
print(name) # Example: 2024-macho-pizza-7dx
You can retrieve the list of available categories using the list_categories
function.
import namer
print(namer.list_categories())
# ['animals', 'architecture', 'astronomy', 'biology',
# 'chemistry', 'computer_science', 'countries', 'food',
# 'geography', 'history', 'math', 'medicine, 'misc',
# 'microbiology', 'molecular_biology', 'music', 'physcics',
# 'plants', 'science', 'scientists', 'sports']
To generate names or IDs tailored to your project, you can add custom categories. Extend the namer.data.categories
dictionary with lists of words representing your custom category.
import namer
# Create two subcategories.
my_dogs = ['charlie', 'bella', 'biga']
my_cats = ['tommy', 'lucy']
# Add a custom category named 'my_pets' containing both dogs and cats
namer.data.categories['my_pets'] = [my_dogs, my_cats]
# Generate a name from the 'my_pets' category
name = namer.generate(category='pets')
print(name) # Example: 'thankful-tommy'
The tool is available as a command-line utility.
namer -h
or
python -m namer -h
The stats
command prints a table with name/ID statitics for each category.
namer stats
Output:
Category Nouns Example Name_combs ID_combs (4-char suffix)
__all__ 7170 talented-samoa 17,021,580 3e+13
animals 461 rigid-tamarin 1,094,414 2e+12
architecture 134 hushed-pier 318,116 5e+11
astronomy 124 aesthetic-apogee 294,376 5e+11
biology 730 grilled-liverworts 1,733,020 3e+12
chemistry 255 engaging-avogadro 605,370 1e+12
countries 182 affectionate-kuwait 432,068 7e+11
computer_science 280 devout-cluster 664,720 1e+12
food 217 outstanding-ravioli 515,158 9e+11
geography 186 grubby-quartz 441,564 7e+11
history 162 profuse-document 384,588 6e+11
math 157 decidable-cylinder 372,718 6e+11
medicine 706 measly-seborrhea 1,676,044 3e+12
microbiology 130 nosy-coinfection 308,620 5e+11
misc 2823 fellow-sleigh 6,701,802 1e+13
molecular_biology 220 odious-purine 522,280 9e+11
music 202 bursting-bobmarley 479,548 8e+11
physics 145 matching-resistivity 344,230 6e+11
plants 178 western-bud 422,572 7e+11
science 874 arrogant-ribonuclease 2,074,876 3e+12
scientists 101 materialistic-planck 239,774 4e+11
sports 191 elaborate-box 453,434 8e+11
The generate
command creates a list of names or IDs based on specified parameters.
namer generate 5
Output:
basic-mortise
focused-berry
uncommon-broth
decisive-dentil
kingly-afforestation
To generate 10 IDs from the physics
and biology
categories, with a random suffix of 3
characters, using _
as a separator, and converting name style to title, use
namer generate 10 --category physics --category biology --suffix_length 3 -- \
separator _ --style title
Output:
Visiting_Haploid_Eep
Eventual_Refraction_Cnr
Snugly_Monod_Sim
Cruel_Codon_46p
Relieved_Decibel_Cn5
Underground_Bug_7wf
Super_Acre_30r
Guttural_Farad_E1w
Lead_Stalk_Fi4
Formidable_Field_621
The package follows Semantic Versioning with the format MAJOR.MINOR.PATCH
:
- MAJOR version: significant changes (e.g., new features, major code reorganizations).
- MINOR version: category-related updates (e.g., adding/moving categories).
- PATCH version: bug fixes or vocabulary expansions without changing the list of categories.
To ensure that unique-namer works as expected, you can run tests using pytest.
pytest tests