MPCS 51052 - Advanced Python Programming

Course Overview

This course explores a wide variety of programming concepts using Python and its vast ecosystem as a foundation. The goal is to explore advanced programming & software design concepts using newer features of the Python language as well as third-party libraries. The course will make heavy use of open source libraries & Python’s own code to understand how Python is written and what constitutes good “Pythonic” design.

Topics will include:

Python as an evolving language. What’s new in Python? How and why does the language evolve & what has been added recently? What tools are Python developers using today?

Metaprogramming & “power-user” features. What are the parts of Python’s syntax & libraries that aren’t used every day that can lead to more expressive code? We’ll look at generators/coroutines, context managers, decorators, descriptors & other features typically not covered in earlier courses. How do they work internally? When do you use them?

Python & the web. Why is Python such a popular language for web development? We’ll use this as a jumping off point to discuss trade-offs in library design and work with libraries like Django, Flask, Starlette, FastAPI, etc.

Asynchronous programming in Python. What is the GIL? Why are there so many ways to do asynchronous work in Python & which are worth using? We’ll also explore some async web frameworks to see real-world usage.

Making Python faster. How write the most performant Python you can, and what to do when that still isn’t fast enough. We’ll touch on Python’s C API, PyPy and other alternate interpreters, and enhancing Python with Rust.

The course will have regular programming assignments as a well as a final project.

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 push the limits of Python and the solutions that have arisen since.
  • Explore the Python ecosystem to better understand library API design and real-world performance considerations.
  • Gain experience building a full application in Python through the course project.

Office Hours

TBD

Schedule

Class will meet: Tuesday/Thursday 11am-12:20pm

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 Tues Thurs Due
1. Evolving Python Course Intro / How Python Evolves Writing “Modern” Python in 2026 M1
2. Solid Python Typing Testing in Practice A1; A2
3. Metaprogramming Python Metaprogramming Metaclasses A3
4. Practical Python Evolution of Dataclasses Coroutines A4; M2
5. Async Python The Notorious G.I.L. asyncio A5
6. Web Python Web Frameworks async web A5b
7. Faster Python Profiling Alternate Interpreters A6
8. Extending Python C API Other Extensions A7; M3
9. Future Python GIL-free Python __future__ A8
10. Final Week: Project Showcase - - M4; A9

Assignments

There are ten assignments in this class, as well as a quarter-long project with a few milestones.

Number Name Type
A1 PEP Report Written
A2 New Syntax Practice PA
A3 Typing & Testing PA
A4 Metaprogramming PA/Original Work
A5 Coroutines PA
A5b Async PA/Original Work
A6 Web API PA/Original Work
A7 PyCon Report Written
A8 Extension PA/Original Work
A9 PEP Written

Programming Assignments

There are 7 PAs: A2, A3, A4, A5, A5b, A6, A8.

For each, will be provided with an existing codebase with functions/methods to implement and fix.

These are designed to give practice with new concepts in the language to build & test your understanding of how to use these features.

  • Three (A2, A3, A5) are required.
  • Four (A4, A5b, A6, and A8) have an ‘Original Work’ option. Your project may be used to substitute up to two of these. If you are using a significant amount of metaprogramming, async, web API, or writing a custom extension as part of your project– you can skip the relevant assignment, using your project’s implementation towards that grade.

5 and 5b These PAs are related to one another. It is not possible to complete 5b without first finishing 5. This is noted so you can plan accordingly.

Written Assignments

Three written assignments (A1, A7, A9) will involve doing outside reading and presenting to me & your peers on what you learn. This will let you explore topics at a deeper level than what we can cover in class, help build your technical communication skills, and give practice learning challenging technical content on your own.

TBD: There will be an in-person participation component to these assignments.

Assignment 1: PEP Report

Pick a PEP.

Your choice should either be a Finished PEP from a recent version (Python 3.11 or later), or in the Accepted or Open phase. The PEP should be about the language itself (no release note, tutorial, or governance PEPs).

You may not choose a PEP that someone else has already made a post about.

Read your chosen PEP and write an Ed post with the following sections:

  • Summary: Summarize the core ideas of the PEP in your own words. Why is it interesting to you?
  • Alternatives: What else is/was being considered?
  • Example: Write a piece of example code that shows how the PEP would be used. This example must be original, not borrowing from the example in the PEP itself. Take time to understand what the PEP does and how code would be improved by adopting the new syntax/feature.
  • Link to implementation: Your PEP most likely mentions a “bpo” number, an issue in the Python bug tracker. For example, PEP 674 mentions https://github.com/python/cpython/issues/89639. Using these link(s) (there may be a few), try to find the relevant Git PR/commits that implement the PEP. Provide a link to the implementation, or if you cannot find one, the relevant issues.
  • Opinion: What is your opinion on this PEP? Would you vote to accept it or not?

Assignment 7: PyCon Talk Review

Details on this assignment will be updated during the quarter.

Assignment 9: Drafting a PEP

