Basic

Pinning a version

A build that is going to be used should name exactly what it was built against. Pinning is writing the version down where the build reads it, so the same command tomorrow gives the same artifact rather than whatever is newest.

What you will see

Exact versions, which is what makes the build reproducible rather than newest.

About 1 min of reading

Try It

Read a lock.

1

The lock

print('dep-a == 1.4.2\ndep-b == 0.9.0')

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Exact versions, which is what makes the build reproducible rather than newest.

Data Flow

A pin makes a build reproducible.
1 Write exact versions
↓
2 Commit the lock
↓
3 Build reads the lock
↓
4 Same build months later
Line by line

Read the first example one line at a time. A line that prints shows what appears on screen; the rest set things up quietly.

print('dep-a == 1.4.2\ndep-b == 0.9.0') Exact versions, which is what makes the build reproducible rather than newest.
Why this works
Commit the lock

The lock file belongs in the repository, not in the build machine. A lock that is not committed is a build that cannot be reproduced by anyone else, which is the whole point of pinning.

Diff the lock

A change to a lock file is a diff to read. That diff is where an unintended major bump shows up, and it is the review that stops a silent breakage reaching a release.

Examples

Lock files

A dependency manifest with exact versions is a lock. It is committed, and a build that reads it is reproducible months later, which a manifest of ranges is not.

The environment too

The runtime version matters as much as the library version. Recording both is what makes a reproduction of a bug a claim someone else can check.

Update deliberately

A lock does not move on its own. An update is a command that changes it and a diff that shows what changed, which is the review that catches a breaking bump.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Pre-releases and the gap
Previous Lesson
Pre-releases and the gap
Next Lesson
Checking your own versions
Checking your own versions →