API Reference
judge0_client
Judge0 client package.
Provides Judge0Client for interacting with the Judge0 API
and Pydantic models for requests and responses.
Judge0Client
Asynchronous client for the Judge0 API.
Source code in src/judge0_client/client.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
open
open()
Initialize the underlying httpx client.
Source code in src/judge0_client/client.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
create_submission
async
create_submission(request)
Create a submission.
Source code in src/judge0_client/client.py
74 75 76 77 78 79 80 81 82 83 84 85 86 | |
get_submission
async
get_submission(token)
Get submission result by token.
Source code in src/judge0_client/client.py
88 89 90 91 92 93 94 95 96 97 98 99 | |
get_workers
async
get_workers()
Health-check endpoint: returns workers/queues state.
Source code in src/judge0_client/client.py
101 102 103 104 105 | |
get_about
async
get_about()
Returns general information.
Source code in src/judge0_client/client.py
107 108 109 110 111 | |
get_isolate
async
get_isolate()
Returns result of isolate --version.
Source code in src/judge0_client/client.py
113 114 115 116 117 | |
get_license
async
get_license()
Returns a license.
Source code in src/judge0_client/client.py
119 120 121 122 123 | |
Judge0Error
Bases: Exception
Generic Judge0 client exception.
Source code in src/judge0_client/utils/exceptions.py
5 6 | |
BaseSubmission
pydantic-model
Bases: BaseModel, ABC
Request model for creating a submission in Judge0.
Fields:
-
compiler_options(str | None) -
command_line_arguments(str | None) -
stdin(str | None) -
expected_output(str | None) -
cpu_time_limit(float | None) -
cpu_extra_time(float | None) -
wall_time_limit(float | None) -
memory_limit(float | None) -
stack_limit(int | None) -
max_processes_and_or_threads(int | None) -
enable_per_process_and_thread_time_limit(bool | None) -
enable_per_process_and_thread_memory_limit(bool | None) -
max_file_size(int | None) -
redirect_stderr_to_stdout(bool | None) -
enable_network(bool | None) -
number_of_runs(int | None) -
callback_url(str | None)
Source code in src/judge0_client/models/base_submission.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
compiler_options
pydantic-field
compiler_options = None
Options for the compiler (i.e. compiler flags)
command_line_arguments
pydantic-field
command_line_arguments = None
Command line arguments for the program
stdin
pydantic-field
stdin = None
Input for program
expected_output
pydantic-field
expected_output = None
Expected output of program. Used when you want to compare with stdout
cpu_time_limit
pydantic-field
cpu_time_limit = None
Default runtime limit for every program (seconds)
cpu_extra_time
pydantic-field
cpu_extra_time = None
When a time limit is exceeded, wait for extra time, before killing the program (seconds)
wall_time_limit
pydantic-field
wall_time_limit = None
Limit wall-clock time in seconds (seconds)
memory_limit
pydantic-field
memory_limit = None
Limit address space of the program (kilobytes)
stack_limit
pydantic-field
stack_limit = None
Limit process stack (kilobytes)
max_processes_and_or_threads
pydantic-field
max_processes_and_or_threads = None
Maximum number of processes and/or threads program can create
enable_per_process_and_thread_time_limit
pydantic-field
enable_per_process_and_thread_time_limit = None
If true then cpu_time_limit will be used as per process and thread
enable_per_process_and_thread_memory_limit
pydantic-field
enable_per_process_and_thread_memory_limit = None
If true then memory_limit will be used as per process and thread
max_file_size
pydantic-field
max_file_size = None
Limit file size created or modified by the program (kilobytes)
redirect_stderr_to_stdout
pydantic-field
redirect_stderr_to_stdout = None
If true standard error will be redirected to standard output
enable_network
pydantic-field
enable_network = None
If true program will have network access
number_of_runs
pydantic-field
number_of_runs = None
Run each program number_of_runs times and take average of time and memory
callback_url
pydantic-field
callback_url = None
URL on which Judge0 will issue PUT request with the submission in a request body after submission has been done
SingleFileSubmission
pydantic-model
Bases: BaseSubmission, BaseModel
Request model for creating a single-file submission in Judge0.
Fields:
-
compiler_options(str | None) -
command_line_arguments(str | None) -
stdin(str | None) -
expected_output(str | None) -
cpu_time_limit(float | None) -
cpu_extra_time(float | None) -
wall_time_limit(float | None) -
memory_limit(float | None) -
stack_limit(int | None) -
max_processes_and_or_threads(int | None) -
enable_per_process_and_thread_time_limit(bool | None) -
enable_per_process_and_thread_memory_limit(bool | None) -
max_file_size(int | None) -
redirect_stderr_to_stdout(bool | None) -
enable_network(bool | None) -
number_of_runs(int | None) -
callback_url(str | None) -
source_code(str) -
language_id(int) -
additional_files(Mapping[str, str | bytes] | None)
Source code in src/judge0_client/models/single_file_submission.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
compiler_options
pydantic-field
compiler_options = None
Options for the compiler (i.e. compiler flags)
command_line_arguments
pydantic-field
command_line_arguments = None
Command line arguments for the program
stdin
pydantic-field
stdin = None
Input for program
expected_output
pydantic-field
expected_output = None
Expected output of program. Used when you want to compare with stdout
cpu_time_limit
pydantic-field
cpu_time_limit = None
Default runtime limit for every program (seconds)
cpu_extra_time
pydantic-field
cpu_extra_time = None
When a time limit is exceeded, wait for extra time, before killing the program (seconds)
wall_time_limit
pydantic-field
wall_time_limit = None
Limit wall-clock time in seconds (seconds)
memory_limit
pydantic-field
memory_limit = None
Limit address space of the program (kilobytes)
stack_limit
pydantic-field
stack_limit = None
Limit process stack (kilobytes)
max_processes_and_or_threads
pydantic-field
max_processes_and_or_threads = None
Maximum number of processes and/or threads program can create
enable_per_process_and_thread_time_limit
pydantic-field
enable_per_process_and_thread_time_limit = None
If true then cpu_time_limit will be used as per process and thread
enable_per_process_and_thread_memory_limit
pydantic-field
enable_per_process_and_thread_memory_limit = None
If true then memory_limit will be used as per process and thread
max_file_size
pydantic-field
max_file_size = None
Limit file size created or modified by the program (kilobytes)
redirect_stderr_to_stdout
pydantic-field
redirect_stderr_to_stdout = None
If true standard error will be redirected to standard output
enable_network
pydantic-field
enable_network = None
If true program will have network access
number_of_runs
pydantic-field
number_of_runs = None
Run each program number_of_runs times and take average of time and memory
callback_url
pydantic-field
callback_url = None
URL on which Judge0 will issue PUT request with the submission in a request body after submission has been done
source_code
pydantic-field
source_code
Program’s source code
language_id
pydantic-field
language_id
Programming language ID
additional_files
pydantic-field
additional_files = None
Additional files that should be available alongside the source code (encoded zip)
MultiFileSubmission
pydantic-model
Bases: BaseSubmission, BaseModel
Request model for creating a multi-file submission in Judge0.
Fields:
-
compiler_options(str | None) -
command_line_arguments(str | None) -
stdin(str | None) -
expected_output(str | None) -
cpu_time_limit(float | None) -
cpu_extra_time(float | None) -
wall_time_limit(float | None) -
memory_limit(float | None) -
stack_limit(int | None) -
max_processes_and_or_threads(int | None) -
enable_per_process_and_thread_time_limit(bool | None) -
enable_per_process_and_thread_memory_limit(bool | None) -
max_file_size(int | None) -
redirect_stderr_to_stdout(bool | None) -
enable_network(bool | None) -
number_of_runs(int | None) -
callback_url(str | None) -
language_id(Literal[89]) -
additional_files(Mapping[str, str | bytes])
Source code in src/judge0_client/models/multi_file_submission.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
compiler_options
pydantic-field
compiler_options = None
Options for the compiler (i.e. compiler flags)
command_line_arguments
pydantic-field
command_line_arguments = None
Command line arguments for the program
stdin
pydantic-field
stdin = None
Input for program
expected_output
pydantic-field
expected_output = None
Expected output of program. Used when you want to compare with stdout
cpu_time_limit
pydantic-field
cpu_time_limit = None
Default runtime limit for every program (seconds)
cpu_extra_time
pydantic-field
cpu_extra_time = None
When a time limit is exceeded, wait for extra time, before killing the program (seconds)
wall_time_limit
pydantic-field
wall_time_limit = None
Limit wall-clock time in seconds (seconds)
memory_limit
pydantic-field
memory_limit = None
Limit address space of the program (kilobytes)
stack_limit
pydantic-field
stack_limit = None
Limit process stack (kilobytes)
max_processes_and_or_threads
pydantic-field
max_processes_and_or_threads = None
Maximum number of processes and/or threads program can create
enable_per_process_and_thread_time_limit
pydantic-field
enable_per_process_and_thread_time_limit = None
If true then cpu_time_limit will be used as per process and thread
enable_per_process_and_thread_memory_limit
pydantic-field
enable_per_process_and_thread_memory_limit = None
If true then memory_limit will be used as per process and thread
max_file_size
pydantic-field
max_file_size = None
Limit file size created or modified by the program (kilobytes)
redirect_stderr_to_stdout
pydantic-field
redirect_stderr_to_stdout = None
If true standard error will be redirected to standard output
enable_network
pydantic-field
enable_network = None
If true program will have network access
number_of_runs
pydantic-field
number_of_runs = None
Run each program number_of_runs times and take average of time and memory
callback_url
pydantic-field
callback_url = None
URL on which Judge0 will issue PUT request with the submission in a request body after submission has been done
language_id
pydantic-field
language_id = 89
Programming language ID
additional_files
pydantic-field
additional_files
Scripts to run and compile and additional files
SubmissionResponse
pydantic-model
Bases: BaseResponseModel
Response for non-waiting submission — contains only a token.
Fields:
-
token(str)
Source code in src/judge0_client/models/submission_response.py
4 5 6 7 | |
SubmissionDetail
pydantic-model
Bases: BaseResponseModel
Detailed information about submission execution.
Fields:
-
token(str) -
status(SubmissionStatus) -
stdout(str | None) -
stderr(str | None) -
compile_output(str | None) -
message(str | None) -
time(float | None) -
memory(int | None) -
exit_code(int | None) -
language_id(int | None)
Source code in src/judge0_client/models/submission_detail.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
WorkersResponse
pydantic-model
Bases: BaseResponseModel
Fields:
Source code in src/judge0_client/models/workers_response.py
5 6 7 8 9 10 11 12 | |
queue
pydantic-field
queue
Queue name
size
pydantic-field
size
Queue size, number of submissions that are currently waiting to be processed
available
pydantic-field
available
Available number of workers
idle
pydantic-field
idle
How many workers are idle
working
pydantic-field
working
How many workers are currently working
paused
pydantic-field
paused
How many workers are paused
failed
pydantic-field
failed
How many jobs failed