Implementation:Wandb Weave Run Setup In Codex
| Knowledge Sources | |
|---|---|
| Domains | DevOps, Containerization |
| Last Updated | 2026-02-14 10:53 GMT |
Overview
Concrete tool for running the Weave development environment setup inside an OpenAI Codex Universal Docker container, provided by the Weave repository.
Description
The run_setup_in_codex.sh script is a Bash entry point that orchestrates containerized development environment setup. It launches a Docker container from the OpenAI Codex Universal image, mounts the current workspace, and executes bin/codex_setup.sh inside the container. The script handles the full lifecycle: Docker availability validation, image pulling, container execution with workspace mounting, and automatic cleanup via a trap handler. Utility functions provide ANSI-colored structured output (info, success, warning, error). The container is given a unique timestamped name to avoid collisions and uses --rm for automatic removal.
Usage
Use this script when setting up the Weave development environment inside a containerized context, particularly on the OpenAI Codex platform. It ensures the setup runs in an isolated, reproducible Docker environment regardless of the host machine's configuration.
Code Reference
Source Location
- Repository: Wandb_Weave
- File: bin/run_setup_in_codex.sh
- Lines: 1-322
Signature
#!/bin/bash
# Entry point: main()
#
# Functions:
# main [OPTIONS] - Parse args, validate Docker, pull image, run setup
# check_docker - Verify Docker is installed and the daemon is running
# pull_codex_image - Pull the Codex Universal container image
# run_setup_in_container - Launch container, mount workspace, execute setup
# cleanup - Remove container resources on exit (trap handler)
# show_usage - Print help/usage information
#
# Options:
# -h, --help Show help message
# --no-pull Skip pulling the latest container image
#
# Environment:
# CODEX_IMAGE Override the default container image
# (default: ghcr.io/openai/codex-universal:latest)
Import
# Direct execution from repository root:
./bin/run_setup_in_codex.sh
# With options:
./bin/run_setup_in_codex.sh --no-pull
# With custom image:
CODEX_IMAGE=custom:tag ./bin/run_setup_in_codex.sh
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| --help | CLI flag | No | Display usage information and exit |
| --no-pull | CLI flag | No | Skip pulling the latest container image |
| CODEX_IMAGE | Environment variable | No | Override the default Codex Universal image (default: ghcr.io/openai/codex-universal:latest) |
| bin/codex_setup.sh | File | Yes | The actual setup script executed inside the container |
Outputs
| Name | Type | Description |
|---|---|---|
| Configured environment | Side effect | Development tools installed and configured inside the container |
| Exit code 0 | Integer | Successful setup completion |
| Exit code 1 | Integer | Failure (Docker unavailable, image pull failure, or missing setup script) |
| Colored log output | Stdout | ANSI-colored progress messages |
Usage Examples
Basic Usage
# Run from the Weave project root directory
cd /path/to/weave
./bin/run_setup_in_codex.sh
Skip Image Pull
# Use an already-cached local image
./bin/run_setup_in_codex.sh --no-pull
Custom Container Image
# Use a specific version of the Codex image
CODEX_IMAGE=ghcr.io/openai/codex-universal:v2.0 ./bin/run_setup_in_codex.sh
Related Pages
Note: This script requires Docker but operates as a standalone shell tool outside the Weave Python SDK runtime.