[Python Dependency Pitfalls] Artisanal "from-scratch" development

Hey there,

The other day I got this question from Newsletter member Newvick in my email inbox:

~~~

I'm trying to get past the beginner's stage in Python and one problem I have is:

When do you use libraries/frameworks and when do you make things from scratch? (whether for learning or developing something for a client/work)

~~~

When to code functionality from scratch and when to use libraries, that's an important question.

There's a fine balance you need to strike here:

When I learned how to program I was "reinventing wheels" left and right—and it pushed my abilities forward quickly.

I was constantly writing all kinds of existing functionality from scratch and it was the right thing to do because it helped me grow my skills.

It was a great learning exercise.

But there comes a time in a developer's life when that strategy doesn't work so well any more:

Eventually I found that I wasn't learning as quickly anymore trying to build everything from scratch.

Plus my development pace was dog-slow.

I was spinning my wheels—and my productivity began to plateau.

Another downside is this:

It's difficult to work on a team when someone always wants to approach every single problem from first principles. It can drive coworkers and managers NUTS.

These days I try to use (good quality + well-documented!) third-party libraries where possible.

But again, you'll want to find a balance there:

For example, any professional chef worth their salt needs to learn how to make mayonnaise from scratch.

But eventually they'll know how to prepare it—and what great quality looks like.

From this point on buying pre-made mayo off the shelf can be a huge time saver:

In some dishes it simply WON'T make a difference on the end result.

It just *takes longer* to make everything from scratch…

Bringing it back to Python dependency management, here's my general rule of thumb:

"Only consider 'write from scratch' if time is NOT an issue. Otherwise use 3rd-party libraries and frameworks—but don't overdo it and only go for the trustworthy ones."

(Remember, you'll want to avoid another "left-pad" incident.)

Sometimes it's just tough as nails to strike the right balance here…and there's so much more to talk about on this topic.

If you want to dig deep and see how to make the leap from "amateur cook" to "professional chef" as a Pythonista, my Managing Python Dependencies course shows you how to get there.

It includes a complete step-by-step workflow for researching packages and making Python dependency decisions (and explaining them to your team, manager, or client).

Click the link below to learn more:

realpython.com/products/managing-python-dependencies/

— Dan Bader

P.S. "Re-inventing the wheel" disease was really something I struggled with as a fledgling dev. I'll show you how I got over it tomorrow.

Older messages

Why you need an efficient Python development setup

Monday, November 23, 2020

Hey there, What many Python developers don't realize is how much having a smooth development setup impacts their productivity. It takes hard and painstaking work to get a great setup for writing

[Python Dependency Pitfalls] What dev managers expect from Python candidates

Monday, November 23, 2020

Hey there, My friend Og is a senior manager at Red Hat and works with a large team of developers and quality engineers using Python. I got to pick his brain on what he thought were the most important

[Python Dependency Pitfalls] A total mess?

Friday, November 20, 2020

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

the holy grail of Pythonic exception handling?

Friday, November 20, 2020

Hey there, I'm surprised by it time and time again, but with programming, you truly *never* stop learning new things: The other day PythonistaCafe member Greg posted a new discussion thread where

Can I ask a favor?

Friday, November 20, 2020

Hey there, it's Dan... I noticed that you decided to pass on Managing Python Dependencies with Pip and Virtualenv—that's totally cool. I'm wondering if you could help me out by answering

You Might Also Like

Black Friday Giveaway @ Real Python

Thursday, November 28, 2024

Hey there, Just wanted to let you know that we're doing a special giveaway for Black Friday this week at Real Python 🎁🎉 You can get Python education resources worth over $1210, including three

Dispatch 019 🦃

Thursday, November 28, 2024

Watching the Parade • Paying for the Parade • Pirate TV Raid • US v. Microsoft Round 2 • Trump's Anti-Antitrust? • Google Anti-Antitrust The Spyglass Dispatch is a free newsletter sent out daily on

PHPWeekly November 28th 2024

Thursday, November 28, 2024

Curated news all about PHP. Here's the latest edition Is this email not displaying correctly? View it in your browser. PHP Weekly 28th November 2024 Hi everyone, It's Thanksgiving and Black

Widgets With Glance: Beyond String States

Thursday, November 28, 2024

View in browser 🔖 Articles Widgets With Glance: Beyond String States I had read about using a CustomGlanceStateDefinition but I couldn't find much about it in the official documentation so here is

Post from Syncfusion Blogs on 11/28/2024

Thursday, November 28, 2024

New blogs from Syncfusion All Things Open 2024 Takeaways, Part 3: Freedom vs. Sustainability By Marissa Keller Outten The role of sustainability and freedom in open source was discussed at the All

Top Tech 🏆 HTC VIVE Focus Vision Review — These Clip-on Earbuds Are Simple and Sound Good

Thursday, November 28, 2024

Also: Plugable Portable Monitor Review, and More! How-To Geek Logo November 28, 2024 😎 Question Reality If you're wondering what to buy on Black Friday or during the holiday rush, this week we

Hackers Exploit Popular Game Engine to Distribute Cross-Platform Malware

Thursday, November 28, 2024

THN Daily Updates Newsletter cover Programming with GitHub Copilot: Write Better Code--Faster! ($48.00 Value) FREE for a Limited Time Accelerate your programming with the most popular AI coding tool on

Edge 452: The AI Magic Behind Google's NotebookLM Audio Features

Thursday, November 28, 2024

How does NotebookLM generate such cool podcasts? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Check Out These Awesome Gifts!

Thursday, November 28, 2024

Let us help you check one thing off your to-do list with this guide to the best gifts for the holiday season. Make the holidays a little brighter with these great gift options. From health and wellness

🚀 Accelerate Your Growth As a Software Architect

Thursday, November 28, 2024

What students are saying about my courses More than 4300+ students already completed my courses. And they gave them a 4.9/5 ⭐ rating. I'd love to see your success story next on this wall of