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.
Faker Data Generator
Try in Editorfrom 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