Package Registry

Package Registry

A package registry is a central online repository for ready-made software building blocks that programmers incorporate into their own projects. Well-known examples are npm for JavaScript and PyPI for Python.

Anyone who writes a program today only writes a small part of it themselves. The rest is fetched ready-made: small software building blocks that other people have written and published. Such a building block solves a single task, for example converting date formats or drawing a chart. A package registry is the central storage location on the internet where these building blocks reside. Anyone can upload something there, and anyone can download something. You can think of it like a public library where the shelves are sorted by name and version number.

Why almost every program depends on a registry

The practical benefit is enormous. Writing encryption yourself takes months and usually goes wrong. A vetted building block from a registry can be installed in a minute. That’s why modern applications often consist of hundreds of such foreign parts. In larger web projects, a thousand or more is not unusual.

But this very dependency is also a risk. If a single popular building block breaks or is maliciously altered, it affects every program that uses it. In 2016, a developer deleted a tiny npm package with eleven lines of code. Thousands of projects worldwide could no longer be built correctly afterward.

Attackers deliberately exploit this. They upload packages whose names differ from well-known ones by just one letter. If someone makes a typo while installing, malicious code ends up in the project. Experts call such attacks on the software supply chain supply-chain attacks.

Names, versions, and dependencies

Every package in a registry has a unique name and a version number, such as 2.4.1. If the last number increases, only bugs were fixed. If the first number increases, the package has changed fundamentally and may no longer fit with your own code. This rule is called semantic versioning and is a convention, not a technical guarantee.

In a project, there is a text file listing all required packages along with their versions. A helper program, the package manager, reads this list and downloads everything from the registry. In doing so, it also checks which packages in turn require further packages. This creates a tree of dependencies that quickly becomes several levels deep.

To ensure that exactly the same thing arrives on every machine, the package manager writes the exact installed versions into a second file, the lock file. In addition, the registry stores a checksum for each file, a short numeric code derived from its content. If the checksum doesn’t match during download, something was altered along the way.

npm, PyPI, and the registries of the AI world

Every programming language has its own major registry. npm belongs to JavaScript and, with over three million packages, is the largest. PyPI serves the Python language, in which a very large share of all AI software is written. Then there’s Maven for Java and Crates.io for Rust.

In the AI world, there is a related principle for ready-trained models. The platform Hugging Face works similarly to a registry, but distributes not program code but the model files themselves. Docker Hub also follows this pattern and delivers complete, pre-built software environments.

In business news, registries usually come up in connection with security incidents. Companies therefore often operate internal registries that only pass on packages after a review. The EU’s Cyber Resilience Act also requires manufacturers to document the building blocks they use. This list is called a Software Bill of Materials, essentially a parts list for software.

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.