Case Study: How Open Source Packages Power the World

The Scenario

When you type pip install requests and it works in under five seconds, something remarkable has happened. You've reached across the internet to the Python Package Index (PyPI), downloaded a package that hundreds of thousands of developers use daily, and installed it on your machine — for free. No purchase, no license agreement, no subscription.

Behind that effortless command is an ecosystem of open source software that underpins nearly every application you use — from Instagram (built with Django, a Python web framework) to scientific research (powered by NumPy and SciPy) to the AI revolution (built on PyTorch and TensorFlow).

This case study explores how that ecosystem works, what happens when it breaks, and why understanding it matters for every programmer.

What Is PyPI?

The Python Package Index (PyPI, pronounced "pie-pee-eye") is the central repository for Python packages. As of 2025, it hosts over 500,000 packages with billions of downloads per month.

When you run pip install requests:

  1. pip contacts PyPI's servers at pypi.org
  2. PyPI looks up the package named "requests"
  3. It finds the latest compatible version for your Python version and operating system
  4. pip downloads the package (usually a .whl file — a "wheel")
  5. pip installs the package into your Python's site-packages directory
  6. pip also downloads and installs any dependencies — packages that requests itself needs to function

That last step is where things get interesting.

Dependency Trees: It's Packages All the Way Down

The requests library is one of the most popular Python packages. But requests doesn't work alone. It depends on other packages:

requests
├── charset_normalizer
├── idna
├── urllib3
└── certifi

Each of those dependencies might have its own dependencies. This creates a dependency tree — a hierarchy of packages that all need to be present for the top-level package to work.

You can see this yourself:

# Show what requests depends on
pip show requests

# Show all installed packages
pip list

# Generate a complete dependency snapshot
pip freeze

For a small project, the dependency tree might include 5-10 packages. For a large data science project, it can easily reach 100+. A typical web application using Django might pull in 50-80 packages.

Here's a simplified view of what happens when you install a data analysis stack:

pandas
├── numpy
├── python-dateutil
│   └── six
├── pytz
└── tzdata

matplotlib
├── numpy
├── pillow
├── pyparsing
├── cycler
├── fonttools
├── kiwisolver
└── packaging

Notice that both pandas and matplotlib depend on numpy. pip is smart enough to install numpy only once and share it.

The left-pad Incident: When a Tiny Package Breaks the Internet

