---
id: semantic-versioning
lang: en
title: "Versioning: why yesterday's code can differ with today's installation"
prerequisites: [project-setup, langsmith-tracing]
created: 2026-10-16
updated: 2026-10-16
source_lectures: [16]
status: documented-from-subtitles
---

# Versioning: why yesterday's code can differ with today's installation

## Objective and entry question

Find the installed version, distinguish requirements from a lockfile, and plan an upgrade check. If a video's import fails, must you have made a typing mistake?

<details><summary>Entry answer</summary>

No. The installed package or version may differ. Identify the interpreter, package name, and version before inspecting the import path.

</details>

## Why use version numbers?

Applications depend on library contracts: function names, accepted inputs, result types, and documented behavior. When a library changes, consumers need a signal about possible code changes. Unrecorded installations can give two people different environments for the same source. Versioning and dependency locking address this general software problem, not something unique to AI.

SemVer communicates public-API changes. In `MAJOR.MINOR.PATCH`, incompatible changes affect major, compatible functionality affects minor, and compatible bug fixes affect patch. A stable public API is not assumed for `0.x` releases. [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html)

This is not a guarantee against defects. Regressions, transitive dependencies, or reliance on private implementation details may still break an application. A version number informs a decision; it does not replace testing.

## Invented examples

| Change | Contract-based interpretation | Our practical action |
|---|---|---|
| `1.2.3 → 1.2.4` | Compatible fix | Review changes and run relevant checks |
| `1.2.3 → 1.3.0` | Compatible functionality | Review release notes and affected features |
| `1.2.3 → 2.0.0` | Potential incompatible public API | Read migration guidance and adapt code |

These numbers are teaching examples, not actual LangChain release claims. Compatibility concerns the declared public API; private internals may be outside that commitment.

## Three records, three responsibilities

- `pyproject.toml` declares requirements. A range differs from an exact version.
- `uv.lock` records resolved dependencies. The subtitles say “uv.log”; this is corrected here.
- The installed environment shows what actually runs now. A lockfile alone does not prove the IDE uses its corresponding environment.

Inspect the version in the environment running the example:

```powershell
python -c "from importlib.metadata import version; print(version('langchain-core'))"
```

For a uv-managed environment, use `uv run python ...` with the same command body. Our current experiments used `langchain-core` version `1.5.2`. This identifies the core package, not the version of the separate `langchain` package.

## Limits of the instructor's version claims

Lecture 016 mentions `1.0.2`, whereas the introduction's subtitles mentioned `1.3`. Different recording dates could explain this, but subtitles alone do not establish the cause. Neither number is presented as today's latest release.

An unconstrained installation does not necessarily reproduce the course environment. Reproduction needs source, environment, resolved dependencies, and sometimes model/service settings. A lockfile does not stabilize every factor affecting a language model's response.

## How should we check an upgrade?

Our suggested process: record current versions and expected behavior; make the change in a separate environment; read release/migration notes; rerun important examples; record results and the updated lockfile. Upgrading every package is not a prerequisite for understanding a lesson.

Example dependencies were not upgraded during this step. The [LangChain v1 migration guide](https://docs.langchain.com/oss/python/migrate/langchain-v1) informs the following lessons about agent APIs rather than justifying unrelated environment changes.

## Independent practice

1. One person reports core `1.5.2`, another reports `langchain` `1.0.2`. Do those numbers alone prove incompatible environments?
2. Why might identical `pyproject.toml` files with open ranges produce different installed versions?
3. A patch upgrade breaks your check. Should SemVer make you ignore the failure?

<details><summary>Answer 1</summary>

No. They identify different packages. Inspect the complete dependency set and those packages' compatibility constraints.

</details>

<details><summary>Answer 2</summary>

A range permits several choices; resolution can vary with time and environment. A lockfile records more specific resolved choices.

</details>

<details><summary>Answer 3</summary>

No. Investigate the failure. The versioning contract communicates release intent; your check measures actual behavior relevant to the application.

</details>

## Recall and continuation

Without the text, distinguish installed versions, requirements, and locking. If you can investigate an import failure step by step, continue to [agents and the search project](../017-agents/en.md). Otherwise, design an interpreter/version mismatch and identify where you would inspect it.

Course basis: the complete lecture 016 subtitles. Examples and upgrade guidance are supplementary. Standard and official guidance checked on 2026-10-16. Video not visually reviewed.
