0%

Isolated Environments and Packages · capstone

Capstone project: Capstone: Make the Environment Repeatable

Your current shell already knows the route. A repeatable project leaves the route for the next person, who may be using another and certainly will not have your .venv.

The final result is deliberately small:

  • requirements.txt records the one exact direct dependency;

  • check_package.py imports requests and prints its version;

  • ENVIRONMENT.md explains how to create, activate, install, and verify on / and Windows.

The environment itself is not part of the handoff. If .venv vanished between lessons, that is useful evidence: the durable files are the project.

Write the rebuild guide

Open ENVIRONMENT.md with nano. Write a short guide in your own words, but make sure it contains both routes below.

For macOS and Linux, another learner needs these commands:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python check_package.py

For Windows PowerShell, they need:

py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
python check_package.py

You may add the uv alternative after the standard route. Do not replace the standard route with it. A person who has Python but not uv should still be able to recover the project.

Prove the handoff to yourself

If .venv is absent, follow one of your own routes in the site . The site uses python rather than python3 for creation:

python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python check_package.py

You should see 2.34.2. You just rebuilt from your own written instructions, which is the whole point of the chapter: the environment was disposable and the recipe was not.

When both files are ready, press Check my work.

If your guide is missing a step, the fastest way to find out is to read it as though you had never seen this project. Ask Monty to follow your ENVIRONMENT.md as a first-time reader and tell you the first place it assumes something you never wrote down.

Why must ENVIRONMENT.md keep the standard venv and pip route even if you add the uv alternative?