Production chain calculator for the game Factorio
Project description
factorio-planner ๐ญ
Production chain calculator for Factorio.
Given an item and a target production rate, factorio-planner resolves the full dependency tree and tells you exactly how many machines, furnaces and raw resources you need.
โจ Features
- Full dependency resolution โ recursively resolves every ingredient down to raw ores/fluids
- Machine counts โ calculates exact (fractional) machines needed per tier
- Productivity & speed bonuses โ model module effects with a single parameter
- CLI tool โ run
factorio-planner electronic-circuit --rate 10directly in your terminal - JSON output โ machine-readable output for integration with other tools
- Graph visualisation โ render the production chain as a directed graph (optional dep)
- Extensible recipe DB โ load custom/modded recipes from JSON
- Zero required dependencies โ core library needs nothing beyond the Python stdlib
๐ฆ Installation
pip install factorio-planner
With graph visualisation support:
pip install "factorio-planner[graph]"
๐ Quick start
Python API
from factorio_planner import Calculator
calc = Calculator()
plan = calc.compute("electronic-circuit", rate=10)
print(plan.summary())
Output:
Production plan: 10.00 electronic-circuit/s
Machines required:
assembling-machine-1: 10.0
stone-furnace: 22.4
Raw resources (per second):
copper-ore: 15.00/s
iron-ore: 10.00/s
Full formatted plan with tree
from factorio_planner import Calculator
from factorio_planner.formatter import format_plan
calc = Calculator()
plan = calc.compute("electronic-circuit", rate=10)
print(format_plan(plan))
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FACTORIO PRODUCTION PLAN
Target: 10.00 ร electronic-circuit / second
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Production tree:
electronic-circuit ร10.00/s [ร5.0 assembling-machine-1]
โโโ iron-plate ร10.00/s [ร32.0 stone-furnace]
โ โโโ iron-ore ร10.00/s [RAW]
โโโ copper-cable ร30.00/s [ร7.5 assembling-machine-1]
โโโ copper-plate ร15.00/s [ร48.0 stone-furnace]
โโโ copper-ore ร15.00/s [RAW]
...
With productivity modules
# +40% productivity (research fully upgraded)
calc = Calculator(productivity_bonus=0.4)
plan = calc.compute("advanced-circuit", rate=5)
print(plan.summary())
Visualise the production graph
from factorio_planner import Calculator
from factorio_planner.graph import draw
calc = Calculator()
plan = calc.compute("utility-science-pack", rate=1)
fig = draw(plan)
fig.savefig("production_chain.png", dpi=150)
๐ฅ๏ธ CLI usage
# 10 electronic circuits per second
factorio-planner electronic-circuit --rate 10
# With productivity bonus
factorio-planner advanced-circuit --rate 5 --productivity 0.4
# JSON output (pipe-friendly)
factorio-planner iron-plate --rate 3 --json
# Skip tree, show only totals
factorio-planner utility-science-pack --rate 1 --no-tree
๐ Tutorial notebook
The notebook walks through every feature step by step, from basic usage to full rocket-launch planning.
๐ง Custom / modded recipes
import json
from factorio_planner import Calculator, RecipeDB
from factorio_planner.models import Recipe
# Option A: add one recipe programmatically
db = RecipeDB()
db.add(Recipe(
name="my-mod-item",
ingredients={"iron-plate": 3, "electronic-circuit": 1},
products={"my-mod-item": 1},
crafting_time=2.0,
machine="assembling-machine-2",
))
calc = Calculator(db=db)
# Option B: load from JSON file
db2 = RecipeDB.from_json("my_mod_recipes.json")
calc2 = Calculator(db=db2)
๐ณ Docker
# Run examples inside Docker
docker build -t factorio-planner .
docker run --rm factorio-planner factorio-planner electronic-circuit --rate 10
๐งช Running tests
pip install "factorio-planner[dev]"
pytest --cov=factorio_planner
๐ License
MIT โ see LICENSE.
factorio-planner is a fan project and is not affiliated with Wube Software.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file factorio_planner-0.1.0.tar.gz.
File metadata
- Download URL: factorio_planner-0.1.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23ed5b385143b37ac79d47ccfc0ea52279dd0d4a5300a5160af2fe2fd0290374
|
|
| MD5 |
0fce0fbaeeff0f789725e7fa500403b2
|
|
| BLAKE2b-256 |
ff8c9e56e592def2d4f42f737dbf4226e6b6d597a3fcd57922c309201442967e
|
Provenance
The following attestation bundles were made for factorio_planner-0.1.0.tar.gz:
Publisher:
publish.yml on BernardRivera13/factorio-planner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
factorio_planner-0.1.0.tar.gz -
Subject digest:
23ed5b385143b37ac79d47ccfc0ea52279dd0d4a5300a5160af2fe2fd0290374 - Sigstore transparency entry: 1301631463
- Sigstore integration time:
-
Permalink:
BernardRivera13/factorio-planner@db2c506c81573ff7e53c266d9d7624bbd372a893 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/BernardRivera13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db2c506c81573ff7e53c266d9d7624bbd372a893 -
Trigger Event:
release
-
Statement type:
File details
Details for the file factorio_planner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: factorio_planner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dc7415464d44231ec2ae2bf51454432cbf88ec5cadacd3aecae30be5d236ec2
|
|
| MD5 |
ec95f6673a3651e99681a54825e0aa33
|
|
| BLAKE2b-256 |
d2c36d5d7e9810b406d58c9efdcfdd737d99c05a05080e8f0ed028f59bd1b727
|
Provenance
The following attestation bundles were made for factorio_planner-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on BernardRivera13/factorio-planner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
factorio_planner-0.1.0-py3-none-any.whl -
Subject digest:
2dc7415464d44231ec2ae2bf51454432cbf88ec5cadacd3aecae30be5d236ec2 - Sigstore transparency entry: 1301631569
- Sigstore integration time:
-
Permalink:
BernardRivera13/factorio-planner@db2c506c81573ff7e53c266d9d7624bbd372a893 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/BernardRivera13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db2c506c81573ff7e53c266d9d7624bbd372a893 -
Trigger Event:
release
-
Statement type: