Advanced Labs have a number of ways they can be configured from the files in the workspace to the language setup or the UI of the IDE and the formatting of the code.
Usercode Directory
/usercode is the project directory in advanced labs. It contains all files and folders in the workspace that are viewable from the “Files” panel. You can include any files necessary for compiling and running a project.
Anything added by instructors or learners will appear there, unless it is marked as hidden. In the example below, you can also see a file marked as read-only, which can be done when creating/editing your template.
Any edits an instructor makes to the template's usercode will populate in the student's workspace when they first load it. Any changes made to the template after the student has loaded a workspace will require the learner to reset the lab via the settings in the bottom left.
Usercode is also the current, working directory on the virtual machine. ls /usercode will display the files in /usercode as they exist on the machine.
Alternatively, you can navigate to /usercode from the desktop by clicking run. Then, if the language supports it, click the Desktop tab along the bottom left to open the desktop view.
Click “File Manager”, then you can navigate to /usercode to see everything in that directory as it appears on the virtual desktop.
Edits to the files in /usercode do not require a running virtual machine.
Userdata Directory
The /userdata directory is where you can find environment specific files like the settings for VSC or the database for mySQL.
While most files will work from /usercode, you can also place large files in /userdata/zylabfiles. In this Java 17 VSC example you can see how we place large JAR files in /userdata.
Click Open Desktop to view /userdata:
The view here is small, and there are several options to enlarge the desktop view, like the fullscreen button in the top right.
After opening the file manager, you can see several folders:
The JAR is located in the /userdata/zyscripts folder.
To learn more about persisting package installs with /userdata, see this article.
Any edits an instructor makes to the template's /userdata, like adding extensions in VSC or creating a database in MySQL, will populate in the student's workspace when they first load it. Any changes made after that will require the learner to reset the lab.
/userdata is not automatically copied into the autograding environment. If you have a test case that relies on /userdata, you must select the option to “include workspace data” in the Files options.
One exception, are the MySQL environments where this check is toggled on by default and set to "student's workspace".
You may want to create tests to run against your default database, as well as the student's. In those cases, make sure to click the appropriate toggle for each test that needs the template, and each that needs the student's database.
.zylab config file for the IDE’s behavior
Every Coding Rooms IDE interface can be configured using the settings UI or the .zylab file. To edit the settings via the UI, click the settings button and Open Workspace Settings
Here you can edit workspace settings like the language, the behavior of the run button, the indent size, the windows that are opened below the code editor, and much more.
To edit via the .zylab file, create a file named .zylab. The .zylab will not display in the file menu by default, but a new "Edit .zylab file" button will appear at the bottom of the workspace settings.
Click the button to display the .zylab along with current settings in YAML syntax. You may need to change settings before the .zylab populates.
Edits made to the .zylab file will apply to matching options visible in the workspace settings and vice versa.
Here are the basic settings for python:
Any edits made to the .zylab file in a template will be copied when a learner opens that workspace. Edits made after they've opened the workspace would require a reset of the lab.
Each .zylab file is unique to the workspace where it's edited. Download a .zylab file via the file menu and upload it into other workspaces to copy the settings between workspaces. You can also copy and paste the settings, or clone a lab to copy the .zylab settings.
VSC, and other professional IDEs, can be configured directly in the menus of those IDEs. You can learn more about customizing VSC here.
.envrc config file for the virtual environment
Every advanced lab includes an .envrc file that contains the setup environment for the IDE. You can see the contents of this file by opening the workspace settings and "edit .envrc" in the settings menu.
For example, in MySQL, the .envrc includes both MySQL and Python setups:
The "Python310" flake reflects Python version 3.10.
The "mysqlcli8" flake reflects the MySQL client 8.
The services "mysql" and "mysqlworkbench" ensure that both mysql database and workbench start when the machine starts.
Environments can be combined by including the appropriate flake and use commands. Check the supported language’s .envrc file to see the necessary environment settings. Some combinations may not work.
More environment configurations will be available in the future.