Python
File Structure
Teachstack coding exercises are stored according to file structure outlined in the following ASCII tree. While engaging with a lesson, students only have access to the "exercise/" directory and its contents.
The root of the file structure is a folder with the course name. A course contains modules. Modules contain exercises. Each exercise folder contains three subfolders that contain instructional content, exercise files and test case files respectively. At the root of the directory is a teachstack.json
object that codifies the data structure for the coding course and allows it to be ingested by the Teachstack platform. There is also a requirements.txt
that will allow the Teachstack environment to accommodate the use of any imports that are not from the standard library.
my_python_demo_course/ # course (root) ├── teachstack.json ├── requirements.txt └── modules/ # contains one-or-more modules └── demo_module/ # first module ├── hello_world/ # exercise package │ ├── init.py │ ├── exercise/ │ │ ├── init.py │ │ └── main.py │ ├── tests/ │ │ ├── init.py │ │ └── test_hello_world.py │ └── instructions/ │ └── instruction.md └── comments/ # exercise package ├── init.py ├── exercise/ │ ├── init.py │ └── main.py ├── tests/ │ ├── init.py │ └── test_comment.py └── instructions/ └── instruction.md
3. Exercise Content
Three files must be authored to complete a valid interactive coding exercise that can populate the Teachstack platform. These include the instructions file (instruction.md
), test case file (<test_name>.py
) and the required exercise files (e.g. main.py
). The exercise package directory, exercise subfolder and tests subfolder must all contain a blank __init__.py
file to ensure correct test case behaviour. The teachstack.json
allows the Teachstack platform to correctly access and render the course material for the student.
3.1 Student Instructions (instruction.md
)
Student Instructions introduce each exercise. They provide an overview of key technical concepts and language features that learners will then explore through practical coding challenges. Review the teachstack_exercise_examples.md
to see good examples of introductory content.
3.2 Student Instructions (<test_name>.py
)
This contains an exercise skeleton file
4. Teachstack Json Object (teachstack.json
)
teachstack.json
is the single source of truth that describes the entire course hierarchy and data structure for the Teachstack platform. It lists the languages, then each module, and, inside every module, the individual exercises students will see. Teachstack reads this file top-to-bottom and serves the exercises to learners in exactly the same order, so place exercises chronologically to match your lesson plan. The teachstack.json
must be congruent with the json schema file teachstack.schema.json
.
5. Example Python Course
A complete example of a Teachstack course, containing a full Python for Beginners