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

Tuesday, April 5, 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

[Sublime + Python Setup] The Ctrl+s "Heisenbug"

Tuesday, April 5, 2022

"What the **** is going on?!" I heard Keith yell. Returning from my lunch break and in a helpful mood I grabbed my coffee mug and shuffled over to my coworker's desk. "What's

[PythonistaCafe] Q&A

Monday, April 4, 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

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

Monday, April 4, 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.

[PythonistaCafe] What's in PythonistaCafe for you?

Sunday, April 3, 2022

Hey there, A couple of years ago I'd become quite interested in martial arts. Hours upon hours of watching "The Karate Kid" growing up must've taken their toll on me... And so, I

You Might Also Like

Python Weekly - Issue 647

Thursday, April 25, 2024

View this email in your browser Python Weekly Welcome to issue 647 of Python Weekly. Let's get straight to the links this week. From Our Sponsor Get Your Weekly Dose of Programming A weekly

Web Tools #562 - Voilà Review, CSS Tools, Media, React Native

Thursday, April 25, 2024

WEB VERSION Issue #562 • April 25, 2024 The following is a paid product review for Voilà, an AI assistant for the browser that enables you to improve your writing, coding, brainstorming, and research

Everyone wants to build the AI dev tool of the future

Thursday, April 25, 2024

A new startup called Augment has raised north of $250 million to build AI-powered dev tools. View this email online in your browser By Alex Wilhelm Thursday, April 25, 2024 Welcome to TechCrunch AM!

7 reasons to use Copilot over ChatGPT

Thursday, April 25, 2024

Coros Vertex 2S; Top 5 news apps; New Yeedi M12 Pro+ -- ZDNET ZDNET Tech Today - US April 25, 2024 placeholder 7 reasons I use Copilot instead of ChatGPT I reach for Copilot every day, and here's

Why they signed up for my Private AI Mentorship

Thursday, April 25, 2024

There are 3 reasons: use cases, accountability, and time. ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

wpmail.me issue#664

Thursday, April 25, 2024

wpMail.me wpmail.me issue#664 - The weekly WordPress newsletter. No spam, no nonsense. - April 24, 2024 Is this email not displaying correctly? View it in your browser. News & Articles WordPress

📧 Modular Monolith Architecture is now LIVE! 🎉

Thursday, April 25, 2024

​ MMA is now LIVE! The day has finally come. ​Modular Monolith Architecture is now open for enrollment. ​ I can't wait for you to see everything I prepared! 10 in-depth chapters 60+ high-quality

Testing the Rabbit R1's AI assistant

Thursday, April 25, 2024

The Morning After It's Thursday, April 25, 2024. Back in January, startup Rabbit revealed its first device at CES 2024. The R1 is an adorable, vibrant orange AI machine with a camera, scroll wheel,

Zero-Day Alert: State-Sponsored Hackers Exploting Two Cisco Flaws for Espionage

Thursday, April 25, 2024

THN Daily Updates Newsletter cover Coding with AI For Dummies ($18.00 Value) FREE for a Limited Time Boost your coding output and accuracy with artificial intelligence tools Download Now Sponsored

Post from Syncfusion Blogs on 04/25/2024

Thursday, April 25, 2024

New blogs from Syncfusion How BoldSign Improved HR Operations at Syncfusion By Syncfusion HR Team Let's see how Syncfusion's BoldSign revolutionizes HR operations with seamless document