- Project and all its dependencies are managed via
uv - Use
uvto add dependencies, remove dependencies, run tests, run standalone scripts, etc. - Use
uv run pythonto run Python within the local environment with all dependencies - Use
uv run pytestto run tests - Use
uv run python scripts/<script>.pyto run scripts - Do not edit
pyproject.tomldirectly, useuv! If you need to, ask for permission!
src/judge0/contains the installable Judge0 SDK package. Keep runtime code, public APIs, models, clients, retry behavior, and package utilities here. Its modules are:__init__.pydefines the public package API, resolves implicit clients from environment configuration, enables optional logging, and exposes flavor and language aliases._logging.pyconfigures package-level console and rotating-file logging, including environment-controlled log levels.api.pyprovides high-level client resolution and submission orchestration: creating, retrieving, polling, and executing submissions. Itsasync_*helpers return after submission creation without waiting for results; they are notasynciocoroutines.base_types.pydefines shared models, protocols, type aliases, and enums for test cases, languages, client flavors, submission statuses, and server configuration.clients.pyimplements the base HTTP client and the provider- and flavor-specific clients for Judge0 Cloud, RapidAPI, and AllThingsDev.common.pycontains shared base64 encoding and decoding helpers and iterable batching.data.pymaps language aliases to Judge0 language IDs by server version and flavor.errors.pydefines SDK-specific exception types for client resolution and preview-client usage limits.filesystem.pymodels individual files and ZIP-backed collections used for additional and post-execution files.retry.pydefines the polling strategy interface and retry-count, wait-time, and periodic retry implementations.submission.pymodels submission request and response data, including serialization, response updates, completion checks, and execution filesystem handling.utils.pydetects HTTP rate-limit responses and translates preview-client rate limits into SDK-specific errors.version.pyexposes the package version constant.
tests/contains the pytest suite. Shared fixtures belong inconftest.py, and focused tests should usetest_<area>.pymodules that correspond to SDK behavior.examples/contains runnable SDK usage examples, including the standalone HTTP callback example inexamples/1000_http_callback_aka_webhook/.docs/source/contains the Sphinx documentation sources. API reference pages live indocs/source/api/, contributor documentation indocs/source/contributors_guide/, and conceptual guides indocs/source/in_depth/. Sphinx configuration and templates also live underdocs/source/;docs/assets/contains documentation assets..github/contains CI workflows and GitHub issue templates.pyproject.tomldefines package metadata, dependencies, dependency groups, and tool configuration;uv.lockpins the resolved environment. Manage both throughuvas described above.- Root-level Markdown files contain the project overview, contribution and conduct policies, release-note template, changelog, and agent instructions.
- Generated directories and files such as
.venv/,dist/,htmlcov/,docs/build/, coverage data, and tool caches are not source and should not be edited manually.
- Start every implementation task from
masterunless the user explicitly instructs otherwise:- Run
git status --short --branchbefore making changes. - Switch to
master. - Create a new task branch from
master. - If local changes block switching or branching, stop and ask how to proceed; do not stash, revert, or overwrite user changes without explicit approval.
- Run
- Branch names and commit titles must follow the task category:
- New feature:
feature/<short-slug>branch andfeat: <title>commit. - Bug fix:
bugfix/<short-slug>branch andfix: <title>commit. - Code cleanup without behavior changes:
refactor/<short-slug>branch andrefactor: <title>commit. - Maintenance:
chore/<short-slug>branch andchore: <title>commit. - Documentation:
docs/<short-slug>branch anddocs: <title>commit.
- New feature:
- Follow Test Driven Development for code changes:
- Write or update focused tests before changing implementation code.
- Run the relevant
uv run pytest ...command and confirm the tests fail for the expected reason. - Write the minimal working implementation.
- Re-run the focused tests, then run the broader relevant test suite.
- Refactor only after tests pass, and re-run tests after refactoring.
- Split final work into multiple reviewable commits when the task has multiple subtasks. Each commit should contain the tests and implementation for one coherent subtask, and each commit title must use the category prefix above.
- After changes are done or applied, prepare a proposed commit message that follows the required category prefix format.
- Use Python 3.10+ type annotations (e.g. instead of
Union[str, int]writestr | int) - Ignore
# TODOs in the code comments - Always update
CHANGELOG.mdwith a clear and concise description of changes - Follow numpydoc style for documentation
- Every function and method parameter should be type annotated
- Every function and method should have a return type annotated
- Function and method docstring should include raised exceptions/errors
- Document recommended default values in
.env.example. - Do not import
from __future__ import annotations