Syllabus Lesson 235 of 239 · Capstone: Ship It (Package Your Project)
Capstone: Ship It (Package Your Project)

Lay Out the Repo

You built something real in the earlier capstones: a support copilot, a doc extractor, an eval gate. Right now it probably lives as a pile of cells or one long script. A hiring manager who opens that has to guess where things are, and a recruiter who clones it and sees no obvious way to run it just closes the tab. The single highest-leverage thing you can do for a portfolio project is give it a boring, conventional layout so anyone can find their way around in 30 seconds.

Honest note up front: this module is about the repo, not a live cloud deploy. We cannot spin up a server or push to a host from inside your browser, and we are not going to pretend to. What you can learn and prove here is the structure, the tests, and the one-command run that make a deploy trivial later. The deploy notes at the end are exactly that -> notes, flagged as not graded.

The layout that almost every Python project converges on:

my_project/
  README.md            # what it is + how to run it
  pyproject.toml       # name, version, dependencies
  .env.example         # the shape of the secrets (NEVER the real ones)
  src/
    my_project/        # the importable package
      __init__.py
      core.py          # your actual code
  tests/
    test_my_project.py # pytest finds these by the test_ prefix

Two things to notice. First, the package lives under src/ in a folder named after the project -> that is the "src layout", and it stops your tests from accidentally importing the local folder instead of the installed package. Second, the package directory name tracks the project name: a project called triage gets src/triage/, a project called copilot gets src/copilot/. There is no single fixed answer -> the tree is a function of the name.

Your job is to write that function. build_manifest(name) takes a project name and returns the list of files the repo should contain, as a sorted list of path strings. It must include README.md, pyproject.toml, a package directory under src/<name>/ holding __init__.py and a module file, and a tests/test_*.py file. Normalize the name into a valid package directory (lowercase, and turn spaces and hyphens into underscores, since doc-extractor is not an importable module name but doc_extractor is).

This is the manifest a scaffolding script would create on disk. We are not writing files in the grader -> we are checking that you can describe the right tree for any project name. Press Run to print the layout for a project called triage.

Your turn

Write build_manifest(name) that returns the repo file tree for a project as a sorted list of path strings. It must include README.md, pyproject.toml, the package directory under src/<pkg>/ with an __init__.py and at least one module .py file, and a tests/test_*.py file. Normalize name into the package dir (lowercase, spaces and hyphens become underscores) so a different project name produces a different tree.

Spotted a problem in this lesson? Report it

Code · runs in your browser
Output