Dependencies and git

requirements.txt, venv, and git — what they are, and what this tab cannot run.

On a laptop, a project lists packages in requirements.txt, isolates them in a venv, and records history with git. This tab cannot run those tools. You still need to know what they are.

Goal

Write a requirements.txt as documentation, and print why venv and git stay on the desktop.

A lock-ish list

from pathlib import Path

Path("requirements.txt").write_text(
    "# This kiosk project uses the standard library only.\n"
    "# On a laptop you might pin:\n"
    "# pytest==8.3.2\n",
    encoding="utf-8",
)
print(Path("requirements.txt").read_text(encoding="utf-8"))

Pin versions so a teammate gets the same library. This course needs none.

What you would type on a laptop (do not run here)

print("python3 -m venv .venv")
print("source .venv/bin/activate")
print("pip install -r requirements.txt")
print("git init")
print("git add . && git commit -m 'Nairobi kiosk helpers'")

Those lines are strings. This editor is not a shell.

Why they exist

  • venv — a private site-packages so the kiosk app does not share libraries with some other project.
  • pip — install what requirements.txt names.
  • git — history, branches, and review. Not a backup disk.
Pitfall

Do not paste os.system("git ...") or subprocess git calls here. There is no git binary, and this course does not shell out. Learn git in a real repo on your machine.