Skip to main content

Comprehensive realistic data generation library for testing and development

Project description

MockPy

🚀 Comprehensive Realistic Data Generation Library

PyPI version Python versions License

MockPy is a Python library for generating realistic and comprehensive mock data for testing, development, and demonstration purposes.

🌟 Features

  • 📊 Realistic Data: Based on real-world distributions
  • 🔄 Cross-Data Consistency: Related data fields maintain logical relationships
  • 🧩 Easy-to-Use API: Intuitive design for developer productivity
  • 🔌 Framework Integration: Works with Django, Flask, FastAPI, SQLAlchemy
  • 🚀 Performance Optimized: Fast generation with minimal resource usage
  • 🌍 Multi-Language Support: Built-in support for English and Turkish with translation capabilities

📦 Installation

pip install python-mockpy

🚀 Quick Start

from mockpy import MockPy

# Initialize the library
mock = MockPy(locale="en_US")

# Generate a person
person = mock.person.person()
print(f"Hello, my name is {person.full_name}")

# Generate an address
address = mock.address.address()
print(f"My address: {address.street}, {address.city}")

# Generate credit card
credit_card = mock.finance.credit_card()
print(f"My card: {credit_card.formatted_number}")

📋 Data Types

MockPy can generate a wide variety of data:

  • 👤 Personal Information: Names, addresses, phone numbers, emails
  • 💼 Business Data: Company names, job titles, departments
  • 💰 Financial Data: Bank accounts, credit cards, IBAN numbers
  • 🌐 Internet: URLs, IP addresses, usernames
  • 🏥 Healthcare: Patient records, diagnoses, medication names
  • 🗺️ Geographic: GPS coordinates, countries, cities
  • 🛒 E-commerce: Products, prices, orders
  • 📚 Education: Schools, courses, grades

And many more!

🛠️ Advanced Usage

Schema-Based Data Generation

schema = {
    "id": {"type": "integer", "min": 1000, "max": 9999},
    "user": "person.person",
    "subscription": {
        "plan": {"type": "choice", "choices": ["Basic", "Premium", "Enterprise"]},
        "start_date": {"type": "date", "start": "2022-01-01", "end": "2023-01-01"},
        "price": {"type": "float", "min": 9.99, "max": 99.99, "precision": 2},
    }
}

# Generate 100 records
dataset = mock.generate_dataset(schema, count=100)

JSON Schema/OpenAPI Integration

# Generate data from JSON Schema
from mockpy.integrations import from_json_schema

schema_file = "user_schema.json"
users = from_json_schema(schema_file, count=50)

Django Integration

from mockpy.integrations.django import generate_model_instances
from myapp.models import User

# Create 10 instances of your Django model
users = generate_model_instances(User, count=10)

🌍 Multi-Language Support

# English data generation
en_mock = MockPy(locale="en_US")
en_person = en_mock.person.person()

# Turkish data generation
tr_mock = MockPy(locale="tr_TR")
tr_person = tr_mock.person.person()

# Other languages (requires 'translators' package)
fr_mock = MockPy(locale="fr_FR")
fr_person = fr_mock.person.person()

🧪 Testing Use Cases

def test_user_registration():
    mock = MockPy()
    test_user = mock.person.person()
    
    response = client.post('/register', data={
        'email': test_user.email,
        'name': test_user.full_name,
        'phone': test_user.phone
    })
    
    assert response.status_code == 200

🔧 Performance Considerations

MockPy is designed to be fast and resource-efficient:

  • No external dependencies required for core functionality
  • Minimal memory footprint
  • Optimized for bulk data generation
  • Smart caching for frequently used data

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.

💬 Contact

Project Link: https://github.com/burakozcn01/mockpy

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

python_mockpy-0.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

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

python_mockpy-0.1.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file python_mockpy-0.1.0.tar.gz.

File metadata

  • Download URL: python_mockpy-0.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for python_mockpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f881fb97c68af271cc242785845401c4e6028f5ca9523acbff5012fe3ae2e15
MD5 69374d8bed28b7198e40552ba8b30b4e
BLAKE2b-256 73085af2c93c3b7542f4393b2af57424d52130213dd75f7a48f5ab41acd2bf97

See more details on using hashes here.

File details

Details for the file python_mockpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_mockpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for python_mockpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6b125b2c71cc2abc875b781a5c728f40ce73d8b1ccacb4430d48f7807d347f0
MD5 b79984b932bfcdf3a90a06d3762e6002
BLAKE2b-256 9a393a8b2a631db954f022344aaabb80978a6b5299dfe788a7b56043266d45d3

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