16 of 174 subtitles documented + 1 independent supplementary unit(s) · Writing progress, not your learning progress · Videos not visually reviewed

First project: why isolate environments and dependencies?

Objective and entry check

You should be able to distinguish source code, runtime environment, dependencies, and configuration, and diagnose an application running in the wrong environment. Prerequisites are running Python files, functions, and imports; model training is not required.

Before reading further: if a library is installed on a computer, can every Python interpreter see it? Does cloning a repository install its Python packages? Does the existence of a .env file mean Python has loaded it?

Entry-check answers — reveal after attempting

All three are “not necessarily.” Installation belongs to an interpreter/environment; Git usually transfers project files; loading .env requires application code or a runner. If these boundaries are unclear, finish this lesson before writing the chain.

Why does this problem exist?

A simple script may work on one machine. Then another project needs a different library version, a colleague uses another interpreter, and a service requires an access key. Correct source code alone is no longer sufficient to reproduce the behavior.

Isolating environments and declaring dependencies address this engineering problem. This explains the design motivation, not the historical invention of virtual environments. Lecture 008 uses uv; changing package managers does not change the underlying problem.

What are we building?

In lecture 007, the instructor introduces a project that sends text about a person to a model for a summary and two facts. The goal is hands-on familiarity with prompt templates, chat models, chains, and later debugging. The person's identity and model brand are not essential to the architecture.

Our example uses fictional information and initially runs with a local test model. Its reply is predetermined. It is not a real intelligent model, and its output does not validate summarization quality. This stage exposes data flow without an API key.

Four different concerns

Concern Responsibility Example
Source code Program instructions first_chain.py
Dependencies Libraries used by the code langchain-core
Runtime environment Interpreter and visible packages .venv
Configuration Values dependent on a machine or service Model name or access key

pyproject.toml declares project requirements; a lockfile such as uv.lock records resolved versions; .venv contains their local installation. The uv guide describes uv sync for synchronizing an environment and uv run for executing in the project environment. Official uv guide

Do not treat copying and committing .venv as project portability. Transfer the code and dependency configuration, then recreate the destination environment.

Run the included example

The examples directory contains our small project. With uv installed, run these PowerShell commands from this course's root directory:

Set-Location examples
uv sync
uv run first_chain.py

uv sync may need internet access to download packages. Executing first_chain.py does not contact a model service. During preparation, the example was executed with the machine's existing Python 3.12 and langchain-core==1.5.2; independent execution of uv sync was not performed. This tested core version is recorded in pyproject.toml; a lockfile has not yet been generated.

langchain-core is sufficient for this local example. A real provider also needs its appropriate integration package. Installing langchain does not install every possible connection. Provider selection belongs to the live-execution lesson.

Configuration and keys

The instructor uses python-dotenv and load_dotenv() to load .env values into the process environment. Keep the concepts separate: .env is a text file; an environment variable is a value read by the running process. Environment variables can also be configured without a .env file.

Our offline example requires no key. For a real connection, check whether required configuration exists without printing its secret value. Files containing keys belong in .gitignore. This adjusts the instructor's demonstration: the subtitles describe printing a key to show it was loaded.

The setup lecture also describes an orphan branch and removing repository files. Understanding chains does not require repeating those steps. Our learning repository keeps examples in this subdirectory. The instructor's repository URL and exact commit could not be extracted from the subtitles; our files are educational reconstructions, not verified copies of his code.

Diagnose failures by their cause

Independent practice

  1. A package is installed in system Python, but your IDE cannot import it. What do you inspect before reinstalling?
  2. Which belong in Git: .venv, pyproject.toml, example source, or a file containing a real key? Explain.
  3. How does offline example execution differ from offline dependency installation?
Answer 1

Compare the IDE's selected interpreter with the environment where the package was installed. They may be different environments.

Answer 2

Source code and pyproject.toml; normally include the lockfile once generated. .venv is a reproducible local installation, while the real key is private runtime data.

Answer 3

The test model makes no network requests, but obtaining packages to build its environment can require internet access. “Offline” here describes example execution.

Recall and continuation decision

Without looking, explain the four table rows and sketch execution from interpreter selection to import. If you can diagnose an environment mismatch and justify answer 2, continue to the first chain. Otherwise, revisit only the environment/dependency distinction and test it with a new example.

In a later session, retry the three questions without the text. This is a review suggestion; no automatic reminder has been scheduled.

Provenance and limits

Course sources: lecture 007 subtitles through approximately 01:04 and lecture 008 through approximately 15:03. The table, exercises, alternative project workflow, and offline example are supplementary teaching material. Videos have not been visually reviewed. Sources and uv behavior checked on 2026-10-16.