For this assignment, you will be writing a PEP of your own.

Based on everything we’ve covered in class, and everything you know about Python from using it– what enhancement do you want to add? You might consider:

  • Something that bugs you about the way Python works that you think can be fixed.
  • A piece of syntax from another language you miss when using Python.

Write your PEP according to the guidelines in PEP 1, which includes templates for writing new PEPs as well as the expected sections.

We will discuss the PEPs created by the class as a group.

Course Project

The course project consists of several milestones:

  • M1: Proposal - End of Week 1.
  • M2: Architecture Plan - End of Week 4.
  • M3: Prototype - End of Week 7.
  • M4: Final Product - Week 10, when final is scheduled.

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

The project should be a complete program: a CLI/TUI app, web application, GUI application, game, etc.

The purpose of your program is up to you, but must satisfy the requirements listed under M4.

M1: Proposal

To help you scope your project, you’ll answer some basic questions and attend a meeting to discuss your idea.

You may work independently or in teams of two.

M2: Architecture Plan

A more detailed version of your proposal, sketching out your proposed architecture. Details will be shared after M1.

M3: Prototype

To ensure things are on track, a partially-working prototype is for the third milestone. This will give you a chance to assess how much is left to do, how your plan needs to change, and to give course staff the opportunity to suggest changes. (See R8 below.)

M4: Final Product

Your final submission must meet the following requirements:

  • R1: Complete python application. Your application should be packaged in a way where it is possible for someone to git clone and uv run with minimal additional steps. The application should be laid out according to best practices and pass ruff checks with minimal ignores.
  • R2: Well-tested. Your application should have essential functionality tested and correct, following best-practices discussed in class.
  • R3: Well-typed. Your application must be typed, and pass type checks with minimal ignores.
  • R4: Documentation: A complete README with images or video as well as architecture & code documentation.
  • R5: A correct & non-trivial usage of least one “advanced” feature. Examples:
    • Metaprogramming: A domain-specific-language, plugin system, or other advanced usage implemented with metaprogramming techniques.
    • async: Use of async/await/asyncio.
    • A custom-written extension in C, Rust, Cython, RPython, etc. that makes a notable difference in the program’s performance.
    • Equivalent alternatives may be suggested as part of M2, subject to approval.
  • R6: Code is mostly correct & well-written. This both means writing Pythonic code as well as ensuring your code is efficient.
  • R7: Novelty. Code does something novel & interesting– not simply a reimplementation of something that has been built before. (It OK to build a “better” version of something that you’ve seen done, but you should have a unique take!)
  • R8: Response to milestone 3 feedback. At M3, course staff will make an additional request of your project aimed at strengthening it.

If you are working on a team, you’ll have two additional requirements:

  • R9: Use of mocks to build independently of one another. Will be discussed as part of M2.
  • R10: A second advanced feature. Either from the R5 list, or you may propose an alternate at the same or greater level of complexity that fits your project’s needs. Each team member must be responsible for a significant portion of one of the two advanced features, R5 and R10.

Solo projects will receive an automatic S on these two milestones.

Additionally, you must participate in the Week 10 project presentations in lieu of a final exam. Failure to participate will result in three deductions to your M4 grades.

Grading

We’ll be using specifications grading. You will be given a set of specifications of what makes work Satisfactory, Not satisfactory, or Ungradable.

Some assignments will have additional criteria to qualify for an Exceptional grade._

Final Grade Calculation

There are 23 available grades:

Component Points
Assignments 10
Project Milestones 1-3 3
Project Requirements 10

Each of these will receive an ESNU score:

Letter Point Value Description
E 1.5 Awarded for exceeding the base criteria on an assignment.
Only available on a few assignments.
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 but represents a solid effort.
U 0 Work that is incomplete or otherwise ungradable.

Note: Obtaining an E will often be challenging, the intention is that one would only choose to attempt the E criteria on a few assignments.

Letter Grade Required Points
A 22
A- 21
B+ 20
B 19
B- 18
C+ 17
C 16
C- 15

Recognizing that there is a lot of potential work in this class, is possible to skip one or two assignments and still earn a good grade, especially with the use of a bonus or two.

It is up to you to decide what grade you are aiming for and which assignments will most benefit you.

Warning

Academic Honesty violations, including unauthorized use of AI, will earn U on affected assignments and be ineligible for resubmission. Additionally, the highest grade you will be eligible to earn will be a B.

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

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

Resubmission & Late Policy

  • Any assignment 1-72 hours late will be capped at an N, work after 72 hours will be given a U.
  • You may resubmit one of the seven programming assignments. These resubmissions will be due by Week 9 and give you a chance to improve a previously-earned grade.
  • Written assignments and project milestones may not be resubmitted.
  • Resubmissions can be used as an effective extension to account for life events or busy weeks. Otherwise, no late work will be accepted.
  • Exceptions will only be made in the rare case of serious illness or major emergencies. I will ask that you have your advisor reach out to me.