-
Notifications
You must be signed in to change notification settings - Fork 88
Kian Kyars edited this page Jul 8, 2025
·
1 revision
- My assumption is that users will start a new project, import FLE, use env = gym.make("Lab") and then feed it some configuration, and use env.run() which would spin up the container (maybe pull down the image) and handle all of the complex handling. So the user wouldn't even need to know what was in the FLE codebase.
- this sounds good apart from our current config.json setup requiring FLE codebase knowledge, and the aforementioned .env files. Please discuss this at tonights meeting
Best practices from other Python packages:
-
Ship example configs as package data (e.g.
config.example.yaml,default_config.json) -
Expose a CLI command to copy these to the user’s working directory (e.g.
mytool initormytool config generate) -
Allow user to override config location via CLI flag or env var (e.g.
--config path/to/config.jsonorMYTOOL_CONFIG=...) - Use sensible defaults if config is missing
Examples:
-
mlflow:mlflow server --default-artifact-root ...(uses default config, can override) -
dvc:dvc initcreates.dvc/config -
jupyter:jupyter notebook --generate-configcreates~/.jupyter/jupyter_notebook_config.py
- Ship a
.env.exampleor similar template - Document required variables in README and error messages
-
Load
.envautomatically (usingpython-dotenv) if present in CWD - Allow all config via env vars as fallback/override
- Fail with clear error if required env vars are missing
Examples:
-
python-dotenvis used by many projects (e.g.openai,fastapitemplates) -
prefectandmlflowboth support env var config
-
Provide a CLI command to scaffold config and .env
(e.g.mytool initormytool setup) - Print next steps (e.g. “Edit .env and fill in your API keys”)
| Practice | Example Packages | FLE Should... |
|---|---|---|
| Ship example configs | jupyter, dvc, mlflow | Include in package data |
| CLI to copy/init config | jupyter, dvc | Add fle init
|
| .env template | openai, fastapi | Include .example.env
|
| Auto-load .env | openai, fastapi | Use python-dotenv
|
| Env var fallback | mlflow, prefect | Support for all config |
| Clear error on missing | all good packages | Print helpful error messages |
TL;DR:
- Ship example configs and .env in the package
- Provide a CLI to scaffold/copy them
- Auto-load .env, allow env var overrides
- Print clear errors if missing