Skip to content
Kian Kyars edited this page Jul 8, 2025 · 3 revisions

Python Packaging Interface Summary for FLE


User Experience Goal

  • Users: uv add factorio-learning-environment
  • Then: import gym; env = gym.make("Lab"); env.run()
  • All config, Docker, and setup handled automatically—no FLE codebase knowledge needed.

Best Practices to Implement

  1. CLI Bootstrapping

    • Add fle init to scaffold configs and .env.
    • Add fle docker-setup for Docker automation.
    • Print clear next steps after CLI commands.
  2. Config & .env Handling

    • Auto-load .env (with python-dotenv).
    • Allow all config via env vars as fallback/override.
    • Fail with clear, actionable errors if required config/env vars are missing.

Implementation Details

  • Config (fle/config.py):
    • Use Pydantic for config models and validation.
    • Use python-dotenv to load .env.
    • Provide validate_for_experiment() for FLE-specific checks.

Workflow

uv add factorio-learning-environment
fle init                # Scaffold configs and .env
fle cluster             # Setup Docker
fle eval                # Run experiment

or

from fle.core import FLECore
fle = FLECore()         # Loads config, validates setup
fle.run_experiment(...) # Run directly in Python
  • Current config/.env setup requires FLE codebase knowledge—this will be fixed by packaging all needed files and providing CLI scaffolding.
  • All config validation and loading will use Pydantic + python-dotenv (no custom code).
  • CLI and Python API will share the same core logic for config, validation, and running experiments.
  • After these changes, FLE will be truly "pip install and go" for both CLI and Python users.

Clone this wiki locally