Expand description
The main tmc-langs library. Provides a convenient API to all of the functionality provided by the tmc-langs project.
Re-exports§
pub use tmc_mooc_client as mooc;pub use tmc_testmycode_client as tmc;
Modules§
- file_
util - Various utility functions, primarily wrapping the standard library’s IO and filesystem functions
- notification_
reporter - Contains an utility for reporting warnings.
- progress_
reporter - Utility struct for printing progress reports.
Structs§
- Combined
Course Data - Credentials
- Credentials for authenticating with tmc-server.
- Download
OrUpdate Mooc Course Exercises Result - Download
OrUpdate TmcCourse Exercises Result - Exercise
Desc - A description of an exercise.
- Exercise
Packaging Configuration - Represents configuration based on which submission may be packaged.
- Local
Mooc Exercise - MOOC exercise inside the projects directory.
- Local
TmcExercise - TMC eercise inside the projects directory.
- Mooc
Exercise Download - Prepare
Submission - Projects
Config - Projects
DirTmc Exercise - A TMC exercise in the projects directory.
- Python
Ver - Python version from TmcProjectYml.
- Refresh
Data - Data from a finished course refresh.
- Refresh
Exercise - An exercise from a finished course refresh.
- RunResult
- The result of running an exercise’s test suite against a submission.
- Style
Validation Error - A style validation error.
- Style
Validation Result - The result of a style check.
- Test
Desc - A description of an exercise’s test case.
- Test
Result - The result of a single test case.
- TmcConfig
- The main configuration file. A separate one is used for each client.
- TmcCourse
Config - A course configuration file. Contains information of all of the exercises of this course in the projects directory.
- TmcExercise
Download - TmcParams
- TmcParams is used to safely construct data for a .tmcparams file, which contains lines in the form of export A=B export C=(D, E, F) the keys and values of the inner hashmap are validated to make sure they are valid as bash variables
- TmcProject
Yml - Extra data from a
.tmcproject.ymlfile. - Updated
Exercise
Enums§
- Command
Error - An error caused by a failed attempt to execute an external command.
- Compression
- Supported compression methods.
- Config
Value - A setting in a TmcConfig file.
- Download
Result - Langs
Error - Main error type of the library.
- Language
- Local
Exercise - Param
Error - Error validating TMC params values.
- RunStatus
- The overall status of a test run.
- Style
Validation Strategy - Determines how style errors are handled.
Traits§
- Language
Plugin - The trait that each language plug-in must implement.
Functions§
- check_
exercise_ updates - Checks the server for any updates for exercises within the given projects directory. Returns the ids of each exercise that can be updated.
- checkstyle
- Checks the exercise’s code quality.
- clean
- Cleans the exercise.
- compress_
project_ to - Compresses the exercise to the target path.
- compress_
project_ to_ with_ hash - Compresses the exercise to the target path. Returns the BLAKE3 hash of the resulting file.
- download_
old_ submission - Downloads the user’s old submission from the server. Resets the exercise at the path before the download. If a submission_url is given, the current state of the exercise is submitted to that URL before the download.
- download_
or_ update_ course_ exercises - Downloads the given exercises, by either downloading the exercise template, updating the exercise or downloading an old submission. Requires authentication. If the exercise doesn’t exist on disk yet… if there are previous submissions and download_template is not set, the latest submission is downloaded. otherwise, the exercise template is downloaded. If the exercise exists on disk, it is updated using the course template.
- extract_
project - Extracts the compressed project to the target location.
- extract_
student_ files - Extracts student files from the compressed exercise.
- find_
exercise_ directories - Finds valid exercises from the given path.
- get_
available_ points - Parses the available points from the exercise.
- get_
course_ data - Fetches the given course’s details, exercises and course data.
- get_
exercise_ packaging_ configuration - Gets the exercise packaging configuration.
- get_
projects_ dir - Returns the projects directory for the given client name.
The return value for
my-clientmight look something like/home/username/.local/share/tmc/my-clienton Linux. - get_
setting - Fetches a setting from the config.
- get_
settings - Fetches all the settings from the config.
- init_
mooc_ client_ with_ credentials - Initializes a MoocClient, using and returning the stored credentials, if any.
- init_
testmycode_ client_ with_ credentials - Initializes a TestMyCodeClient, using and returning the stored credentials, if any.
- list_
local_ tmc_ course_ exercises - Returns all of the exercises for the given course.
- login_
with_ password - Authenticates with the server, returning a login Token. Reads the password from stdin.
- login_
with_ token - Creates a login Token from a token string.
- migrate_
exercise - Migrates an exercise from a location that’s not managed by tmc-langs to the projects directory.
- move_
projects_ dir - Moves the projects directory from its current location to the target, taking all of the contained exercises with it.
- paste_
exercise - Sends the paste to the server
- prepare_
solution - Note: used by tmc-server. Walks through each given path, processing files and copying them into the destination.
- prepare_
stub - Prepares the exercise stub, copying tmc-junit-runner for Ant exercises.
- prepare_
submission - Prepares a submission for further processing. Returns the sandbox image to be used for the submission.
- refresh_
course - Used by tmc-server. Refreshes the course.
- reset
- Resets the given exercise
- reset_
settings - Resets all settings in the config, removing those without a default value.
- run_
tests - Runs tests for the exercise.
- scan_
exercise - Scans the exercise.
- set_
setting - Saves a setting in the config.
- sign_
with_ jwt - Signs the given serializable value with the given secret using JWT.
- submit_
exercise - Submits the exercise to the server
- unset_
setting - Unsets the given setting.
- update_
mooc_ exercises - Updates the mooc exercises in the local projects directory.
- update_
tmc_ exercises - Updates the tmc exercises in the local projects directory.