Giter VIP home page Giter VIP logo

names's Introduction

names

image

image

image

image

Random name generator

Installation

The script is available on PyPI. To install with pip:

pip install names

Usage

Names can be used as a command line utility or imported as a Python package.

Command Line Usage

To use the script from the command line:

$ names
John Powell

Python Package Usage

Here are examples of all current features:

>>> import names
>>> names.get_full_name()
u'Patricia Halford'
>>> names.get_full_name(gender='male')
u'Patrick Keating'
>>> names.get_first_name()
'Bernard'
>>> names.get_first_name(gender='female')
'Christina'
>>> names.get_last_name()
'Szczepanek'

License

This project is released under an MIT License.

Data in the following files are public domain (derived from 1990 Census data):

  • dist.all.last
  • dist.female.first
  • dist.male.first

names's People

Contributors

svisser avatar treyhunner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

names's Issues

Invalid syntax error

Traceback (most recent call last):
  File ".\foo\bar.py", line 12, in <module>
    import names
  File "..\venv\lib\site-packages\names\__init__.py", line 39
    print get_full_name()
          ^
SyntaxError: invalid syntax

Install fails with ImportError: libffi.so.8

I cannot pip3 install names using my installation of Python in ~/.local. This is on a shared server where I do not have sudo rights.

Traceback:

    ERROR: Command errored out with exit status 1:
     command: ~/.local/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-m_hsb0te/names_488bf7a692d74f8ebbafd73ee2e1c6ec/setup.py'"'"'; __file__='"'"'/tmp/pip-install-m_hsb0te/names_488bf7a692d74f8ebbafd73ee2e1c6ec/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-fmowhd7g
         cwd: /tmp/pip-install-m_hsb0te/names_488bf7a692d74f8ebbafd73ee2e1c6ec/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "~/.local/lib/python3.9/site-packages/setuptools/__init__.py", line 18, in <module>
        from setuptools.dist import Distribution
      File "~/.local/lib/python3.9/site-packages/setuptools/dist.py", line 34, in <module>
        from setuptools import windows_support
      File "~/.local/lib/python3.9/site-packages/setuptools/windows_support.py", line 2, in <module>
        import ctypes
      File "~/.local/lib/python3.9/ctypes/__init__.py", line 8, in <module>
        from _ctypes import Union, Structure, Array
    ImportError: libffi.so.8: cannot open shared object file: No such file or directory
    ----------------------------------------

I'm not sure if this is specific to names or not, so feel free to close the issue, preferably redirecting me. It looks like libffi is in my .local directory, but pip isn't finding it.

$ ls -l ~/.local/lib/*libffi*
-rw-r--r-- 1 ... libffi.a
-rwxr-xr-x 1 ... libffi.la
lrwxrwxrwx 1 ...libffi.so -> libffi.so.8.1.0
lrwxrwxrwx 1 ... libffi.so.8 -> libffi.so.8.1.0
-rwxr-xr-x 1 ... libffi.so.8.1.0

[Edit: replaced my actual home directory with ~ for readability and possibly privacy]

Improved Documentation

Looking through some of the files, I saw that the documentation could be improved by adding type hinting and function annotation.

Add more data

The data is pretty small. I want to add more data.
To be specific I am looking to add 10k Indian male first names and 10k indian female first names.
How can I extend this package to achieve that?

Returns female names when asking for male names.

Here is what I put to test this out after I noticed the issue:

for i in range(5):
pop_name = names.get_full_name(gender="Male")
print(pop_name)

Results:

Alvin Heller
George James
Wallace White
Lydia Pastrana
Donna Brubaker

Random names for specific languages

I would like to suggest to this lib generate random names for specific languages. In my case, I would like to generate random names from Brazilian Portuguese language (most common names, maybe).

Is this package going to provide a feature like that in the near feature?

Consider using Faker

Faker appears to be a superset of the functionality given by names. I think it would be helpful to mention it in the README as a more complete solution to data faking.

error: metadata-generation-failed

>python -m pip install names
Collecting names
  Using cached names-0.3.0.tar.gz (789 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Administrator\AppData\Local\Temp\pip-install-6m8obe19\names_59ce1896f1814ccaa496ed80eb11634b\setup.py", line 1, in <module>
          import names
      ModuleNotFoundError: No module named 'names'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.