Files
factorio-learning-environment/BUILD.md
Harshit Sharma 62768e4547 Restructure (#244)
* started restructure

* mv scripts

* wont need sys.paths - breaking change

* rename env/src to env

* renamed from env.src to from env.

* mcp server changes

* added fle.env.__init__ with changed imports

* eval changes

* db_client to commons

* moved modules around and continuing to standardaise and fix imports

* even more module import fixes + stdzn

* agents changes no bueno

* import fixes and standardization

* DANGEROUS SCRIPT REMOVED

* removed legacy_gym_env

* fixing imports

* removed rcon from env

* gym_eval works

* Update .gitignore

Remove s/venv type and add trajectory_logs which was added in gym pr.

* remove Exceptions pursuant to issue 229.

* move MANUAL_short.md to algorithms/beam since that’s where it’s used. And delete MANUAL.md since it’s unused.

* add back exception removed incorrectly

* fixing env -> fle/env

* updated for new structure

* leftover changes

* update project structure in readme

* removed legacy building scripts

* moved common.models.camera.py::Camera to entities.py

* reduce relative imports + move time TimeMetrics to fix circular imports

* move all file writes to .fle directory

* fix camera circular import + reduce relative imports

* clean entrypoint + -m fle.run --run_config runs out of the box

* fixed imports

* remove deprecated code from db_client.py

* type annotation error - the function signature says it returns List[str] but it actually returns a tuple of three lists.

* moved camera.py out of entities

* fixed path issues

* fixed imports

* fixes to save_load but not for blueprint_based_policy

* fix code pushed by mistake

* fixed imports + brought some usage upto date

* import fixes

* fixed game.instance usage

* fixed imports

* fixed imports

* moved cluster_ips to commons

* remove unused section in readme

* fix: standardize all README naming to README.md

* added cluster dep

* Delete manifest since it is only used with setup tools which has been removed. And migrate pytest.ini to pyproject.

* delete function in fle/cluster/scenarios/default_lab_scenario/control.lua tagged for deletion

* add missing quotations

* hot fix to render was using old luaplayer moved to agent character

* cluster commons change

* removed path

* default lab scenario small

added new

* add project urls

* rewrite clean.sh

* update action version number following best practices

* Update exclusion files in Py Project.

* Remove duplicate leaderboard directories, and the deploy website workflow as well as add the publish to py test and publish to normal pypi.

* fix: deploy all docs and leaderboard build to gh-pages root

* fix docs for release

* fix the releases

* undo, it turns out the links break in releases

* update process-results workflow for new docs/leaderboard path

* last change to fix workflow 🤞

* fixing workflows to publish

* remove publishing, modify contributing and build, validate_installation was redundant because it's already in build, and update testpypi to push on commit

* increment patch to test testpypi upload

* trusted publishing

* bumping patch by 1

* third attempt at publishing to testpypi

* choosing truly unique version number

* README.md

* remove testpypi upload hook so that it stops trying to upload the same version with failure

* Update README.md

* update exclude

* changes to server.lua for can place entity

* refactor: clean up unused Docker scripts and redundant files

Remove unused and redundant files from fle/cluster/docker/:

- main.py: Redundant Python script that duplicates run_local.sh functionality
  with hardcoded ports and basic container management. Not used in workflow.

- install-docker.sh: AWS EC2-specific setup script with hardcoded instance
  (ec2-18-133-239-115) and outdated Amazon Linux commands. Current workflow
  uses docker-compose instead.

- probe.sh: Simple port checking script using lsof. Redundant since
  docker-compose handles health checks and container status monitoring.

- setup_docker_repo.sh: AWS ECR-specific setup with hardcoded AWS account
  (216370203482). Contains mostly commented code and unused ECR repository
  configuration. Not used in current workflow.

- requirements.txt: Redundant Python dependency file. Docker is a system
  dependency, not a Python package. The Python docker SDK is already
  included in pyproject.toml dependencies.

Kept essential files: Dockerfile, build scripts, run scripts, config/,
mods/, and README.md which are actively used in the Docker workflow.

* Fix test_assertion_exception to expect correct error output

* Add propagate_errors parameter to eval method for clearer API

* remove clean.sh from build, remove clean.sh since uv build will happen on github actions now exclusively. change imports to absolute in init.py, rename readmes, remove errneous docstring in run.py, remove duplicate dev dependencies in pyproject.toml and add python 3.13

* add testpypi on merge

* merge resolution

* Make README install/run instructions compatible with both pip/python and uv. Add python -m alternatives and clarify both are supported.

* add git clone back

* Simplify test_assertion_exception to minimal robust form

* Fix all test assertions to match actual system behavior

* remove commented code

* ci: nightly patch bump and publish job with schedule trigger

* Update publish-testpypi.yml

---------

Co-authored-by: kiankyars <69437137+kiankyars@users.noreply.github.com>
Co-authored-by: Kian Kyars <kiankyars@gmail.com>
2025-07-07 11:07:43 +02:00

1018 B

Building the factorio_learning_environment Package

This document explains how to build and install the Factorio Learning Environment package.

Building the Package

uv build

This will:

  1. Create the package structure
  2. Build a wheel (.whl) in the dist/ directory

Installing from the Wheel

pip install dist/factorio_learning_environment-*.whl

Verifying the Installation

To verify that the installation was successful:

# Create a test environment
mkdir -p test_install && cd test_install
python -m venv test_env
source test_env/bin/activate

# Install the wheel
pip install ../dist/factorio_learning_environment-*.whl

# Verify installation
python -c "import factorio_learning_environment; print(factorio_learning_environment.__file__)"

Using the Package

After installation, import the package in your code:

# Import the main package
import fle

# Import specific components
from fle import env

# Access modules
env_instance = env.Instance()