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

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. Build Status

Installation

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

pip install nyu-pypal

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 myenv 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.

Environment Variables & Data Setup

This package does not require additional environment variables.

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.3.tar.gz (9.2 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.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pypal_nyu-0.1.3.tar.gz
  • Upload date:
  • Size: 9.2 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.3.tar.gz
Algorithm Hash digest
SHA256 3aa2a81798d66f187819d1f03219585ccaf482a877745ea2be71829375d19b77
MD5 f63c6d6374554f1d3e87ae0c7474e476
BLAKE2b-256 edee8147fcc704a872e04ccff549c9bab4b624942898a31703fda2a4ddfc6278

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pypal_nyu-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 397a0e7ddfd9b96510a6c3f5a5c9c2ea84a1cd721a914bb06ea59009672a9f6d
MD5 372d74d68f65dc022022a00544ed45cb
BLAKE2b-256 b09b321d14a94d43a76ec3a2909df451613bb8af63c521cdcb844f2108f4ccdd

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