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 | Vocareum Notebook | VS Code | Jupyter Lab |
| 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 | Vocareum Notebook | VS Code | Jupyter Lab |
| 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 | Vocareum Notebook | VS Code | Jupyter Lab |
| 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 | Vocareum Notebook | VS Code | Jupyter Lab |
| 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 | Vocareum Notebook | VS Code | Jupyter Lab |
| 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 | Vocareum Notebook | VS Code | Jupyter Lab |
| 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
Example of accessing and printing environment variables from the grade.sh file (bash):
echo "Working dir: $VOC_HOME_DIR"
echo "Submission count: $VOC_SUBMISSION_COUNT"
Note that if you would prefer to create the grading script in a different programming language, you can do so in a separate file. Just be sure to call your separate script from the grade.sh file.
Example of accessing and printing environment variables in a grade.py file (Python):
import os
work_dir = os.environ.get("VOC_HOME_DIR", "/voc/work")
submission_num = os.environ.get("VOC_SUBMISSION_COUNT", "1")
print(work_dir)
print(submission_num)
