Member-only story
Stop Developing Python Like It’s Still 2008: Modern Practices You Should Adopt 🚀
If you’ve been coding in Python for a while, you’ve likely noticed that some habits and tools from years ago are still lurking around in modern projects. Let’s update our approach and stop making our Python projects feel outdated. Here are some best practices to help you write cleaner, more maintainable code with the latest tools and standards.
1. Move Away from requirements.txt
and Embrace pyproject.toml
📦
The traditional approach of using requirements.txt
to manage dependencies is outdated. Instead, switch to using pyproject.toml
. Why? It’s a more versatile configuration file that allows you to organize your dependencies better, including groups like development and production dependencies.
With pyproject.toml
, you can easily manage your dependencies without having to create multiple files like dev-requirements.txt
. Plus, tools like pip understand it, making the transition smooth.
Resources to Learn More: Reddit Discussion on pyproject.toml
2. Use Modern Python Project Managers like Poetry or UV 🛠️
Ditch the old ways of managing Python environments and dependencies with pip and virtual…