Phase 2: Dev Environments & Dependency Management · ~30 minutes · Python · uv
"Works on My Machine"
It runs perfectly on your machine because your machine isn't clean. It's the accumulated result of everything you've ever installed, and some of that is invisibly load-bearing.
Real-world application: Assumes their current setup is one particular accumulated state, not the ground truth, and tests against a genuinely clean environment before trusting it
What you will learn
- Explain an implicit dependency: something that 'just works' locally because of accumulated local state, not because it's actually declared anywhere
- Explain what reproducibility actually means, beyond 'it works when I run it'
- Diagnose a script that fails in a clean environment despite working locally
- Identify a likely missing assumption from a clean-environment error message
Introduction
- Type: Learn
- Languages: Python
- Prerequisites: Git for Real Work
- Time: ~30 minutes
Objective
Learning objectives
- Explain an implicit dependency: something that "just works" locally because of accumulated local state, not because it's actually declared anywhere
- Explain what reproducibility actually means, beyond "it works when I run it"
- Diagnose a script that fails in a clean environment despite working locally
- Identify a likely missing assumption from a clean-environment error message
What you're building
Given a script that fails in a clean environment (write your own, following this lesson's fetch_data.py pattern — pick any real package you know is likely already on your machine from earlier work):
- Confirm it runs successfully normally (
python3 script.py or similar) - Confirm it fails in a genuinely isolated environment (
uv run --isolated --no-project script.py), and capture the real error - Diagnose exactly which implicit dependency is missing, based on the error message
- Write
diagnosis.txt stating the missing dependency and how you'd properly declare it so a fresh environment would satisfy it automatically (this course's Lesson 02-02 covers the actual mechanism in depth)
A script fails on a teammate's fresh machine with FileNotFoundError: [Errno 2] No such file or directory: '/Users/ada/configs/settings.json', even though the exact same script runs fine on the original author's machine. What's the most accurate diagnosis?
The path /Users/ada/configs/settings.json is specific to one person's home directory on one specific machine — it can never exist on anyone else's machine by definition, no matter how correctly set up they are. This is a particularly clear example of an implicit dependency: the script silently assumes a specific file exists at a specific absolute location on the filesystem, without that assumption being declared, configurable, or portable anywhere. The fix is a relative path, a config value, or an environment variable — anything that doesn't hardcode one specific person's machine layout.
This lesson is free
You've read the first 2 sections. The rest covers The Problem, Check Yourself, Key Terms & Next. A free account opens all of it, with its practice questions and its lab. No card.
Create a free account — the opening phases of 29 of 35 courses, and the first lesson of every phase, are free, no credit card.
Browse all courses · View pricing · DeVenture Academy