MPCS 51052 - Advanced Python Programming

Warning

This is an early draft, meant as a general guide to what you can expect from this class.

It is still being developed as I design the class and may change significantly before being offered in spring quarter. I will remove this notice during winter quarter as I finalize details.

This course explores a wide variety of programming concepts using Python and its vast ecosystem as a foundation. The course introduces newer features of the language as well as third-party libraries related to testing and performance, web programming, and extending Python with C or Rust. These libraries and language features are used to explore API design and other considerations of using Python in a production setting. The course will have regular programming assignments as a well as a final project.

Course Goals

  • Gain a deeper understanding of Python’s newer & more advanced features, with an eye towards language mastery.
  • See how common real-world tasks like parallel & web programming are done in the Python ecosystem.
  • Explore API design and real-world performance and design considerations.
  • Gain experience building a full application in Python through the course project.

Office Hours

TBD

Schedule

Class will meet: TBD

There will be recommended readings & videos most weeks, and a programming assignment every week.

Schedule subject to change, major changes will be announced in class and on Ed Discussion.

Week 1 - Python Revisited

  • Type System
  • Python is Syntactical Sugar

Assignment 1: Writing a Custom Type

Week 2 - “Modern” Python

  • What’s New in Python?
  • What is a virtual environment?
    • importlib
    • venv
    • pip, uv & the rest

Assignment 2: TBD

Project: M1 Due

Week 3 - Testing & Profiling

  • What is “pythonic”?: unittest vs. pytest
  • What do we test?
    • unit tests
    • beyond unit tests
    • performance testing

Assignment 3: Testing & Performance Assignment

Week 4 - Coroutines & Context Managers

  • Iterators & Generators revisited (aka wait yield does what?)
  • with

Assignment 4: Coroutines

Project: M2 Due

Week 5/6 - Asynchronous Programming

  • The Notorious G.I.L.
  • threads, processes, etc.
  • async/await

Assignment 5: Async

Week 7/8 - Python & the Web

  • “pythonic” revisited: from urllib to httpx
  • Web frameworks in Python
  • Async web frameworks

Assignment 6: Web Application Project: M3 Due

Week 9 - Faster Python

  • C & Rust Extensions
  • Alternate Interpreters
  • GIL-less Python

Assignment 7: Extensions

Week 10 - Final Project Due

Programming Assignments

Working on Assignments

  • Install dependencies. Once the assignment is checked out, first run uv sync. This will ensure that you have the necessary packages for this project.

  • Read the instructions carefully. The README.md file contains the instructions. Make sure you understand what you’re being asked to do before you start writing code. If you’re not sure, ask for clarification on Ed.

  • Check in often. As you work, check your code into git and push to GitHub regularly. This will help you avoid losing work if something goes wrong with your machine.

  • Run the tests. The tests are there to help you. If you’re not sure if your code is correct, run the tests and see if they pass as a first step. If they don’t, read the error messages carefully, they should give you a place to start investigating.

  • Experiment in the REPL. If you’re not sure how a particular function or method works, try it out in the REPL (uv run python3 or uv run ipython). A major advantage of interpreted languages is this ability to experiment interactively.

  • Ask questions of course staff - If anything is not clear, ask questions via Ed! If you are stuck or need help with a concept, office hours may be a good idea as well!

  • Use a linter. ruff will be introduced in this class. Using it (or a linter of your choice) in this course will let you focus on the actual problem, help you write cleaner code, and detect common issues that may result in a lower grade.

  • Learn pytest shortcuts - You’ll be spending a lot of time with it, so learn how to use the command line flags. My pytest tips should be most of what you need.

Specifications Grading

We will use specifications grading for programming assignments.

See Common Deductions

You will be given a set of specifications of what makes work Satisfactory, Not satisfactory, or Ungradable.

Graders will provide feedback on where your code has common issues and suggest better ways of doing things that would make your code simpler, more robust, or more efficient.

Each programming assignment will receive multiple grades based on how well it meets given specifications.

These are generally grouped into three categories:

  • Completion - Generally completion will be judged based on a number of tests that need to be passed.
  • Code Quality - Code quality will be evaluated by graders based on the criteria shared below.
  • Efficiency - Is the code reasonably efficient, given the general criteria observed in this class, also meeting any specific requirements made in the assignment.

For each assignment, the criteria for S & N grades will be given. For example, an assignment may state:

Completion Code Quality Efficiency
S Criteria Pass 19/19 Tests <=1 Deductions <=2 Deductions
N Criteria Pass 11/19 Tests <=4 Deductions <=5 Deductions

Course Project

In addition to the programming assignments, you will be working on a project most of the quarter.

The project consists of several milestones:

  • M1: Proposal - To help you scope your project, we’ll meet to discuss your idea in Week 2.
  • M2: Architecture Plan - Due in Week 4.
  • M3: Prototype - Due in Week 8.
  • M4: Final Product - Due in Week 10, instead of a final.

This project will require you to apply skills you learn in class, augmented with self-guided learning.

Grading

Final Grade Calculation

There are 7 programming assignments, each will earn you an E/S/N/U grade.

The first three project milestones will earn an S or U grade.

Component Points
Programming Assignments 7 ESNU
Project Milestones 1-3 3 S/U
Project Final 3 ESNU
Participation 3 S/U

The ESNU grades are converted to points:

Letter Point Value Description
E 1.5 Awarded for exceeding the base criteria on an assignment.
S 1 Awarded for meeting base criteria for an assignment with minimal errors.
N 0.5 Work that fails to meet the established base criteria.
U 0 Work that is ungradable.

And finally, those points are used to determine a letter grade.

There are 16 S available, as well as 10 E (an additional 5 points).

Note: Obtaining an E can be challenging, the expectation is that you would attempt some, but not all, of the additional criteria.

Letter Grade Required Points
A 18
A- 16
B+ 14
B 12
B- 11
C+ 10
Warning

Academic Honesty violations, including use of AI, will earn 3 U on affected assignments. Additionally, the highest grade you will be eligible to earn wiil be a B.

Participation

There will be two online (Ed-based) participation activities.

I will also give a participation point based on regular class attendance.

C- is the minimum grade to receive credit for this course.

The scale is designed to be forgiving of a single assignment that goes poorly, or a small number of N scores.

For example, someone with 2N and 1U can earn an A, or with an assignment missing altogether (3U), an A-.

From there, the scale continues to be forgiving of the occasional N, but less so of missing work, a 6th U makes your maximum grade a B-, and a 9th a C-.

The lesson here should be to turn in your best work for every assignment when it is due. That, combined with following style guidelines and other criteria will keep you out of jeopardy.

If you feel that you are at risk of falling behind reach out to James proactively to discuss options.

Resubmission & Late Policy

TBD