Introduction
The course would focus on building command-line applications using Python. I haven’t seen beginner-friendly courses on building command-line applications.
This course would offer a great way to understand how command-line applications work.
Mini-projects would be built throughout the course. A final exercise would be open-ended, where the learners would share their projects on social media tagging mon.school - the winners would be given a prize! (IndiaFOSS 3.0 tickets, etc.)
Course Syllabus
At the end of the course, the learner would have understood:
- What is a terminal, and how it works (in a simplified way)
- What is a CLI
- What are the components of a CLI
- How does interaction work in a CLI
- How does
argparse
work - How to build CLIs using
argparse
- What is
click
- How to use
click
to build CLI apps - Unit testing CLI apps
- Making use of Github Actions to test CLI apps
Course Structure
Every chapter would have:
- 3-4 subchapters/sections
- A lot of illustrations to enrich the learning experience!
- Exercises at the end of each chapter
- Simple quizzes in the middle of each chapter
Outline
Legend:
-
= would be in the course
-
= considering to add it in the course
-
= might not be beginner-friendly, on hold
Chapter 1:
- (
) What is a terminal?
- (
) What is a CLI?
- (
) Components of a CLI (commands, subcommands, flags, args, etc.)
- (
) Examples of CLIs (breaking down the most common CLIs (git, etc.) and understanding their structure - commands, subcommands, flags, etc.)
- (
) Brief history of CLIs and the terminal
- (
) What’s inside the terminal?
- (
) Quiz on CLIs and terminals
Chapter 2:
- (
) A basic Python primer (part 1)
- (
) A basic Python primer (part 2)
- (
) Understanding
pip
and virtual environments - (
) Preparing our Python environment using
virtualenv
- (
) Running our basic Python app
- (
) Quiz on Python basics
Chapter 3:
- (
) Introduction to
argparse
- (
) A miniature CLI using
argparse
- (
) Mini-project 1: building a “greeter” CLI (a CLI which could print
Hello, <username>! The current time is <timestamp>
) - (
) Exercise: build a CLI to print the first X lines of a file (
head
). - (
) Solution walkthrough
- (
) Quiz on
argparse
Chapter 4:
- (
) Introduction to
click
- (
) Understanding the structure for building CLIs with
click
- (
) Mini project 2: Build a CLI for note-taking (add and view notes)
- (
) Exercise: Add a new command to delete notes
- (
) Solution walkthrough
- (
) Quiz on
click
Chapter 5:
- (
) Basic
pytest
tutorial - (
) Unit testing Python CLIs
- (
) Using Makefiles/tox to ease testing
- (
) Using Github Actions for setting up pipelines
Chapter 6:
- (
) Packaging Python applications
- (
) Packaging our previously built CLIs
- (
) Best practices for building CLIs
Course completion:
- “What’s next” section with guided path (resources) to build command-line applications
- Open-ended project