This repository includes custom tools for submitting TypeScript solutions to Kattis. The TypeScript support consists of:
The submit.py
script is the core utility for submitting solutions to Kattis. It handles:
- Detecting the programming language based on file extension
- Guessing the problem ID from the filename
- Authenticating with Kattis using your
.kattisrc
configuration - Submitting solution files
- Displaying submission results
This script supports multiple programming languages, including TypeScript (.ts
files).
The kattis_submit_ts.sh
is a bash script that streamlines the submission of TypeScript solutions:
- Takes a TypeScript (
.ts
) file as an argument - Activates a Python virtual environment
- Extracts the problem ID from the filename
- Submits the TypeScript file directly to Kattis through
submit.py
Usage:
./kattis_submit_ts.sh problems/hello.ts
Before you can submit solutions, you need to set up authentication with Kattis:
- Download your personal
.kattisrc
configuration file from https://open.kattis.com/download/kattisrc - Place this file in your home directory (
~/.kattisrc
) or in the same directory assubmit.py
The .kattisrc
file contains:
- Your Kattis username
- A secret token for authentication
- URLs for the Kattis API
This file is essential for the submission scripts to authenticate with Kattis. Without it, you won't be able to submit solutions.
This repository includes VS Code task configuration to make submitting TypeScript solutions even easier.
The .vscode/tasks.json
file configures a "Submit to Kattis" task that:
- Is accessible through VS Code's Command Palette (
Tasks: Run Task
) - Takes the currently active file as input
- Runs the
kattis_submit_ts.sh
script with the current file as an argument - Shows the submission process and results in a dedicated terminal panel
To use this task:
- Open your TypeScript solution file in VS Code
- Press
Cmd+Shift+P
(macOS) orCtrl+Shift+P
(Windows/Linux) - Type "Tasks: Run Task" and select it
- Choose "Submit to Kattis"
This will submit your currently open TypeScript file to Kattis and show the results.
To set up your environment for TypeScript development:
- Ensure you have Node.js installed
- Install TypeScript-related dependencies:
npm install
- Create a Python virtual environment (for the submission scripts):
python -m venv venv source venv/bin/activate pip install requests requests pip install requests lxml
Now you can write TypeScript solutions in the problems/
directory and submit them using the VS Code task or the command-line script.