[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.

Older messages

[Sublime + Python Setup] How to become a happier & more productive Python dev

Thursday, May 27, 2021

Hey there, I really struggled with setting up an effective development environment as a new Python developer. It was difficult to build the right habits and to find a set of tools I enjoyed to use.

[PythonistaCafe] What makes PythonistaCafe different

Thursday, May 27, 2021

Hey there, Mastering Python is *not* just about getting the books and courses to study—to be successful you also need a way to stay motivated and to grow your abilities in the long run. Many

[Sublime + Python Setup] Sublime Text is just a blank canvas…

Tuesday, May 25, 2021

Hey there, When I became serious about optimizing Sublime Text with plugins, it was hard for me to separate the wheat from the chaff. Without a real guideline or roadmap I resorted to installing *any*

[Sublime + Python Setup] Grumpy old greybeard with a whitespace problem

Monday, May 24, 2021

One fateful day, the Agile Gods that be decided to “add some firepower” to my little team… And so, developer Paul joined (name changed to protect the guilty). Before I dive into this story, let me ask

[Sublime + Python Setup] Don’t build “nag screen muscle memory”

Sunday, May 23, 2021

Hey there, Once I worked with a developer who refused to buy a registered copy of Sublime for months on end, even though he *loved* Sublime. He used it as his main code editor every day and was very

You Might Also Like

Press, Pause 🗜️

Friday, May 10, 2024

Apple doesn't understand why people like hydraulic presses. Here's a version for your browser. Hunting for the end of the long tail • May 09, 2024 Press, Pause Beyond misunderstanding its iPad

Data Science Weekly - Issue 546

Friday, May 10, 2024

Curated news, articles and jobs related to Data Science, AI, & Machine Learning ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Dell’s data breach

Thursday, May 9, 2024

Plus: Mistral AI is raising funds and Bumble's new strategy View this email online in your browser By Christine Hall Thursday, May 9, 2024 Welcome back to TechCrunch PM. Today I have for you a

💻 Issue 416 - The new disposable APIs in Javascript

Thursday, May 9, 2024

This week's Awesome JavaScript Weekly Read this email on the Web The Awesome JavaScript Weekly Issue » 416 Release Date May 09, 2024 Your weekly report of the most popular JavaScript news, articles

💻 Issue 409 - Making a 3D modeler in C in a week

Thursday, May 9, 2024

This week's Awesome .NET Weekly Read this email on the Web The Awesome .NET Weekly Issue » 409 Release Date May 09, 2024 Your weekly report of the most popular .NET news, articles and projects

📱 Issue 410 - FDA recalls defective iOS app that injured over 200 insulin pump users

Thursday, May 9, 2024

This week's Awesome iOS Weekly Read this email on the Web The Awesome iOS Weekly Issue » 410 Release Date May 09, 2024 Your weekly report of the most popular iOS news, articles and projects Popular

💎 Issue 416 - Ruby typing 2024: RBS, Steep, RBS Collections, subjective feelings

Thursday, May 9, 2024

This week's Awesome Ruby Newsletter Read this email on the Web The Awesome Ruby Newsletter Issue » 416 Release Date May 09, 2024 Your weekly report of the most popular Ruby news, articles and

💻 Issue 416 - Part 5: Building a Simple Web Server with Node.js

Thursday, May 9, 2024

This week's Awesome Node.js Weekly Read this email on the Web The Awesome Node.js Weekly Issue » 416 Release Date May 09, 2024 Your weekly report of the most popular Node.js news, articles and

💻 Issue 334 - Why React Query?

Thursday, May 9, 2024

This week's Awesome React Weekly Read this email on the Web The Awesome React Weekly Issue » 334 Release Date May 09, 2024 Your weekly report of the most popular React news, articles and projects

📱 Issue 413 - Swift’s native Clocks are very inefficient

Thursday, May 9, 2024

This week's Awesome Swift Weekly Read this email on the Web The Awesome Swift Weekly Issue » 413 Release Date May 09, 2024 Your weekly report of the most popular Swift news, articles and projects