It's what happens when there's not enough time during the day...

Mar 13, 2023 - Mar 17, 2023
Online

so much depends upon... your python app's dependencies

Presented: Mar 13, 2023

WATCH THE VIDEO

Abstract

How do you keep track of your project’s building blocks? Is it enough just pinning your dependencies in a requirements.txt file? Or is there any reason to learn one (or any) in a myriad of dependency management tools?

It depends.

Untangling the complexity of this topic might not be worth it for certain small projects. But there are a lot of reasons why learning about (and using) a dependency management tool will help you in the future.

Find out why embracing proper dependency management can help your project’s predictability, sustainability, security, and yes, even simplicity. Learn how you can use a tool like pdm to help accomplish these goals.

Notes

Great Poem

William Carlos Williams

so much depends
upon

a red wheel
barrow

glazed with rain
water

beside the white
chickens

Copycat Poem

Poet By Night (aka Python By Night)

so much depends
upon

your requirements.txt
file

pinned with library
versions

beside your venv
folder

Python Resources

Some Tools

Keep track of dependencies:

Some package managers:

Brett Cannon has a great write up about pyproject.toml and what it is for.

With pipx, you can install and run python applications in isolated environments. It's very useful if you have CLI applications that you use on all your projects. Instead of installing them every single time in each of those environments, you can isolate them with pipx.

See more: https://pypa.github.io/pipx/

PEP

Python Enhancement Proposals (PEP)

Other Resources

Talk Python (Michael Kennedy) recently had Ofek Lev on the show. He is the creator of Hatch. This is a good introduction to the tool. I highly recommend watching!

Pamela Anderson writes about how she manages her Python dependencies for web projects.

Brett Cannon also wrote about where virtual environments come from.

If you want a little bit more control over dependency management, and don't want to depend on the opinionated tools mentioned above, you could also use pip-tools. Gabriel Augendre writes about how to use pip-tools for Python dependencies management.

The Big List of Python Packaging and Distribution Tools - A website that lists and describes a many, many tools around python packaging (including the ones mentioned here), maintained by Chad Smith.

Oh, and I guess I've written about using PDM as a dependency manager too!

Credits