Skip to main content

factorio: A fixtures replacement tool

build lint tests license codecov readthedocs pypi downloads build automation: yam Lint: ruff

factorio is a fixtures replacement tool that's been heavily influenced by factory boy. It's intention is to hide irrelevant fields when writing a test.

Even though it's been designed to play well with various ORMs, it tries to avoid any interaction with a database, as the saving/retrieving an object shouldn't be the responsibility of the factory.

Under the hood it uses faker to create realistic values for each field.

Quick Start

from dataclasses import dataclass
from factorio import fields
from factorio.factories import Factory


@dataclass
class User:
    name: str
    email: str
    age: int


class UserFactory(Factory[User]):
    name = fields.TextField("name")
    email = fields.TextField("email")
    age = fields.IntegerField(min_value=18, max_value=65)


user = UserFactory.build()
# user.name might be "Sarah Johnson"
# user.email might be "sarah.johnson@example.com"
# user.age might be 34

Key Features

  • 🎯 Explicit Object Creation: Requires .build() method for clarity and safety
  • 🚫 No Database Interaction: Factories generate data, tests handle persistence
  • ✨ Realistic Data: Powered by Faker for lifelike test data
  • 🔧 20+ Field Types: From primitives to collections and nested factories
  • 🎨 Flexible Overrides: Override fields with values or dynamic field instances
  • 📦 ORM Agnostic: Works with dataclasses, Pydantic, SQLAlchemy, and more
  • 🛡️ Type Safe: Full type hints and mypy support

Documentation

Links

Release files for factorio 0.8.0

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

Source distribution (sdist)

Source distribution for factorio 0.8.0
File Size Uploaded
factorio-0.8.0.tar.gz 6.7 kB Details

Built distribution (wheel)

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

Total release size: 13.2 kB

Release files / factorio-0.8.0.tar.gz

Download URL factorio-0.8.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7fefee87ce6988500089e22be2c40bcc20966d32bf26b8659573b313c682b80a
BLAKE2b-256 checksum
How to use checksums
78adb2bfe235c82fff6803cf5a30448c0935009b9d866bdd31f6f049ef9ffe69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / factorio-0.8.0-py3-none-any.whl

Download URL factorio-0.8.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3905451371112f4ebce2db49b5a882b473c5e12d8c2f0384c14f51d13e93d5b4
BLAKE2b-256 checksum
How to use checksums
6e6bf3b03a0da5edf25e03eddb9158c0ab8dc439875c0f862f58e333ab95837a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

1 release file

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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