You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,14 @@ Updating NsJail mainly involves two steps:
62
62
63
63
Other things to look out for are breaking changes to NsJail's config format, its command-line interface, or its logging format. Additionally, dependencies may have to be adjusted in the Dockerfile to get a new version to build or run.
64
64
65
+
## Adding and Updating Python Interpreters
66
+
67
+
Python interpreters are built using pyenv via the `scripts/build_python.sh` helper script. This script accepts a pyenv version specifier (`pyenv install --list`) and builds the interpreter in a version-specific directory under `/lang/python`. In the image, each minor version of a Python interpreter should have its own build stage and the resulting `/lang/python` directory can be copied from that stage into the `base` stage.
68
+
69
+
When updating a patch version (e.g. 3.11.3 to 3.11.4), edit the existing build stage in the image for the minor version (3.11); do not add a new build stage. To have access to a new version, pyenv likely needs to be updated. To do so, change the tag in the `git clone` command in the image, but only for the build stage that needs access to the new version. Updating pyenv for all build stages will just cause unnecessary build cache invalidations.
70
+
71
+
To change the default interpreter used by NsJail, update the target of the `/lang/python/default` symlink created in the `base` stage.
Copy file name to clipboardExpand all lines: README.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,7 @@
7
7
8
8
Python sandbox runners for executing code in isolation aka snekbox.
9
9
10
-
Supports a memory [virtual read/write file system](#virtual-file-system) within the sandbox,
11
-
allowing text or binary files to be sent and returned.
10
+
Supports a memory [virtual read/write file system](#virtual-file-system) within the sandbox, allowing text or binary files to be sent and returned.
12
11
13
12
A client sends Python code to a snekbox, the snekbox executes the code, and finally the results of the execution are returned to the client.
14
13
@@ -100,22 +99,19 @@ Name | Description
100
99
101
100
## Third-party Packages
102
101
103
-
By default, the Python interpreter has no access to any packages besides the
104
-
standard library. Even snekbox's own dependencies like Falcon and Gunicorn are
105
-
not exposed.
102
+
By default, the Python interpreter has no access to any packages besides the standard library. Even snekbox's own dependencies like Falcon and Gunicorn are not exposed.
106
103
107
104
To expose third-party Python packages during evaluation, install them to a custom user site:
In the above command, `snekbox` is the name of the running container. The name may be different and can be checked with `docker ps`.
114
112
115
113
The packages will be installed to the user site within `/snekbox/user_base`. To persist the installed packages, a volume for the directory can be created with Docker. For an example, see [`docker-compose.yml`].
116
114
117
-
If `pip`, `setuptools`, or `wheel` are dependencies or need to be exposed, then use the `--ignore-installed` option with pip. However, note that this will also re-install packages present in the custom user site, effectively making caching it futile. Current limitations of pip don't allow it to ignore packages extant outside the installation destination.
0 commit comments