From 995fdf6d731dec86b3d887a441dbb0ab28f34263 Mon Sep 17 00:00:00 2001 From: Ibrahim Olanigan Date: Fri, 9 Jan 2026 08:28:43 -0500 Subject: [PATCH] add Makefile and README update --- Makefile | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 12 ++++++++++-- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..fed3e52f --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +.PHONY: help install install-dev install-modal run-all \ + quickstart docker-repl lm-repl modal-repl \ + lint format test check + +help: + @echo "RLM Examples Makefile" + @echo "" + @echo "Usage:" + @echo " make install - Install base dependencies with uv" + @echo " make install-dev - Install dev dependencies with uv" + @echo " make install-modal - Install modal dependencies with uv" + @echo " make run-all - Run all examples (requires all deps and API keys)" + @echo "" + @echo "Examples:" + @echo " make quickstart - Run quickstart.py (needs OPENAI_API_KEY)" + @echo " make docker-repl - Run docker_repl_example.py (needs Docker)" + @echo " make lm-repl - Run lm_in_repl.py (needs PORTKEY_API_KEY)" + @echo " make modal-repl - Run modal_repl_example.py (needs Modal)" + @echo "" + @echo "Development:" + @echo " make lint - Run ruff linter" + @echo " make format - Run ruff formatter" + @echo " make test - Run tests" + @echo " make check - Run lint + format + tests" + +install: + uv sync + +install-dev: + uv sync --group dev --group test + +install-modal: + uv pip install -e ".[modal]" + +run-all: quickstart docker-repl lm-repl modal-repl + +quickstart: install + uv run python -m examples.quickstart + +docker-repl: install + uv run python -m examples.docker_repl_example + +lm-repl: install + uv run python -m examples.lm_in_repl + +modal-repl: install-modal + uv run python -m examples.modal_repl_example + +lint: install-dev + uv run ruff check . + +format: install-dev + uv run ruff format . + +test: install-dev + uv run pytest + +check: lint format test diff --git a/README.md b/README.md index 48b5c988..df6483fa 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,17 @@ uv init && uv venv --python 3.12 # change version as needed uv pip install -e . ``` -To run a quick test, the following will run an RLM query with the OpenAI client using your environment variable `OPENAI_API_KEY` (feel free to change this). This will generate console output as well as a log which you can use with the visualizer to explore the trajectories. +### Makefile Usage +This project includes a `Makefile` to simplify common tasks. + +- `make install`: Install base dependencies. +- `make install-dev`: Install development dependencies. +- `make check`: Run linter, formatter, and tests. +- `make quickstart`: Run the quickstart example. + +To run a quick test, the following will run an RLM query with the OpenAI client using your environment variable `OPENAI_API_KEY` (feel free to change this). This will generate console output as well as a log which you can use with the visualizer to explore the trajectories. ```bash -uv run examples/quickstart.py +make quickstart ``` The default RLM client uses a REPL environment that runs on the host process through Python `exec` calls. It uses the same virtual environment as the host process (i.e. it will have access to the same dependencies), but with some limitations in its available global modules. As an example, we can call RLM completions using GPT-5-nano: