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

Key phrases

Older messages

[Sublime + Python Setup] why Atom can’t replace Sublime

Saturday, July 9, 2022

Hey there, "In a nutshell, Atom is a Sublime Text editor that just got better." When I read this quote I got so worked up I nearly fell off my chair. Because every time I've tried Atom or

[Python Mastery] What Pythonistas can learn from bestselling authors

Saturday, July 9, 2022

Hey there, I just finished reading Stephen King's "On Writing." It's a great little book where he shares some of the writing advice and stories he's picked up over the course of

[PythonistaCafe] Q&A

Friday, July 8, 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

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

Friday, July 8, 2022

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

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

Friday, July 8, 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

SimulaVR Has Been Subpoenaed by Meta Platforms, Inc — What does the ??!??! operator do in C? — and Kim Jung Gi has died

Thursday, October 6, 2022

Issue #912 — Top 20 stories of October 07, 2022 Issue #912 — October 07, 2022 You receive this email because you are subscribed to Hacker News Digest. You can open it in the browser if you prefer. 1

Data Science Weekly - Issue 463

Thursday, October 6, 2022

Curated news, articles and jobs related to Data Science. Keep up with all the latest developments Email not displaying correctly? View it in your browser. Issue #463 October 06 2022 Editor's Picks

Everything you wanted to know about Google Fall Event 2022 (but were afraid to ask)

Thursday, October 6, 2022

TechCrunch Newsletter TechCrunch logo The Daily Crunch logo By Christine Hall and Haje Jan Kamps Thursday, October 06, 2022 Hi again! Wondering if you have a preference between “Friday Eve,” “Pre-

💎 Issue 333 - Introducing Our New Low-Cost Plans [Heroku]

Thursday, October 6, 2022

This week's Awesome Ruby Newsletter Read this email on the Web The Awesome Ruby Newsletter Issue » 333 Release Date Oct 06, 2022 Your weekly report of the most popular Ruby news, articles and

💻 Issue 333 - Ten Years of TypeScript

Thursday, October 6, 2022

This week's Awesome JavaScript Weekly Read this email on the Web The Awesome JavaScript Weekly Issue » 333 Release Date Oct 06, 2022 Your weekly report of the most popular JavaScript news, articles

📱 Issue 327 - Just launched my first app!

Thursday, October 6, 2022

This week's Awesome iOS Weekly Read this email on the Web The Awesome iOS Weekly Issue » 327 Release Date Oct 06, 2022 Your weekly report of the most popular iOS news, articles and projects Popular

💻 Issue 326 - Refactoring a checksum until it runs 100 times faster

Thursday, October 6, 2022

This week's Awesome .NET Weekly Read this email on the Web The Awesome .NET Weekly Issue » 326 Release Date Oct 06, 2022 Your weekly report of the most popular .NET news, articles and projects

💻 Issue 333 - Article: The evolution of containers and why Docker is so complex — an overview for the many layers that structure the Docker engine

Thursday, October 6, 2022

This week's Awesome Node.js Weekly Read this email on the Web The Awesome Node.js Weekly Issue » 333 Release Date Oct 06, 2022 Your weekly report of the most popular Node.js news, articles and

💻 Issue 328 - Initial Rust support is now merged into the Linux kernel!

Thursday, October 6, 2022

This week's Awesome Rust Weekly Read this email on the Web The Awesome Rust Weekly Issue » 328 Release Date Oct 06, 2022 Your weekly report of the most popular Rust news, articles and projects

💻 Issue 251 - 16 Libraries You Should Know as a React Developer 💯🔥

Thursday, October 6, 2022

This week's Awesome React Weekly Read this email on the Web The Awesome React Weekly Issue » 251 Release Date Oct 06, 2022 Your weekly report of the most popular React news, articles and projects