Skip to content

Conversation

bardusco
Copy link

Summary

This PR resolves issue #4, where Python projects using requirements.txt failed to execute due to missing system dependencies. The error was reported as "undefined", making debugging difficult.

Changes Introduced

  • Updated the run_project.go logic to correctly install Python dependencies using uv in a virtual environment.
  • Ensured required system packages (apt-utils, build-essential) are installed before running uv pip install.
  • Set DEBIAN_FRONTEND=noninteractive to prevent interactive prompts in Docker builds.

Why this Fix?

  • 🛠️ Fixes project execution failures by ensuring dependencies are installed correctly before running the Python script.

Steps to Test

  1. Create a Python project with main.py and requirements.txt.
  2. Add dependencies (e.g., requests==2.31.0).
  3. Run the project using:
    mcp__code-sandbox__run_project \
        --projectDir /path/to/project \
        --language python \
        --entrypointCmd "python main.py"
  4. Verify that:
    • The sandbox successfully creates a Docker container.
    • Dependencies are installed correctly using uv.
    • The Python script runs without failure.
    • The tool returns the resource URI of the container logs.

Closes Issue:

Closes #4 — Python projects with requirements.txt now execute correctly inside the MCP Code Sandbox.


💡 Let me know if you need any modifications! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fails to run Python projects with requirements.txt

1 participant