[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

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

Saturday, June 25, 2022

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.

[Python Dependency Pitfalls] A total mess?

Saturday, June 25, 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

[PythonistaCafe] What makes PythonistaCafe different

Saturday, June 25, 2022

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

[Python Dependency Pitfalls] The Iceberg

Saturday, June 25, 2022

Hey there, The other day I read this quote from a Python developer that made me stop and think: "As a noob with a little programming knowledge already, I've found setting up and installing

[Python Dependency Pitfalls] "Re-inventing the wheel" disease

Friday, June 24, 2022

Hey there, PyPI, the Python packaging repository, now contains more than 100000 third-party packages in total. That's an *overwhelming* number of packages to choose from... And this feeling of

You Might Also Like

SWLW #595: My role as a founder CTO, AI Product Management, and more.

Friday, April 19, 2024

Weekly articles & videos about people, culture and leadership: everything you need to design the org that makes the product. A weekly newsletter by Oren Ellenbogen with the best content I found

The bill to ban TikTok is barreling ahead

Friday, April 19, 2024

The Morning After It's Friday, April 19, 2024. The bill that could ban TikTok in the United States inches closer to becoming law. The legislation passed the House of Representatives last month,

Digest #134: TDD with Serverless, Terraform AI Conversions, K8s Cost Metrics & OpenTofu Response

Friday, April 19, 2024

Learn to convert Terraform templates, deploy SSR on AWS Amplify, and apply TDD to Serverless. Gain insights on PostgreSQL, microfrontends, and secure APIs. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Akira Ransomware Gang Extorts $42 Million; Now Targets Linux Servers

Friday, April 19, 2024

THN Daily Updates Newsletter cover Webinar -- The Future of Threat Hunting Is Powered by Generative AI From Data to Defense: Step Into the Next Era of Cybersecurity with CensysGPT Download Now

ASP.NET Core News - 04/19/2024

Friday, April 19, 2024

View this email in your browser Get ready for this weeks best blog posts about ASP.NET Core! This newsletter is sponsored by elmah.io - the most advanced, yet so simple to set up, error logging and

Post from Syncfusion Blogs on 04/19/2024

Friday, April 19, 2024

New blogs from Syncfusion Syncfusion Prepares for MS Build 2024 with Cloud-Ready Solutions on Azure Marketplace By gingerr Syncfusion offers cloud-ready solutions in Azure Marketplace for MS Build 2024

Hacker Newsletter #696

Friday, April 19, 2024

The greatest value of a picture is when it forces us to notice what we never expected to see. //John W. Tukey hackernewsletter Issue #696 // 2024-04-19 // View in your browser #Favorites Unlock your

Google's massive reorg 🧑‍🤝‍🧑, Meta's Llama 3 launch 🤖, China bans WhatsApp 💬

Friday, April 19, 2024

Google has reorganized its Android, Chrome, and Google hardware divisions Sign Up |Advertise|View Online TLDR TLDR 2024-04-19 📱 Big Tech & Startups Meta's battle with ChatGPT begins now (5

Is your Notes app completely disorganized?

Friday, April 19, 2024

Hi there, Is your Notes app completely disorganized? In a recent survey we found that 77% of our readers would like to learn how to better organize the notes on their iPhone. That's why we're

Data Science Weekly - Issue 543

Friday, April 19, 2024

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