[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

[PythonistaCafe] What makes PythonistaCafe different

Monday, July 5, 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] The Ctrl+s "Heisenbug"

Monday, July 5, 2021

"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

[Python Dependency Pitfalls] A total mess?

Sunday, July 4, 2021

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] How to become a happier & more productive Python dev

Sunday, July 4, 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] Q&A

Sunday, July 4, 2021

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

You Might Also Like

Just for Fun: 5-Card Poker Library Using C#, Visual Studio Copilot Tools Unified, More

Thursday, April 18, 2024

Home | News | How To | Webcasts | Whitepapers | Advertise .NET Insight April 18, 2024 THIS ISSUE SPONSORED BY: ■ SURVEYJS - JAVASCRIPT UI LIBRARIES FOR SURVEYS AND FORMS ■ dtSearch® - INSTANTLY SEARCH

I said no for 6 months. Then I said yes and 2x’d my income.

Thursday, April 18, 2024

Boy, was I wrong... ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Charted | U.S. Debt Interest Payments Reach $1 Trillion 💸

Thursday, April 18, 2024

US debt interest payments have surged past the $1 trillion dollar mark, amid high interest rates and an ever-expanding debt burden. View Online | Subscribe Presented by Voronoi: The New App From Visual

Daily Coding Problem: Problem #1416 [Hard]

Thursday, April 18, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Facebook. Given a string consisting of parentheses, single digits, and positive and

I tested Lenovo's dual-screen laptop - and man is it fun

Thursday, April 18, 2024

T-Mobile throttling internet; I ditched my AirPods Pro for Nothing; Selfie GIFs -- ZDNET ZDNET Tech Today - US April 18, 2024 placeholder I tested Lenovo's dual-screen laptop and it improved my

Issue 313 - Farewell Drew, thank you for the hard work!

Thursday, April 18, 2024

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 313 -

⚙️ Drake deepfake (again!)

Thursday, April 18, 2024

Plus: LinkedIn finally enter AI ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Web Tools #561 - Popover Modals, React Tools, Git/CLI, Uncats

Thursday, April 18, 2024

WEB VERSION Issue #561 • April 18, 2024 Advertisement $47 Million in Artwork Sales Equals Profits for These Everyday Investors — Masterworks is taking on the billionaires at their own game, buying up

Google fires 28 staff for protesting its contracts with Israel

Thursday, April 18, 2024

Google's contract with Israel has left many employees unhappy View this email online in your browser By Alex Wilhelm Thursday, April 18, 2024 Welcome to TechCrunch AM! It's been a busy morning,

PHPWeekly April 18th 2024

Thursday, April 18, 2024

Curated news all about PHP. Here's the latest edition Is this email not displaying correctly? View it in your browser. PHP Weekly 18th April 2024 Hi everyone, If it's the latest news and