Skip to content
Package95 repository health

Faker

A Python library that generates realistic fake data for testing, seeding, and anonymizing datasets across 70+ locales.

Library PyPIv40.63.019,502 stars MIT License
pip install faker
View sourceVisit website

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Excellent
  • Development activity100
  • Maintenance96
  • Community84
  • Maturity60
  • Momentum40

Technical analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
Excellent
  • Architecture85
  • Code quality90
  • Innovation72
  • Learning curve90

Faker is a Python package for generating fake data — names, addresses, text, dates, companies, credit cards, and dozens of other data types — for use in tests, database seeding, and mock APIs. Rather than hardcoding sample values, developers call methods on a Faker() instance (fake.name(), fake.address(), fake.text()) and get a different plausible-looking value on every call, with results seedable for reproducible test runs.

What sets Faker apart from similar libraries is its locale coverage: it ships hundreds of locale-specific provider modules so generated names, addresses, and phone numbers look native to a given country and language rather than defaulting to US English. It’s heavily inspired by PHP Faker, Perl Faker, and Ruby Faker, and its own API — Faker, Provider, Generator — has in turn become the reference pattern that fake-data libraries in other ecosystems copy.

It integrates directly into common Python testing workflows via a bundled pytest plugin (a faker fixture) and a faker CLI command for ad-hoc data generation from the shell or scripts in other languages. Custom data types are added by subclassing BaseProvider, so teams can extend it with domain-specific fake data (e.g. internal ID formats) without forking the library.

What You Get

  • A Faker() proxy object exposing hundreds of generator methods (name, address, email, date_time, company, credit_card_number, etc.) grouped into ~27 provider categories
  • Localization for 70+ locales, so generated names, addresses, and phone numbers match the conventions of a specific country/language rather than defaulting to en_US
  • A pluggable provider system — subclass BaseProvider to register custom fake-data generators alongside the built-in ones
  • A bundled pytest plugin exposing a faker fixture, plus a faker CLI command for generating values from the command line or shell scripts
  • Seedable, reproducible output via Faker.seed() / seed_instance(), and multi-locale instances that can weight which locale is used per call
  • A use_weighting mode that samples common values (e.g. common names) more frequently than rare ones, for more realistic-looking distributions

Common Use Cases

  • Seeding a development or staging database with realistic-looking sample records
  • Generating test fixtures and mock API responses without hand-writing sample data
  • Anonymizing production data by replacing real PII with structurally similar fake values
  • Populating demo environments and UI screenshots with varied, non-repetitive placeholder content
  • Stress-testing data pipelines and forms with large volumes of varied, locale-correct input

Under The Hood

Architecture

Faker centers on a proxy pattern: the public Faker class (faker/proxy.py) wraps one or more per-locale Generator instances, created by Factory.create() (faker/factory.py), and forwards attribute access to whichever generator(s) are active — supporting single-locale, multi-locale, and weighted-locale configurations transparently through the same API. Factory._find_provider_class() (cached with functools.lru_cache) resolves each requested provider path to its locale-specific Provider class by walking that provider package’s locale submodules and falling back to a default_locale. Each Generator.add_provider() call then dynamically attaches every public method of a provider instance onto the generator via set_formatter()/setattr(), so fake.name() is really a formatter method registered at construction time rather than a hardcoded dispatch table — the whole system is a plugin registry, and swapping the core Generator/Factory abstractions would ripple through every one of the hundreds of locale-specific provider modules built on top of BaseProvider.

Tech Stack

Faker is pure Python (99.9% of the codebase) targeting Python 3.10+, packaged with classic setuptools/setup.py and near-zero runtime dependencies (tzdata on Windows only, with optional extras for tzdata and Pillow-based image generation). It exposes two integration points beyond the library API: a console_scripts entry point (faker) implemented with argparse in faker/cli.py, and a pytest11 entry point registering a faker pytest fixture plugin. Type information ships via a py.typed marker and a proxy.pyi stub, checked under a strict mypy.ini (disallow_subclassing_any, disallow_incomplete_defs, check_untyped_defs). CI runs through GitHub Actions workflows (ci.yml, gh-release.yml) with tox coordinating multi-version test runs.

Code Quality

The repository has an extensive test suite — 61 test files under tests/, covering the proxy, generator, factory, CLI argument parsing, uniqueness constraints, optional values, and provider output formats — plus a dedicated tests/providers tree exercising individual locale providers. Typing is enforced project-wide under a strict mypy configuration rather than left optional, and the codebase ships its own type stubs for consumers. No informal or ad-hoc error handling was observed; the library raises typed exceptions (faker/exceptions.py, e.g. UniquenessException) for well-defined failure modes like unresolvable unique-value constraints.

What Makes It Unique

Faker’s differentiator is breadth and realism at scale: hundreds of locale-specific provider modules across roughly two dozen provider categories (address, person, company, phone_number, date_time, and more) give it native-looking output for a very wide set of languages and countries, not just template English data with substituted words. Its use_weighting mode goes further than uniform random selection — sampling common values (e.g. common first names) more frequently than rare ones so distributions look statistically plausible rather than uniformly random. The provider system is fully extensible via BaseProvider subclassing, letting teams register their own fake-data generators without modifying the library, and its Faker/Provider/Generator API design has become the pattern other language ecosystems’ fake-data libraries emulate.

Used by 7 apps in this directory

Every app whose dependencies include faker, nine to a page.

Python 51%Other

Airbyte

22,424

Data Engineering · Developer Tools

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

App
Built with
  • Python 51%
  • Kotlin 43%
Updated todayView details
Python 68%Other

AutoGPT

188,120

AI Assistants · Automation · Productivity

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

App
Built with
  • Python 68%
  • TypeScript 31%
Updated todayView details
Python 66%MIT

Flowfile

413

Data Engineering

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

App
Built with
  • Python 66%
  • TypeScript 18%
  • Vue 15%
Updated yesterdayView details
TypeScript 93%Other

Infisical

30,654

Devops · Security

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

App
Built with
  • TypeScript 93%
Updated todayView details
Python 53%AGPL 3.0

LearnHouse

2,485

CMS · Learning Management

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

App
Built with
  • Python 53%
  • TypeScript 43%
Updated todayView details
C++ 66%Other

Memgraph

4,667

AI Development · Databases

High-performance in-memory graph database for AI context and real-time analytics

App
Built with
  • C++ 66%
  • Python 18%
Updated yesterdayView details
C 73%AGPL 3.0

TDengine

25,202

Databases

A high-performance, open-source time-series database built in C for IoT, connected vehicles, and industrial monitoring workloads, with built-in stream processing, caching, and data subscription.

App
Built with
  • C 73%
  • C++ 20%
Updated 6 days agoView details

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers