Read Code Fast

Lesson 16 An unfamiliar repo

5 min read · Python · Quiz

README, manifest, entry points and tests give you a map in ten minutes

What you'll learn

  • Build a map of an unfamiliar repo in four stops
  • Find the real entry point and the real commands
  • Trust the manifest over the README

You open a repo you have never seen, with 200 files. Nobody reads 200 files. You read four of them, in the right order, and you have a map.

The idea

Make a map in four stops. The README says what the project is for and how to run it. The manifest (pyproject.toml) lists the dependencies and the settings it really uses. The entry point is where the program starts. The tests show what it promises.

Then pick one feature and follow it from the route to the database and back. That is ten minutes, and you know where things live. When the README and the project disagree, believe the project: a command that doesn't work fails right away.

shop-api (file tree)
1shop-api/2  README.md3  pyproject.toml4  .env.example5  app/6    __init__.py7    main.py8    routes/9      orders.py10      users.py11    services/12      invoice.py13    db.py14  tests/15    test_orders.py
  1. Line 3 Open this after the README. dependencies show the framework, and the tool sections show how tests and linters are set up.
  2. Line 7 Likely the entry point: it creates the app. Confirm in the README or the run command (for example uvicorn app.main:app), don't guess.
  3. Line 8 One file per feature: this folder is a map of what the API offers.
  4. Line 15 The tests are the project's promises. Read the test names before the code. (test_*.py is the name pytest looks for.)

Take away

  • Four stops: README, manifest, entry point, tests. Then follow one feature all the way through.
  • The manifest tells you what really runs. The README may be out of date.
  • An entry point is named by the project's own commands, not guessed from file names.

Quiz: test yourself

6 questions: a quick quiz, then a review drill. Pick an answer to see why it's right.