[Python Dependency Pitfalls] How to set the world on fire

Hey there,

#1 on my list of dependency management pitfalls is there for a good reason:

It lead to a single developer causing mayhem and breaking thousands of open-source projects around the world in one fell swoop.

Here's how it all went down:

A few years back, Azer Koçulu wrote a tiny library he published on Npm, the package repository for NodeJS. (The Python equivalents would be PyPI + pip.)

That "library" contained only 11 lines of code in total, but it was downloaded MILLIONS of times every month of as a dependency in other JavaScript projects.

What Azer's magical "micro library" did, you ask?

It added a tiny piece of functionality that was frequently needed but wasn't a part of the NodeJS standard library:

The ability to pad out the lefthand-side of strings with zeroes or spaces. For example, to format numbers for display.

In Python you'd probably do something like this:

>>> n = '4'
>>> n.zfill(3)
'004'

Anyway, this tiny "left-pad" library was used across many projects, including important applications like Node itself.

One fine day, Azer decided to close his NodeJS package repository account…

Which removed all of the packages associated with it.

And suddenly, "left-pad" was no longer available for download…

Can you guess what happened to the dependency install setup steps on projects using "left-pad?"

Well, they came to a SCREECHING HALT:

App deployments became stuck dead in their tracks. Automated tests stopped working.

And thousands of developers couldn't even RUN their apps locally…

All because "left-pad" had disappeared—and some important build tools required it to work.

It was quite crazy. Even some newspapers reported about the "left-pad incident."

You can imagine that there was a lot of "bruhaha" about the NodeJS packaging system—

But to tell you the truth the *exact same thing* could happen at any time with Python's packaging repository, PyPI.

It's easy to think that pulling in functionality from 3rd party dependencies is always a net benefit.

But every time you're adding an external dependency to your own project you're walking a fine line…

BAD external dependencies can make your stomach churn as a developer or project maintainer.

The people who got burned by the NodeJS "left-pad" incident know what I'm talking about...

On the other hand, a great quality third-party package can save you hours or even days of work.

The challenge is deciding whether a dependency adds value or is just a liability:

>> See step-by-step how to research and make Python dependency decisions (and how to explain them to your team/manager)

— Dan Bader

P.S. There's an important skill that Python dev managers look for in a candidate, but they rarely find it. More on that tomorrow.

Key phrases

Older messages

[Python Dependency Pitfalls] A total mess?

Monday, September 26, 2022

Hey there, Recently I watched a Pythonista ask for advice on setting up a Python project on his work machine. This new developer had some prior experience with NodeJS and had just started to get his

New Python tutorials on Real Python

Saturday, September 24, 2022

Hey there, There's always something going on over at realpython.com as far as Python tutorials go. Here's what you may have missed this past week: When Do You Use an "..." Ellipsis in

[PythonistaCafe] Q&A

Sunday, September 18, 2022

Hey there, At this point you should have a pretty good idea of what PythonistaCafe is about and what makes it special. In this email I want to answer some common questions that I get asked about the

[Python Mastery] What Pythonistas can learn from bestselling authors

Sunday, September 18, 2022

Hey there, I just finished reading Stephen King's "On Writing." It's a great little book where he shares some of the writing advice and stories he's picked up over the course of

[Python Mastery] The hidden costs of "copy-paste" Python programming

Saturday, September 17, 2022

Hey there, Here's a development story that plays out thousands of times each day: Avid Pythonista Max is working on a function to find the 10 oldest files in a nested directory hierarchy. He needs

Are Christmas Lights Really a Fire Hazard?

Thursday, December 1, 2022

Did You Know?: Traditionally, the flight numbers of northbound/eastbound flights are even and those of southbound/westbound flights are odd. Read in Browser Logo for How-To Geek December 1, 2022 Did

Sheets in SwiftUI, Basic Shortcuts, Holiday App Store Sumbmissions and more!

Thursday, December 1, 2022

One more thing... Hello, you're reading Infinum iOS Cocoa Treats, bringing you the latest iOS related news straight to your inbox every week. Sheets in SwiftUI explained with code examples Sheets

Issue 244 - FSD Beta now open to everyone in North America

Thursday, December 1, 2022

View this email in your browser If you are just now finding out about Tesletter, you can subscribe here! If you already know Tesletter and want to support us, check out our Patreon page Issue 244 - FSD

Beware the file types hackers use most

Thursday, December 1, 2022

Garmin Enduro 2's killer feature; AI Time Machine -- ZDNET ZDNET Tech Today - US December 1, 2022 placeholder These file types are the ones most commonly used by hackers to hide their malware

Programmer Weekly - Issue 133

Thursday, December 1, 2022

View this email in your browser Programmer Weekly Welcome to issue 133 of Programmer Weekly. Let's get straight to the links this week. Quote of the Week "The longer it takes for a bug to

Python Weekly - Issue 578

Thursday, December 1, 2022

View this email in your browser Python Weekly Welcome to issue 578 of Python Weekly. Let's get straight to the links this week. From Our Sponsor The past, present, and future of notebooks Data

LinkedIn & Microsoft's open source ML and big data tools

Thursday, December 1, 2022

StackShare Weekly Email not displaying correctly? View it in your browser. StackShare Weekly Digest December 1st, 2022 Sponsored by Sumo Logic. We're honored to be recognized as a visionary based

Researchers 'Accidentally' Crash Cryptocurrency Mining Botnet Network

Thursday, December 1, 2022

The Hacker News Daily Updates Newsletter cover Mastering Cyber Intelligence ($19.99 Value) FREE for a Limited Time Cyber Threat Intelligence converts threat information into evidence-based intelligence

Noonification: Are Rising Interest Rates Going to Propel Neobanks?

Thursday, December 1, 2022

Top Tech Content sent at Noon! Find Your Next Software Engineering Job on Hired How are you, @hacker? 🪐 What's happening in tech this week: The Noonification by HackerNoon has got you covered with

Web Tools #489 - Array.values(), Media Tools, React, Git/CLI

Thursday, December 1, 2022

Web Tools Weekly WEB VERSION Issue #489 • December 1, 2022 Advertisement The Future Of Tech, Delivered Today. Join over 450K people by reading Emerging Tech Brew, the 3-times-a-week email delivering