Skip to main content

A package that generates random address, names, phonenumbers and profile to fulfill website registration requirements.

Project description

Pypal - A Random Profile Generator

Build Status

Pypal is a Python package that generates profiles with random human-like and fantasy names, US or UK addresses, domestic or international phone numbers, and emails. It is useful for testing, development, and anonymized data generation.

Installation

If you want to import the package, install from: [https://pypi.org/project/pypal-nyu/] using pip:

pip install pypal-nyu 

Usage

Function: generate_name

Generates a random name (either a human name or a fantasy name).

Parameters

  • type (str): "human" or "fantasy", determining the type of name generated.
  • length (int): The number of names to generate.

Returns

  • list[str]: A list of generated names.

Example

from pypal.generator import generate_name

# Generate a single human name
print(generate_name(type="human", length=1))

# Generate multiple fantasy names
print(generate_name(type="fantasy", length=3))

Function: generate_address

Generates a random address in US or UK format, either in a short or long version.

Parameters

  • country (str):
    • "US" → Generates a US-based address.
    • "UK" → Generates a UK-based address.
  • format (str):
    • "short" → Returns street, city.
    • "long" → Returns street, city, postal_code, country.

Returns

  • str: A properly formatted address.

Example

from pypal.generator import generate_address

# Generate a US address in short format
print(generate_address(country="US", format="short"))

# Generate a UK address in long format
print(generate_address(country="UK", format="long"))

Function: generate_phone_number

Generates a random US phone number, either in domestic format or with an international country code.

Parameters

  • style (str):
    • "domestic" → Generates a US phone number like (XXX) XXX-XXXX.
    • "international" → Generates a phone number with country code +1-XXX-XXX-XXXX.

Returns

  • str: A properly formatted phone number.

Example Usage

from pypal.generator import generate_phone_number

# Generate a domestic phone number
print(generate_phone_number(style="domestic"))

# Generate an international phone number
print(generate_phone_number(style="international"))

Function: generate_profile

Generates a full random user profile, including a name, address, phone number, and email.

Parameters

  • include_email (bool, default=True):
    • True → Includes a generated email.
    • False → Excludes the email field.
  • include_phone (bool, default=True):
    • True → Includes a generated phone number.
    • False → Excludes the phone field.

Returns

  • dict: A dictionary containing:
    • "name" (str): A randomly generated full name.
    • "address" (str): A randomly generated address.
    • "email" (str, optional): A generated email (first@example.com).
    • "phone" (str, optional): A generated phone number.

Example Usage

from pypal.generator import generate_profile

# Generate a full profile with email & phone
print(generate_profile(include_email=True, include_phone=True))

# Generate a profile with only a name & address
print(generate_profile(include_email=False, include_phone=False))

Contributing

We welcome contributions from the community! Follow these steps to set up your development environment:

1. Clone the Repository

Fork the repository on GitHub, then clone your fork locally:

git clone https://github.com/software-students-spring2025/3-python-package-pypal.git
cd 3-python-package-pypal

2. Set Up Virtual Environment

Our package doesn't require ny other dependency for now

Using Python's venv:

python -m venv pypal
source venv/bin/activate   # On macOS/Linux
venv\Scripts\activate      # On Windows

Using Conda:

conda create -n pypal python=3.12
conda activate pypal

3. Build the Package

Build the pacakge locally:

pip install .

4. Run Unit Tests

Ensure all tests pass before submitting a pull request:

cd tests
pytest test_generator.py

5. Make Your Contributions

1. Create a new branch:

git checkout -b your-feature-branch

2. Make your changes and commit:

git add .
git commit -m "Describe your changes"

3. Push to your fork:

git push origin your-feature-branch

4. Create pull request from your fork to the main repository.

Teammates

Sophia Gu

Jason Lin

Allen Ni

Zifan Zhao

Running the Project on Any Platform

To ensure cross-platform compatibility, we recommend using a virtual environment as described in the Contributing section. The package is tested on Linux, macOS, and Windows. Feel free to explore our work!

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

pypal_nyu-0.1.5.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypal_nyu-0.1.5-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file pypal_nyu-0.1.5.tar.gz.

File metadata

  • Download URL: pypal_nyu-0.1.5.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pypal_nyu-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8aa860b782fbbe58aca55ed62ae6bd1633209247f12e6f68cc0449bf66716a27
MD5 6298c695471113e5f7eb563edeeeb693
BLAKE2b-256 1a583487350e8c03a7b8971c007886af82ca8a3f4188c26d44f6920461e9e592

See more details on using hashes here.

File details

Details for the file pypal_nyu-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pypal_nyu-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pypal_nyu-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 605539e1655bb14575b398cdad483c65a68a19b68908f76a7deb2fcaff2d146b
MD5 e1f2b8a8680ecd5d8cbe499f57071053
BLAKE2b-256 3a9e4aa8e3ebf19edc9b7c92590624cdabc0b08839304e784daf44fed733a595

See more details on using hashes here.

Supported by

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