faker
UtilitiesMock data generation
What is faker?
Faker is a Python library that generates realistic-looking fake data: names, addresses, emails, phone numbers, dates, job titles, company names, lorem ipsum text, and hundreds of other data types. It's invaluable for seeding databases, generating test fixtures, and building prototypes without real user data.
In PyRun, Faker loads via micropip with a single import statement. You can generate datasets, experiment with locale-specific data formats, and prototype data pipelines — all without any local installation. It's a great companion for testing Pandas and Pydantic workflows.
Code Example
Generate realistic mock user profiles.
from faker import Faker
import json
fake = Faker()
Faker.seed(42)
users = []
for _ in range(4):
users.append({
"name": fake.name(),
"email": fake.email(),
"address": fake.address().replace('\n', ', '),
"job": fake.job(),
"company": fake.company(),
})
print("Generated Users:\n")
print(json.dumps(users, indent=2))Why run faker in PyRun?
- ✦ Zero setup — no pip install, no virtual environment, no Python download
- ✦ Instant results — powered by WebAssembly, runs locally in your browser
- ✦ Share your code — generate a link and anyone can run it instantly
- ✦ Works offline — after first load, PyRun runs without internet
Related Packages
Recommended Python Resources
Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.
Python Loops
Learn how to use Python loops to iterate over data. Master for loops, while loops, break, continue, and loop best practices with interactive examples.
How to Sort a List in Python
Learn how to sort a list in Python using the sort() method and the sorted() function. Discover custom key sorting and reverse order examples.
Python String Methods
A complete reference guide for Python string manipulation. Master formatting, searching, splitting, replacing, and checking string properties.
Python vs JavaScript: Which Programming Language is Best?
A comprehensive comparison between Python and JavaScript. Explore syntax differences, performance, use cases (backend vs frontend), and coding examples.