Choosing a Dependency Approach
It’s okay if you haven’t chosen a dependency management approach yet.
This page will help you choose one.
A Text File: the Simplest Option
Tip
Pick this if the other sections seem overwhelming
To start using a requirements.txt to manage dependencies:
Go to your project’s top-level folder
Save an empty file to it with the name
requirements.txtCopy-and-paste a line from In requirements.txt
If everything works after pip install -r requirements.txt, then add
the new file to any version control you’re using. That’s it. You’re
done!
You can always upgrade to another approach if you end up needing more features.
The TOML: Power Without Too Much Magic
Do you want…
something just a bit fancier?
without too much magic or complex automation?
The TOML route is a solid choice. Although it’s more complicated than
requirements.txt, the added features make better for most projects.
The TOML configuration language:
Will be familiar if you’ve ever seen an INI file
Loads neatly into a Python
dictTends to be far easier to read than
JSON
To learn more, please see:
The Python Packaging User Guide’s doc on guide to writing a pyproject.toml
The Python Packaging Authority’s sample project
The tomli library
Tip
If you like examples, skip to the sample project !
Its pyproject.toml is very thoroughly commented!
I Want Only The Hippest Tools
For the latest in heavy-duty automation, check out one of the following:
Remember, they aren’t covered by the Fontknife doc. You’ll have to consult their documentation on how to manage dependencies instead.