Skip to main content

Get random first/last name

Project description

PyPI version License: MIT Code style: black Language: Python Author: Walu

randname

Python module to generate random name.

Summary

Randname is a python module for generating random name - first and last. It uses official data from appropiate governmant/scientific reserch centers.

Names are drawn with the consideration of their frequency. Therefor moste common name wil be drawn much more often (this feature can be disabled).

Currently supported cuntries: US, PL, ES.

Default database is small, and constrained to 10000 records for each first and last names for every country. Default data size: 60 000 records

With the full database downloaded from project github page, the amount of names is increased to around 700 000 records.

Table of Contents

Installation

Randnames is availabe in python repository, and can be downloaded with pip.

pip3 install rname

Usage

>>> import randname

# Get name
>>> randname.get_name("first")
'John'
>>> randname.get_name("last")
'Doe'

# Get first name
>>> randname.first_name()
'John'

# Get last name
>>> randname.last_name()
'Doe'

# Get full name
>>>randname.full_name()
'John Doe'

# Setting dirrection to external database
>>> randname.database_path = "/path/to/external/database/"

Documentation

Detailed documentation of module can by found here: randname documentation

Database

Default database included in pypi package is very small. To not make the package unnecessary too large, every country have one set of data for last and first names (with distinction for the male, female, neutral name), for the most recent year. Each file contains up to 10000 records.

Currently supprted countries:

US:

  • 2010, last names (neutral)
  • 2018, first names (male, female)

PL:

  • 2020, last names (male, female)
  • 2021, first names (male, female)

ES:

  • 2020, last names (male)
  • 2020, first names (male)

Biger database

Full database is bigger and doesn't have the limit of records. If you wan to use it, dowload it from project github page.

To use other databases specify directory by setting database_path variable

>>> import randnames
>>> randnames.database_path = "path_to_your_database"

More details about database can be found here

Contribution

If you want to contribute to randname projcet read contribution for more information.

I am looking especially for help with database creation. More information on how to help/create appropiate data files with names can be found in database guide

Authors & Contributors

Author: Adam Walkiewicz

Contributors: Be first!

To do

  1. Summary
  2. Tools
  3. Contribution guideline
  4. Unit tests
  5. Instruction for database creation
  6. Add equal chances for every name
  7. Support for other countries names
  8. Add 9 more countries

License

Randnames is licensed under the terms of the MIT 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

rname-0.3.6.tar.gz (728.3 kB view hashes)

Uploaded Source

Built Distribution

rname-0.3.6-py3-none-any.whl (727.6 kB view hashes)

Uploaded Python 3

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