/names_generator

Clone of the Moby/Docker random name generator as a Python package.

Primary LanguagePythonApache License 2.0Apache-2.0

names_generator

License PyPI Version Python Versions

Clone of the Moby/Docker random name generator as a Python package.

Installation

$ pip install names_generator

Usage


Python API


The API only really consists of a single function.

>>> from names_generator import generate_name
>>> generate_name()
'vigorous_goldstine'

Customize the formatting of the name by specifying a style, one of plain, capital, hyphen, or underscore (default).

>>> generate_name(style='capital')
'Hardcore Thompson'

Pin a seed value for the underlying PRNG to reproduce a given name.

>>> generate_name(seed=42) == generate_name(seed=42)
True

Command-line


The package also exposes a basic command-line interface for scripting outside of Python

$ generate_name
clever_matsumoto

$ generate_name --style=capital
Heuristic Einstein

$ generate_name --help
usage: generate_name [-h] [-v] [--style NAME]
Generate random name pairing.

options:
-s, --style    NAME    Formatting (default: underscore).
-h, --help             Show this message and exit.
-v, --version          Show the version and exit.

Documentation and issue tracking at:
https://github.com/glentner/names_generator