miki725 / applied_crypto_2022_spring_ta

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Applied Cryptography TA Scripts

TA repo for https://github.com/viega/applied_crypto_2022_spring/

Structure

➜ tree
.
├── <problem set>
│   ├── source                      # autograder stuff goes here
│   │   ├── artifacts.py            # creates artifacts for grading
│   │   ├── input.py                # either extracts input from artifacts or generates it from scratch
│   │   ├── solution.py             # reference solution
│   │   └── tests.py                # pytest unittests which power autograder
│   └── submission
│       └── ps                      # copied from ../source/ but can be created from clipboard for local testing
├── Pipfile                         | configuration files for autograder
├── ...                             | but also used to bootstrap local setup
├── conftest.py                     | for testing
└── setup.sh

Requirements

System deps

  • brew install colordiff

Python version

Gradescope runs on py3.6 so its easier to reproduce similar env locally. You can use pyenv:

pyenv install 3.6.15

Pipenv

Pipenv manages local python deps:

python3 -m pip install pipenv
pipenv install

Shell

In order to use all deps locally you must activate pipenv envs via:

pipenv shell

Python Shell

Solutions should be importable from the shell:

ptpython
>>> from ps2.source.solution import xor
>>> xor(b'hello', b'world')
b'\x1f\n\x1e\x00\x0b'

Makefile Utilities

Testing Reference Solution

# runs diff between example output and output
# generated by solution given example input
make <problemset>/diff

# runs grading script
make <problemset>/grade

Testing With Clipboard

Same as above but requires PASTE=true env var:

make PASTE=true <problemset>/diff
make PASTE=true <problemset>/grade

Testing With pdbpp

pdbpp is very useful to debug pytest failures locally when working on the grading script. Simply add pdb make target to enable it:

make pdb <problemset>/grade

On any failure pytest will drop into pdbpp sheell.

Prepare grading.zip

make <problemset>/source/grading.zip

About


Languages

Language:Python 95.5%Language:Shell 2.9%Language:Makefile 1.6%