This package provides one SIO Workers job, namely
compile, given a source file, detects its language, compiles
it and saves the binary file. All I/O is made via the filetracker.
Each programming language is represented
by a language code. Built-in language codes are
The following parameters are recognized in
- Filetracker path of the program to compile.
- Filetracker path where the compiled file will be saved. Mandatory.
(optional) Name of compiler to use.
If not specified, the name
default-<ext>is used, where
<ext>is the extension of the
source_file, all lowercase.
- (optional) Resource limits for the compiler process, passed to relevant executor.
- (optional) Limits length of compiler output returned to user when compilation error occurs. By default set to 5KiB, set to None for unlimited. Passed to relevant executor.
- (optional) Limit for size of the compiled file.
This option allows additional files, such as header files, to be seen during compilation. This parameters can take one of the following forms:
string- Filetracker path to the file. It will be placed in the same directory as the source file.
list- Iterable of filetracker paths.
dict- if given a dictionary,
sio.compilerswill select a key equal to the language code of the source file. The value will can be either a string or an iterable.
- Allows additional source files to be compiled and linked with the
source_file. This option is analogous to
- An archive in Zip format to be extracted in the compilation directory. Individual files are not extracted in case they would overwrite existing ones (e.g.
additional_includes) or if they would end up outside of the compilation directory (when their path starts with
- This option allows additional files to be available, in the same directory, during compilation. It should be a
dictwith keys representing intended filenames and values – paths in the filetracker.
Parameters added to the environment:
- Stdout + stderr from the compiler (frequently an empty string).
The package provides two kinds of compilers: sandboxed and non-sandboxed.
Sandboxed compilers run their compilation process inside a curated compiler, with hand-picked libraries carefully selected by an experienced team of security experts. See sio.workers.sandbox for more.
Each sandboxed compiler requires a download of packages a few hundreds of megabytes large, it may be therefore preferable to just run a default compiler available on the system.
Built-in sandboxed compilers:
Built-in non-sandboxed compilers:
Testing sandboxed compilers is disabled by default. To enable it,
nosetests with environment variable
TEST_SANDBOXES set to
The package provides a convenience shell script
compile.sh script. It expects three arguments: input file
name, output file name and programming language source file extension
Defining new compilers¶
- Copy-and-paste code from
sio/compilers/template.py, adjust accordingly (check out existing compilers for inspiration).
- Add to