Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
python-version: "3.14"
- uses: astral-sh/setup-uv@v3
- run: uv venv --python 3.14
- run: uv pip install build
- name: Create tag from version
run: |
VERSION=$(python scripts/get-version.py)
Expand All @@ -66,6 +65,6 @@ jobs:
TAG="v$VERSION"
echo "Verifying tag $TAG matches version $VERSION"
- name: Build
run: uv run python -m build
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 12 additions & 1 deletion examples/sandbox_07_ruby_sinatra.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ async def main() -> None:
runtime = (
os.getenv("SANDBOX_RUNTIME") or "node22"
) # note: ruby runtime is not supported so we have to install ruby via dnf
bundle_env = {
"BUNDLE_APP_CONFIG": ".bundle",
"BUNDLE_USER_HOME": ".bundle-home",
"BUNDLE_PATH": "vendor/bundle",
"BUNDLE_CACHE_PATH": "vendor/cache",
}

# Sinatra default port is 4567
port = 4567
Expand Down Expand Up @@ -101,10 +107,13 @@ async def main() -> None:
"-lc",
(
f"cd {sandbox.sandbox.cwd} && "
"mkdir -p .bundle-home vendor/cache && "
"bundle config set --local path vendor/bundle && "
"bundle config set --local cache_path vendor/cache && "
"bundle config set --local without 'development:test'"
),
],
env=bundle_env,
)
async for line in bundler_cfg_cmd.logs():
print(line.data, end="")
Expand All @@ -120,6 +129,7 @@ async def main() -> None:
"-lc",
(f"cd {sandbox.sandbox.cwd} && bundle install --jobs 4 --retry 3"),
],
env=bundle_env,
)
async for line in bundle_install_cmd.logs():
print(line.data, end="")
Expand All @@ -135,9 +145,10 @@ async def main() -> None:
(
f"cd {sandbox.sandbox.cwd} && "
# Start via rackup using WEBrick, binding to 0.0.0.0 and selected port
f"RACK_ENV=production bundle exec rackup -s webrick -o 0.0.0.0 -p {port}"
f"bundle exec rackup -s webrick -o 0.0.0.0 -p {port}"
),
],
env={**bundle_env, "RACK_ENV": "production"},
)
Comment on lines +148 to 152
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RACK_ENV=production and the bundler env settings are currently injected by concatenating shell fragments into the bash -lc string. Since run_command_detached supports an explicit env dict, passing these via env would avoid shell quoting issues and makes it clearer which variables are being set for the process.

Copilot uses AI. Check for mistakes.

# Stream logs and open browser once server is ready.
Expand Down
25 changes: 20 additions & 5 deletions examples/sandbox_09_rails_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ async def main() -> None:
runtime = (
os.getenv("SANDBOX_RUNTIME") or "node22"
) # note: ruby runtime is not supported so we install ruby via dnf
bundle_env = {
"BUNDLE_APP_CONFIG": ".bundle",
"BUNDLE_USER_HOME": ".bundle-home",
"BUNDLE_PATH": "vendor/bundle",
"BUNDLE_CACHE_PATH": "vendor/cache",
}

# Rails default port is 3000
port = 3000
Expand Down Expand Up @@ -104,6 +110,7 @@ async def main() -> None:
"--skip-action-cable "
"--skip-system-test "
"--skip-git "
"--skip-bundle "
"--force"
),
],
Expand All @@ -122,8 +129,14 @@ async def main() -> None:
"bash",
[
"-lc",
(f"cd {app_path} && bundle config set --local path vendor/bundle"),
(
f"cd {app_path} && "
"mkdir -p .bundle-home vendor/cache && "
"bundle config set --local path vendor/bundle && "
"bundle config set --local cache_path vendor/cache"
),
],
env=bundle_env,
)
async for line in bundler_cfg_cmd.logs():
print(line.data, end="")
Expand All @@ -139,6 +152,7 @@ async def main() -> None:
"-lc",
(f"cd {app_path} && bundle install --jobs 4 --retry 3"),
],
env=bundle_env,
)
async for line in bundle_install_cmd.logs():
print(line.data, end="")
Expand All @@ -157,6 +171,7 @@ async def main() -> None:
"bundle exec rails generate scaffold Post title:string body:text"
),
],
env=bundle_env,
)
async for line in scaffold_cmd.logs():
print(line.data, end="")
Expand Down Expand Up @@ -185,6 +200,7 @@ async def main() -> None:
"-lc",
(f"cd {app_path} && bundle exec rails db:migrate"),
],
env=bundle_env,
)
async for line in migrate_cmd.logs():
print(line.data, end="")
Expand All @@ -200,6 +216,7 @@ async def main() -> None:
"-lc",
(f"cd {app_path} && bundle exec rails db:seed"),
],
env=bundle_env,
)
async for line in seed_cmd.logs():
print(line.data, end="")
Expand All @@ -216,11 +233,9 @@ async def main() -> None:
"bash",
[
"-lc",
(
f"cd {app_path} && "
f"ALLOWED_HOST={allowed_host} bundle exec rails server -b 0.0.0.0 -p {port}"
),
(f"cd {app_path} && bundle exec rails server -b 0.0.0.0 -p {port}"),
],
env={**bundle_env, "ALLOWED_HOST": allowed_host},
)

# Stream logs and open browser once server is ready.
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

uv run python -m build
uv build
Loading