mcp_run_isolated_python 0.0.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. mcp_run_isolated_python-0.2.0/.github/FUNDING.yml +4 -0
  2. mcp_run_isolated_python-0.2.0/.github/ISSUE_TEMPLATE/config.yml +1 -0
  3. mcp_run_isolated_python-0.2.0/.github/ISSUE_TEMPLATE/feature-form.yml +30 -0
  4. mcp_run_isolated_python-0.2.0/.github/ISSUE_TEMPLATE/issue-form.yml +47 -0
  5. mcp_run_isolated_python-0.2.0/.github/ISSUE_TEMPLATE/question-form.yml +31 -0
  6. mcp_run_isolated_python-0.2.0/.github/actions/setup_python_environment/action.yaml +30 -0
  7. mcp_run_isolated_python-0.2.0/.github/pull_request_template.md +15 -0
  8. mcp_run_isolated_python-0.2.0/.github/workflows/publish.yml +73 -0
  9. mcp_run_isolated_python-0.2.0/.github/workflows/pytest.yml +39 -0
  10. mcp_run_isolated_python-0.2.0/.github/workflows/ruff_format.yml +25 -0
  11. mcp_run_isolated_python-0.2.0/.github/workflows/ruff_linter.yml +25 -0
  12. mcp_run_isolated_python-0.2.0/.github/workflows/ty.yml +25 -0
  13. mcp_run_isolated_python-0.2.0/.gitignore +143 -0
  14. mcp_run_isolated_python-0.2.0/.intelij/Run CLI.run.xml +18 -0
  15. mcp_run_isolated_python-0.2.0/.intelij/Run MCP server.run.xml +18 -0
  16. mcp_run_isolated_python-0.2.0/.intelij/Run Tests.run.xml +21 -0
  17. mcp_run_isolated_python-0.2.0/.pre-commit-config.yaml +25 -0
  18. mcp_run_isolated_python-0.2.0/CONTRIBUTING.md +2 -0
  19. mcp_run_isolated_python-0.2.0/Dockerfile +81 -0
  20. mcp_run_isolated_python-0.2.0/PKG-INFO +165 -0
  21. mcp_run_isolated_python-0.2.0/README.md +141 -0
  22. mcp_run_isolated_python-0.2.0/default_srt_settings.json +14 -0
  23. mcp_run_isolated_python-0.2.0/docker-compose.yml +12 -0
  24. mcp_run_isolated_python-0.2.0/docker-entrypoint.sh +16 -0
  25. {mcp_run_isolated_python-0.0.0 → mcp_run_isolated_python-0.2.0}/pyproject.toml +17 -8
  26. mcp_run_isolated_python-0.2.0/setup_host.sh +11 -0
  27. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/__init__.py +5 -0
  28. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/cli.py +154 -0
  29. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/code_executor.py +139 -0
  30. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/direct_use.py +73 -0
  31. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/mcp_server.py +61 -0
  32. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/utils/logger.py +42 -0
  33. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/utils/otel.py +20 -0
  34. mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/utils/settings.py +45 -0
  35. mcp_run_isolated_python-0.2.0/tests/conftest.py +20 -0
  36. mcp_run_isolated_python-0.2.0/tests/unit/code_executor/test_failure.py +105 -0
  37. mcp_run_isolated_python-0.2.0/tests/unit/code_executor/test_success.py +169 -0
  38. mcp_run_isolated_python-0.2.0/tests/unit/test_cli.py +20 -0
  39. mcp_run_isolated_python-0.2.0/tests/unit/test_direct_use.py +23 -0
  40. mcp_run_isolated_python-0.2.0/tests/unit/test_mcp_server.py +50 -0
  41. mcp_run_isolated_python-0.2.0/uv.lock +1954 -0
  42. mcp_run_isolated_python-0.0.0/PKG-INFO +0 -36
  43. mcp_run_isolated_python-0.0.0/README.md +0 -16
  44. mcp_run_isolated_python-0.0.0/src/mcp_run_isolated_python/cli.py +0 -13
  45. mcp_run_isolated_python-0.0.0/src/mcp_run_isolated_python/misc/logger.py +0 -20
  46. {mcp_run_isolated_python-0.0.0 → mcp_run_isolated_python-0.2.0}/LICENCE +0 -0
  47. {mcp_run_isolated_python-0.0.0/src/mcp_run_isolated_python → mcp_run_isolated_python-0.2.0/src/mcp_run_isolated_python/utils}/__init__.py +0 -0
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: kigstn
4
+ ko_fi: kigstn
@@ -0,0 +1 @@
1
+ blank_issues_enabled: false
@@ -0,0 +1,30 @@
1
+ name: Feature Request
2
+ description: Request a new feature
3
+ title: "[Feature Request]: "
4
+ labels: ["enhancement", "triage"]
5
+
6
+ assignees:
7
+ - Kigstn
8
+
9
+ body:
10
+ - type: markdown
11
+ attributes:
12
+ value: |
13
+ Thanks for taking the time to fill out this feature request!
14
+ Please complete the following form to help us assist you.
15
+
16
+ - type: textarea
17
+ id: feature-description
18
+ attributes:
19
+ label: Feature Description
20
+ description: Describe the feature you are requesting. Try to reference examples when possible.
21
+ validations:
22
+ required: true
23
+
24
+ - type: textarea
25
+ id: value-add
26
+ attributes:
27
+ label: Value of Feature
28
+ description: Why is this feature valuable?
29
+ validations:
30
+ required: false
@@ -0,0 +1,47 @@
1
+ name: Bug Report
2
+ description: File a bug report
3
+ title: "[Bug]: "
4
+ labels: ["bug", "triage"]
5
+
6
+ assignees:
7
+ - Kigstn
8
+
9
+ body:
10
+ - type: markdown
11
+ attributes:
12
+ value: |
13
+ Thanks for taking the time to fill out this bug report!
14
+ Please complete the following form to help us assist you.
15
+
16
+ - type: textarea
17
+ id: what-happened
18
+ attributes:
19
+ label: Bug Description
20
+ description: What happened? If you have screenshots, please add them here.
21
+ validations:
22
+ required: true
23
+
24
+ - type: textarea
25
+ id: steps-to-reproduce
26
+ attributes:
27
+ label: Steps to Reproduce
28
+ description: Which steps should someone take to run into the same error?
29
+ validations:
30
+ required: true
31
+
32
+ - type: input
33
+ id: webpage
34
+ attributes:
35
+ label: Webpage
36
+ description: The URL where the error happened.
37
+ validations:
38
+ required: true
39
+
40
+ - type: textarea
41
+ id: logs
42
+ attributes:
43
+ label: Relevant Browser Console Logs / Errors
44
+ description: Please copy and paste any relevant log output if there is any. This will be automatically formatted into code, so no need for backticks.
45
+ render: shell
46
+ validations:
47
+ required: false
@@ -0,0 +1,31 @@
1
+ name: General Question
2
+ description: Ask a question
3
+ title: "[Question]: "
4
+ labels: ["question"]
5
+
6
+ assignees:
7
+ - Kigstn
8
+
9
+ body:
10
+ - type: markdown
11
+ attributes:
12
+ value: |
13
+ Thanks for taking the time to fill out this question form!
14
+ Please complete the following form to help us assist you.
15
+
16
+ - type: checkboxes
17
+ id: pre-question
18
+ attributes:
19
+ label: Question Validation
20
+ description: By submitting this issue, you agree that you've previously search the existing GitHub issues and did not find a proper answer to your question.
21
+ options:
22
+ - label: I have searched both the my question is not a duplicate.
23
+ required: true
24
+
25
+ - type: textarea
26
+ id: question
27
+ attributes:
28
+ label: Question
29
+ description: Ask your question here!
30
+ validations:
31
+ required: true
@@ -0,0 +1,30 @@
1
+ name: Setup Python Environment
2
+ description: Sets up python environment
3
+
4
+ inputs:
5
+ python-version:
6
+ description: "Python version to use (e.g., 3.10, 3.11, etc.)"
7
+ required: false
8
+ default: "3.13"
9
+
10
+ runs:
11
+ using: "composite"
12
+
13
+ steps:
14
+ - name: Set up `uv`
15
+ uses: astral-sh/setup-uv@v7
16
+ with:
17
+ python-version: ${{ inputs.python-version }}
18
+
19
+ - name: Install requirements
20
+ shell: bash
21
+ run: uv sync --all-extras --dev
22
+
23
+ - name: Install node
24
+ uses: actions/setup-node@v6
25
+
26
+ - name: Install srt & deps
27
+ shell: bash
28
+ run: |
29
+ npm install -g @anthropic-ai/sandbox-runtime@'<=0.0.64'
30
+ sudo apt-get install ripgrep socat bubblewrap
@@ -0,0 +1,15 @@
1
+ ## What type of pull request is this?
2
+ <!-- Check whichever applies to your PR -->
3
+
4
+ - [ ] Hotfix change
5
+ - [ ] Non-breaking code change
6
+ - [ ] Breaking code change
7
+ - [ ] Database change
8
+ - [ ] Tests change
9
+ - [ ] CI change
10
+ - [ ] Other: [Replace with a description]
11
+
12
+ ## Description
13
+ <!-- Clearly and concisely describe what this PR is for, and why you feel it should be merged. -->
14
+ <!-- Ideally include a bullet-pointed list outlining the changes you have made -->
15
+
@@ -0,0 +1,73 @@
1
+ name: "Publish to PyPI"
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ # Publish on any tag starting with a `v`, e.g., v0.1.0
7
+ - v*
8
+
9
+ jobs:
10
+ pypi:
11
+ runs-on: ubuntu-latest
12
+
13
+ environment:
14
+ name: pypi
15
+
16
+ permissions:
17
+ id-token: write
18
+ contents: read
19
+
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v6
23
+
24
+ - name: Setup Python Environment
25
+ uses: ./.github/actions/setup_python_environment
26
+
27
+ - name: Build
28
+ run: uv build
29
+
30
+ - name: Publish
31
+ run: uv publish
32
+
33
+ docker_hub:
34
+ runs-on: ubuntu-latest
35
+
36
+ permissions:
37
+ packages: write
38
+ contents: read
39
+ attestations: write
40
+ id-token: write
41
+
42
+ steps:
43
+ - name: Checkout
44
+ uses: actions/checkout@v6
45
+
46
+ - name: Log in to Docker Hub
47
+ uses: docker/login-action@v4
48
+ with:
49
+ username: ${{ secrets.DOCKER_USERNAME }}
50
+ password: ${{ secrets.DOCKER_PASSWORD }}
51
+
52
+ - name: Extract metadata (tags, labels) for Docker
53
+ id: meta
54
+ uses: docker/metadata-action@v6
55
+ with:
56
+ images: kigstn/mcp-run-isolated-python
57
+
58
+ - name: Build and push Docker image
59
+ id: push
60
+ uses: docker/build-push-action@v7
61
+ with:
62
+ context: .
63
+ file: ./Dockerfile
64
+ push: true
65
+ tags: ${{ steps.meta.outputs.tags }}
66
+ labels: ${{ steps.meta.outputs.labels }}
67
+
68
+ - name: Generate artifact attestation
69
+ uses: actions/attest@v4
70
+ with:
71
+ subject-name: index.docker.io/kigstn/mcp-run-isolated-python
72
+ subject-digest: ${{ steps.push.outputs.digest }}
73
+ push-to-registry: true
@@ -0,0 +1,39 @@
1
+ name: Pytest
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - dev
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - dev
12
+
13
+ jobs:
14
+ pytest:
15
+ # running on ubuntu 22 due to this bug:
16
+ # https://github.com/anthropic-experimental/sandbox-runtime/issues/74
17
+ runs-on: ubuntu-22.04
18
+
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t" ]
23
+
24
+ steps:
25
+ - name: Checkout repository
26
+ uses: actions/checkout@v6
27
+
28
+ - name: Setup Python Environment
29
+ uses: ./.github/actions/setup_python_environment
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+
33
+ - name: Test with Pytest
34
+ run: |
35
+ # install pytest sugar for nicer logs
36
+ uv pip install pytest-sugar
37
+
38
+ uv run --frozen pytest . --force-sugar --color=yes --disable-warnings -qq -r fE
39
+
@@ -0,0 +1,25 @@
1
+ name: Ruff Formater
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - dev
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - dev
12
+
13
+ jobs:
14
+ ruff_format:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v6
20
+
21
+ - name: Setup Python Environment
22
+ uses: ./.github/actions/setup_python_environment
23
+
24
+ - name: Run Ruff Formater
25
+ run: uv run ruff format --check .
@@ -0,0 +1,25 @@
1
+ name: Ruff Linter
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - dev
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - dev
12
+
13
+ jobs:
14
+ ruff_linter:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v6
20
+
21
+ - name: Setup Python Environment
22
+ uses: ./.github/actions/setup_python_environment
23
+
24
+ - name: Run Ruff Linter
25
+ run: uv run ruff check --output-format=github .
@@ -0,0 +1,25 @@
1
+ name: Ty Type Checking
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - dev
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - dev
12
+
13
+ jobs:
14
+ ruff_linter:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v6
20
+
21
+ - name: Setup Python Environment
22
+ uses: ./.github/actions/setup_python_environment
23
+
24
+ - name: Run Ty
25
+ run: uv run ty check --output-format=concise .
@@ -0,0 +1,143 @@
1
+ .testing/
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ share/python-wheels/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ .pdm.toml
88
+ .pdm-python
89
+ .pdm-build/
90
+
91
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
92
+ __pypackages__/
93
+
94
+ # Celery stuff
95
+ celerybeat-schedule
96
+ celerybeat.pid
97
+
98
+ # SageMath parsed files
99
+ *.sage.py
100
+
101
+ # Environments
102
+ .env
103
+ .venv
104
+ env/
105
+ venv/
106
+ ENV/
107
+ env.bak/
108
+ venv.bak/
109
+
110
+ # Spyder project settings
111
+ .spyderproject
112
+ .spyproject
113
+
114
+ # Rope project settings
115
+ .ropeproject
116
+
117
+ # mkdocs documentation
118
+ /site
119
+
120
+ # mypy
121
+ .mypy_cache/
122
+ .dmypy.json
123
+ dmypy.json
124
+
125
+ # Pyre type checker
126
+ .pyre/
127
+
128
+ # pytype static type analyzer
129
+ .pytype/
130
+
131
+ # Cython debug symbols
132
+ cython_debug/
133
+
134
+ # PyCharm
135
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
136
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
137
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
138
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
139
+ .idea/
140
+
141
+ */todo*
142
+ *.db
143
+ *.egg-info
@@ -0,0 +1,18 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Run CLI" type="UvRunConfigurationType" factoryName="UvRunConfigurationType">
3
+ <option name="args">
4
+ <list />
5
+ </option>
6
+ <option name="checkSync" value="false" />
7
+ <option name="env">
8
+ <map />
9
+ </option>
10
+ <option name="runType" value="SCRIPT" />
11
+ <option name="scriptOrModule" value="./src/mcp_run_isolated_python/cli.py" />
12
+ <option name="uvArgs">
13
+ <list />
14
+ </option>
15
+ <option name="uvSdkKey" value="uv (mcp-run-isolated-python)" />
16
+ <method v="2" />
17
+ </configuration>
18
+ </component>
@@ -0,0 +1,18 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Run MCP server" type="UvRunConfigurationType" factoryName="UvRunConfigurationType">
3
+ <option name="args">
4
+ <list />
5
+ </option>
6
+ <option name="checkSync" value="false" />
7
+ <option name="env">
8
+ <map />
9
+ </option>
10
+ <option name="runType" value="SCRIPT" />
11
+ <option name="scriptOrModule" value="./src/mcp_run_isolated_python/mcp_server.py" />
12
+ <option name="uvArgs">
13
+ <list />
14
+ </option>
15
+ <option name="uvSdkKey" value="uv (mcp-run-isolated-python)" />
16
+ <method v="2" />
17
+ </configuration>
18
+ </component>
@@ -0,0 +1,21 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Run Tests" type="tests" factoryName="py.test">
3
+ <module name="mcp-run-isolated-python" />
4
+ <option name="ENV_FILES" value="" />
5
+ <option name="INTERPRETER_OPTIONS" value="" />
6
+ <option name="PARENT_ENVS" value="true" />
7
+ <option name="SDK_HOME" value="" />
8
+ <option name="SDK_NAME" value="uv (mcp-run-isolated-python)" />
9
+ <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
10
+ <option name="IS_MODULE_SDK" value="false" />
11
+ <option name="ADD_CONTENT_ROOTS" value="true" />
12
+ <option name="ADD_SOURCE_ROOTS" value="true" />
13
+ <option name="RUN_TOOL" value="true" />
14
+ <option name="_new_keywords" value="&quot;&quot;" />
15
+ <option name="_new_parameters" value="&quot;&quot;" />
16
+ <option name="_new_additionalArguments" value="&quot;&quot;" />
17
+ <option name="_new_target" value="&quot;.&quot;" />
18
+ <option name="_new_targetType" value="&quot;PATH&quot;" />
19
+ <method v="2" />
20
+ </configuration>
21
+ </component>
@@ -0,0 +1,25 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+
4
+ repos:
5
+ - repo: https://github.com/astral-sh/ruff-pre-commit
6
+ # Ruff version.
7
+ rev: v0.16.6
8
+ hooks:
9
+ # Run the linter.
10
+ - id: ruff-check
11
+ types_or: [ python, pyi, jupyter ]
12
+ args: [ --fix ]
13
+ priority: 10
14
+
15
+ # Run the formatter.
16
+ - id: ruff-format
17
+ types_or: [ python, pyi, jupyter ]
18
+ priority: 0
19
+
20
+ # Gitleaks
21
+ - repo: https://github.com/gitleaks/gitleaks
22
+ rev: v8.30.1
23
+ hooks:
24
+ - id: gitleaks
25
+ priority: 10
@@ -0,0 +1,2 @@
1
+ ## Contributions
2
+ Contributions are more than welcome if you find bugs / are interested in new features!
@@ -0,0 +1,81 @@
1
+ # Adapted from:
2
+ # - https://github.com/astral-sh/uv-docker-example/blob/main/standalone.Dockerfile
3
+
4
+ # Args to make configurable easily
5
+ ARG ENVIROMENT="trixie-slim"
6
+
7
+ # ----------------------------
8
+ # Builder stage
9
+ # ----------------------------
10
+ FROM ghcr.io/astral-sh/uv:${ENVIROMENT} AS builder
11
+
12
+ # Args to make configurable easily
13
+ ARG PYTHON_VERSION="3.13"
14
+ ARG PYTHON_DEPENDENCIES="pydantic"
15
+
16
+ # Setup uv environment variables
17
+ # Configure the Python directory so it is consistent
18
+ ENV UV_COMPILE_BYTECODE=1
19
+ ENV UV_LINK_MODE=copy
20
+ ENV UV_PYTHON_INSTALL_DIR=/python
21
+ ENV UV_PYTHON_PREFERENCE=only-managed
22
+
23
+ # Install Python before the project for caching
24
+ RUN uv python install ${PYTHON_VERSION}
25
+
26
+ # Install the custom uv environment that will be used by the code executor
27
+ WORKDIR /sandbox
28
+ RUN uv venv --python ${PYTHON_VERSION}
29
+ RUN uv pip install ${PYTHON_DEPENDENCIES}
30
+
31
+ # Copy project source
32
+ WORKDIR /code
33
+ COPY . .
34
+
35
+ # make sure the srt default config has the `enableWeakerNestedSandbox` set to true (needed for docker)
36
+ RUN sed -i 's/"enableWeakerNestedSandbox": *false/"enableWeakerNestedSandbox": true/' ./default_srt_settings.json
37
+
38
+ # Install project + deps into venv
39
+ RUN uv sync --frozen --no-editable --no-dev
40
+
41
+ # ----------------------------
42
+ # Final stage
43
+ # ----------------------------
44
+ # Then, use a final image with uv and with node
45
+ FROM node:${ENVIROMENT}
46
+ LABEL authors="daniel.j"
47
+
48
+ # install certs & required deps
49
+ RUN apt-get update \
50
+ && apt-get install -y --no-install-recommends ca-certificates \
51
+ && apt-get install -y ripgrep socat bubblewrap \
52
+ && rm -rf /var/lib/apt/lists/*
53
+
54
+ # install the srt sandbox
55
+ RUN npm install -g @anthropic-ai/sandbox-runtime@'<=0.0.64'
56
+
57
+ WORKDIR /code
58
+
59
+ # Setup a non-root user
60
+ RUN groupadd --system --gid 999 nonroot \
61
+ && useradd --system --gid 999 --uid 999 --create-home nonroot
62
+
63
+ # Copy the Python version
64
+ COPY --from=builder --chown=python:python /python /python
65
+
66
+ # uv, so users of the prebuilt image can add packages at runtime via -e PYTHON_DEPENDENCIES
67
+ COPY --from=builder /usr/local/bin/uv /usr/local/bin/uv
68
+
69
+ # Copy project (with venv)
70
+ COPY --from=builder --chown=nonroot:nonroot /code /code
71
+
72
+ # Copy Sandbox
73
+ COPY --from=builder --chown=nonroot:nonroot /sandbox /sandbox
74
+
75
+ # Place executables in the environment at the front of the path
76
+ ENV PATH="/code/.venv/bin:$PATH"
77
+
78
+ EXPOSE 6400
79
+
80
+ COPY --chmod=755 docker-entrypoint.sh /docker-entrypoint.sh
81
+ ENTRYPOINT ["/docker-entrypoint.sh"]