Skip to main content

PyNameGen is a CLI for libnamegen

Project description

PyNameGen

Build Status

PyPI PyPI - License

Robust CLI for libnamegen. Originally on my NameGenerator project.

Features

  • Easy to use
  • CLI with simple arguments
  • Always tested before release
  • Officially supports latest two versions of Python 3

How to Install

Run the command pip install pynamegen. If you want to specify a specific Python version to use for pip, use a command such as pip3 or pip3.8.

PyNameGen requires the packages libnamegen and libprogress, but those will automatically be installed by pip.


FAQ

What versions of Python are compatible?

PyNameGen is built for Python 3. It is tested on the latest two versions on Python 3 via Drone CI.


Documentation

Command-Line Interface

Use defaults (100 names, debug enabled, classic method, write names to names.txt):

$ pynamegen
Generating names...
[####################] 100% [100/100]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [100/100]...done
Saving file...
Finished!

Show help menu (use any of the three options in brackets):

$ pynamegen [--help | -h | help]
Usage:
    pynamegen [options]
Options:
    amt: Amount of names to generate
    debug: Whether or not to output debug information
    method: Which name generation method to use
Example:
    pynamegen amt=50 debug=True file=mynames.txt method=classic

Generate 250 names:

$ pynamegen amt=250
Generating names...
[####################] 100% [250/250]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [250/250]...done
Saving file...
Finished!

Generate default amount of names with debug disabled:

$ pynamegen debug=False
(no output)

Generate names and place in file usernames.txt:

$ pynamegen file=usernames.txt
Generating names...
[####################] 100% [100/100]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [100/100]...done
Saving file...
Finished!

Generate names and place in file users.txt inside the directory "example-names" (Directory must already exist!)

$ pynamegen file=example-names/users.txt
Generating names...
[####################] 100% [100/100]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [100/100]...done
Saving file...
Finished!

Generate 50 names with debug enabled and place in namelist.txt:

$ pynamegen amt=50 debug=True file=namelist.txt
Generating names...
[####################] 100% [50/50]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [50/50]...done
Saving file...
Finished!

You can also generates the names to terminal output by setting the filename to stdout. If you do so, make sure to set debug to False! This makes it easy to use the CLI as a way to send generated names to a program without using the Python API.

Generate 5 names with the random method and output to terminal:

$ pynamegen amt=5 method=random debug=False file=stdout
Kc3HcV3pq_n0
ncwUV_Twbx7s
jYs56B1y_WxU
YN5_cU6fhwXc
SI46Rnp9skAo

The output for the above command will differ because the generated names will not be the same as in this example.

The following example generates a name with the classic method and pipes it to the cowsay command (which just outputs text of a cow and a message box). You can pipe the generated name to any command; this is just an example.

$ pynamegen amt=1 method=classic debug=False file=stdout | cowsay
 _______________________
< TheCauliflowerguy_408 >
 -----------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

The default name generation method is classic, and looks like 'TheAssignmentanatorifier_90'.

The generation method random looks like 'XaYyaknkCoH8'.

You can change the generation method used by using the argument 'method=[method]' and replace [method] with the correct method.

$ pynamegen method=random
Generating names...
[####################] 100% [100/100]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [100/100]...done
Saving file...
Finished!

If you choose surprise as the generation method, a generation method will be randomly selected.

$ pynamegen method=surprise
Randomly selected method: classic
Generating names...
[####################] 100% [100/100]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [100/100]...done
Saving file...
Finished!
$ pynamegen method=surprise
Randomly selected method: random
Generating names...
[####################] 100% [100/100]...done
Preparing list to write to file...done
Opening file...
Writing names...
[####################] 100% [100/100]...done
Saving file...
Finished!

License

PyNameGen is licensed under the GPLv3 license. For more information, please refer to LICENSE

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

pynamegen-3.1.2.post2.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

pynamegen-3.1.2.post2-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file pynamegen-3.1.2.post2.tar.gz.

File metadata

  • Download URL: pynamegen-3.1.2.post2.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pynamegen-3.1.2.post2.tar.gz
Algorithm Hash digest
SHA256 62e16a097dfc24ac1c50e5e55281e2413585413c6e628f74b35e8f8abc15748d
MD5 afeed12c0c817dd65fc2a0508ebaac01
BLAKE2b-256 e45dcbf7872dd4f49565f76f938c1ac090d5c0772912cb771b8ce4a34a6ca838

See more details on using hashes here.

File details

Details for the file pynamegen-3.1.2.post2-py3-none-any.whl.

File metadata

  • Download URL: pynamegen-3.1.2.post2-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pynamegen-3.1.2.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 26082a5083844efeae774bcd849382e225b085f9e0d641ddbbba31e7d6ecbf1c
MD5 01fb20b7fbf0d9b1c0a0452042993e96
BLAKE2b-256 bcfda60a8704b0d8c03a3a79b98a087dd580271e07c1d1a2bb447f613818f23e

See more details on using hashes here.

Supported by

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