On March 22, 2016, a developer named Azer Koculu unpublished a tiny JavaScript package called left-pad from npm (JavaScript's equivalent of PyPI). The package was 11 lines of code — it did one thing: pad the left side of a string with spaces or zeros.

When left-pad disappeared, thousands of packages that depended on it (directly or indirectly) broke. Companies like Facebook, Netflix, and Airbnb saw their build systems fail. For several hours, a significant portion of the JavaScript ecosystem was non-functional — because of an 11-line function.

What Went Wrong?

The incident exposed several systemic vulnerabilities in package ecosystems:

  1. Deep dependency chains. Major packages depended on left-pad through chains of intermediate packages. None of the developers of those major packages had any idea they depended on it. The dependency was invisible.

  2. Single point of failure. One developer controlled a package that thousands of projects relied on. When that developer decided to remove it, there was no safety net.

  3. Trivial dependencies. left-pad was 11 lines of code. Many developers argued that such trivial functionality should be written inline rather than imported as a dependency. Every dependency is a risk — a risk of breakage, a risk of the author disappearing, a risk of the package being compromised.

  4. No vendoring or pinning. Most projects that depended on left-pad pulled the latest version from npm automatically, with no fallback. When the package vanished, the latest version became "nothing."

Lessons for Python Developers

While the left-pad incident happened in the JavaScript ecosystem, the lessons apply to every package ecosystem, including Python's:

1. Understand your dependencies. Run pip freeze and actually look at what's installed. Do you know why each package is there? Which ones are direct dependencies (you chose them) versus transitive dependencies (pulled in automatically)?

2. Pin your versions. Instead of pip install requests, use pip install requests==2.31.0 for reproducible builds. Better yet, use pip freeze > requirements.txt to lock every dependency to a specific version.

3. Evaluate before you install. Before adding a dependency, ask: - How many lines of code would it take to write this myself? - Is this package actively maintained? - How many downloads does it have? (Widely used packages are less likely to vanish.) - How many dependencies does it pull in?

4. The standard library is your safest dependency. Standard library modules will never be unpublished, they're maintained by the Python core team, and they're guaranteed to be compatible with your Python version. When the standard library can do the job, prefer it over a third-party package.

The Economics of Open Source

Here's a fact that should make you think: the requests library has been downloaded over 5 billion times. It's used by virtually every company that writes Python code. Its creator and primary maintainer, Kenneth Reitz, developed it largely in his spare time.

This pattern repeats across the open source ecosystem:

  • NumPy, the foundation of scientific Python, was maintained for years by a tiny team of volunteers.
  • OpenSSL, the cryptography library that secures most of the internet's HTTPS connections, was maintained by two people (one of them a volunteer) when the devastating Heartbleed vulnerability was discovered in 2014.
  • cURL, used by virtually every networked application on the planet, is primarily maintained by one person: Daniel Stenberg.

The packages you install with pip install are overwhelmingly created and maintained by people who aren't paid for that work. They do it because they believe in open source, because they want to give back to the community, or because they started a useful project and people started depending on it.

This creates a tension: the world's critical infrastructure depends on code maintained by volunteers. When those volunteers burn out, change priorities, or simply move on, the packages they maintain become vulnerable — to bugs, security flaws, and abandonment.

What You Can Do

As a new Python developer, you're joining this ecosystem. Here are ways to be a responsible participant:

  1. Report bugs. If you find a bug in an open source package, report it on the project's issue tracker (usually on GitHub). Even if you can't fix it, a clear bug report helps maintainers.

  2. Read the documentation. Before asking questions, check if the answer is already documented. Maintainers spend significant time answering questions that are covered in the docs.

  3. Contribute back. Even small contributions matter — fixing a typo in documentation, adding a test case, or improving an error message.

  4. Respect maintainers' time. Open source maintainers are doing unpaid work. Be patient, be polite, and don't demand features or fixes.

How Python's Ecosystem Compares

Different programming languages have different package ecosystem cultures:

Aspect Python (PyPI) JavaScript (npm) Rust (crates.io)
Package count ~500,000 ~2,000,000 ~140,000
Philosophy "Batteries included" + ecosystem Minimal stdlib, ecosystem for everything Middle ground
Typical project deps 10-50 50-500+ 20-100
left-pad risk Lower (rich stdlib) Higher (more micro-packages) Lower (careful culture)
Package removal Allowed (with restrictions) Restricted after left-pad Permanent once published

Python's "batteries included" philosophy — the rich standard library — means you need fewer third-party packages for common tasks. This naturally reduces dependency risk.

Discussion Questions

  1. The left-pad package was 11 lines of code. At what point is a piece of functionality "too small" to be a package? Where would you draw the line?

  2. If a critical open source package is maintained by volunteers, and the world's infrastructure depends on it, should companies be obligated to fund its development? Who should pay for open source software?

  3. You're starting a new project and need to parse CSV files. You could use Python's built-in csv module, or you could pip install pandas (which is much more powerful but adds ~20 dependencies). What factors would influence your decision?

  4. Run pip list on your Python installation. How many packages are installed? Pick three that you didn't install yourself (they were pulled in as dependencies). Look them up on PyPI. What do they do? Who maintains them?

  5. The requests library is so popular that some people think it should be added to Python's standard library. What would be the advantages and disadvantages of including it?

Mini-Project

Dependency Audit: Choose a popular Python package (e.g., flask, django, pandas, fastapi). Perform a dependency audit:

  1. Install it in a clean virtual environment: python -m venv audit_env && audit_env/bin/pip install <package>
  2. Run pip freeze to see all installed packages
  3. Count the direct and transitive dependencies
  4. Research the maintainers of the top-level package: How many contributors does it have? How often is it updated? When was the last release?
  5. Identify the smallest dependency by code size. Could its functionality be easily replaced with standard library code?

Write a one-page report with your findings and an assessment of the package's dependency health.

References

  • The left-pad incident is extensively documented. The original npm blog post (March 2016) explains the policy changes that resulted. (Tier 1 — primary source)
  • Eghbal, N. (2020). Working in Public: The Making and Maintenance of Open Source Software. Stripe Press. Chapters on maintainer economics and sustainability. (Tier 1)
  • Python Package Index usage statistics are publicly available at pypi.org and through the pypistats API. (Tier 1)
  • The Heartbleed vulnerability (CVE-2014-0160) and its connection to OpenSSL's understaffing is documented by the Linux Foundation's Core Infrastructure Initiative report (2014). (Tier 1)
  • PyPI download counts are tracked by pypistats.org. The requests library's cumulative download count exceeds 5 billion as of 2025. (Tier 2 — publicly available data, may change)