Skip to main content

dataforger

Generate realistic fake data from Python or the command line, and save it as CSV or JSON. Dataforger uses only the Python standard library and has no third-party runtime dependencies.

Built-in names, streets, companies, and email domains are stored in src/dataforger/data.json. Country names and their associated cities are stored in src/dataforger/countries.json; when generating a record with both country and city fields, the city is selected from that country's list.

Install

Requires Python 3.10 or later.

From a checkout of this repository:

python -m pip install .

After publishing the package to PyPI:

python -m pip install dataforger

Publishing to PyPI

The GitHub Actions workflow runs the tests on Python 3.10 through 3.13 and builds wheel and source distributions on pushes and pull requests. To publish, configure a PyPI trusted publisher for this GitHub repository, using workflow .github/workflows/publish.yml and the GitHub environment pypi. Then create and publish a GitHub Release; the workflow publishes its tested distributions to PyPI using trusted publishing.

Command line

Run dataforger without field options for an interactive prompt. Or specify all options directly:

dataforger --rows 100 --field name:name --field email:email --field age:age --format csv --output users.csv --seed 42

CLI options

Option Description Default
--field NAME:TYPE Output column name and the type of value to generate. Repeat to add fields. Prompts for fields if omitted
--rows COUNT Number of records. Must be a positive integer. 10
--format {csv,json} Output file format. json
--output PATH Path to the output file. data.json or data.csv, based on format
--seed INTEGER Seed for repeatable output. Random

NAME is the column/key to write in the output; choose any non-empty name. TYPE must be one of the supported field types below. For example, --field first_name:first_name creates a column named first_name using generated first names, while --field given:first_name creates the same kind of values under the column name given.

Supported field types

Type Generated value
name Full name
first_name First name
last_name Last name
email Email address using a reserved example domain
phone Phone-like number
address Street address including a generated city
city City from the bundled country-to-city data
country Country from the bundled country-to-city data
company Company name
uuid UUID
date Date between 1970-01-01 and today
age Integer from 0 to 100
integer Integer from 0 to 100,000
float Decimal value from 0 to 100,000
boolean true or false

When a record requests both country and city, the city is selected from that country's city list. If it also requests address, its city matches those fields.

Python API

from dataforger import generate_data, write_data

records = generate_data(
    {
        "first_name": "first_name",
        "last_name": "last_name",
        "country": "country",
        "city": "city",
        "email": "email",
        "age": "age",
    },
    rows=100,
    seed=42,
)

write_data(records, "users.json", "json")
write_data(records, "users.csv", "csv")

generate_data returns a list of dictionaries. Pass the resulting records, an output path, and either "csv" or "json" to write_data. Its parameters are fields (a mapping of output column names to supported types), rows (positive record count), and optional seed (integer for repeatable values). write_data takes records, output (path), and format ("csv" or "json").

Metadata

Release files for dataforger 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataforger 0.1.2
File Size Uploaded Provenance
dataforger-0.1.2.tar.gz 362.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dataforger 0.1.2
File Interpreter ABI Platform
dataforger-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 722.9 kB

Release files / dataforger-0.1.2.tar.gz

Download URL dataforger-0.1.2.tar.gz
Size 362.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0d5070fad471506ff82e3aecf768c9f911ec6d926770aec74a83498df09b9b04
BLAKE2b-256 checksum
How to use checksums
00971a4631415a01cab87b9cccf99872588217be1c08b2d8038c2d98e4753c42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dataforger-0.1.2-py3-none-any.whl

Download URL dataforger-0.1.2-py3-none-any.whl
Size 360.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c8d63239af570fc48eff33a6fdbdcb94b7fbe04969aca31c13d6f9691f2a6c3
BLAKE2b-256 checksum
How to use checksums
64fd4712060f1b0ac4b49bdf8cd5913c8c8aa88f064c201c87860596569fdc76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Security for dataforger 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dataforger-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page