Comprehensive realistic data generation library for testing and development
Project description
MockPy
🚀 Comprehensive Realistic Data Generation Library
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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f881fb97c68af271cc242785845401c4e6028f5ca9523acbff5012fe3ae2e15
|
|
| MD5 |
69374d8bed28b7198e40552ba8b30b4e
|
|
| BLAKE2b-256 |
73085af2c93c3b7542f4393b2af57424d52130213dd75f7a48f5ab41acd2bf97
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b125b2c71cc2abc875b781a5c728f40ce73d8b1ccacb4430d48f7807d347f0
|
|
| MD5 |
b79984b932bfcdf3a90a06d3762e6002
|
|
| BLAKE2b-256 |
9a393a8b2a631db954f022344aaabb80978a6b5299dfe788a7b56043266d45d3
|