Summary
The Python quickstart codebox.py example can look like a silent no-op for first-time users in a clean environment.
Reproduction
Using the current quickstart snippet:
import asyncio
import boxlite
async def main():
code = """
import requests
response = requests.get('https://api.github.com/zen')
print(response.text)
"""
async with boxlite.CodeBox() as codebox:
result = await codebox.run(code)
print(result)
if __name__ == "__main__":
asyncio.run(main())
In a fresh python:slim runtime, this often returns empty output.
Why it happens
- The snippet imports
requests but does not install it first.
- In fresh environments,
requests is commonly missing (ModuleNotFoundError).
CodeBox.run() returns stdout only, so errors in stderr are not visible from print(result).
User impact
For newcomers following the official quickstart, this feels like a broken first-run experience (no output, no obvious error).
Proposed fix
Update quickstart snippet to install dependency explicitly before running code:
async with boxlite.CodeBox() as codebox:
await codebox.install_package("requests")
result = await codebox.run(code)
print(result)
Optionally, document that run() returns stdout only and that stderr is available via exec() when debugging failures.
Summary
The Python quickstart
codebox.pyexample can look like a silent no-op for first-time users in a clean environment.Reproduction
Using the current quickstart snippet:
In a fresh
python:slimruntime, this often returns empty output.Why it happens
requestsbut does not install it first.requestsis commonly missing (ModuleNotFoundError).CodeBox.run()returns stdout only, so errors in stderr are not visible fromprint(result).User impact
For newcomers following the official quickstart, this feels like a broken first-run experience (no output, no obvious error).
Proposed fix
Update quickstart snippet to install dependency explicitly before running code:
Optionally, document that
run()returns stdout only and that stderr is available viaexec()when debugging failures.