For Teachers & Admins
When a student submits an assignment that contains a grade.sh script, the following environment variables are available inside the grading environment.
Tested against Vocareum Notebook, VS Code, and JupyterLab. ✓ = present, ✗ = not present.
Variable reference
Grade and report outputs
Variable | Description | VNB | VS Code | JupyterLab |
| Path to the grade output file. Write one | ✓ | ✓ | ✓ |
| Path to the report output file. Write free-form text or HTML here; Vocareum displays it to the student as feedback. To suppress raw script stdout/stderr from appearing in the report, write | ✓ | ✓ | ✓ |
Working directory
Variable | Description | VNB | VS Code | JupyterLab |
| Path to the student's working directory ( | ✓ | ✓ | ✓ |
| Host-side mount path for the student's working area (e.g., | ✗ | ✓ | ✓ |
Assignment and course identifiers
Variable | Description | VNB | VS Code | JupyterLab |
| Vocareum course ID. | ✓ | ✓ | ✓ |
| Vocareum assignment ID. | ✓ | ✓ | ✓ |
| Vocareum part ID. | ✓ | ✓ | ✓ |
| The version of the part the learner selected, for assignments with multiple versions. | ✓ | ✓ | ✓ |
| Number of times this student has submitted this part. | ✓ | ✓ | ✓ |
User identifiers
Variable | Description | VNB | VS Code | JupyterLab |
| Vocareum user ID of the submitting student. | ✓ | ✓ | ✓ |
| Email address of the submitting student. | ✓ | ✓ | ✓ |
| Internal Vocareum email identifier. | ✓ | ✓ | ✓ |
Jupyter environment
These variables relate to the Jupyter runtime configuration and are not typically needed in grading scripts.
Variable | Description | VNB | VS Code | JupyterLab |
| The Jupyter IDE type (e.g., | ✓ | ✗ | ✓ |
| Jupyter's preferred directory ( | ✓ | ✗ | ✓ |
| Root directory for the Jupyter file browser ( | ✓ | ✗ | ✓ |
| Username for the Jupyter session ( | ✓ | ✗ | ✓ |
| Jupyter kernel application (e.g., | ✓ | ✗ | ✓ |
| Base URL for the Jupyter kernel. | ✓ | ✗ | ✓ |
| Port the Jupyter kernel listens on. | ✓ | ✗ | ✓ |
Other
Variable | Description | VNB | VS Code | JupyterLab |
| The student's current recorded grade for this part before this submission is processed. | ✓ | ✓ | ✓ |
| Filename for passing custom data between Vocareum components. | ✓ | ✓ | ✓ |
| Filename used for inter-process communication within the grading pipeline. | ✓ | ✓ | ✓ |
| Base64-encoded JSON blob containing course, part, and user identifiers. Not typically needed in grading scripts. | ✓ | ✓ | ✓ |
GenAI variables
When GenAI is enabled for your course, additional environment variables are injected for AI model access. See the Environment Variables section of GenAI in Vocareum Labs for the full list and setup instructions.
Accessing variables in scripts
In bash (grade.sh):
echo "Working dir: $VOC_HOME_DIR" echo "Submission count: $VOC_SUBMISSION_COUNT"
In Python (grade.py):
import os work_dir = os.environ.get("VOC_HOME_DIR", "/voc/work") submission_num = os.environ.get("VOC_SUBMISSION_COUNT", "1")