You can read the elaborate version of this as a blog post
When starting a new python project, the “hypermodern” python ‘template’ is a popular choice. Its style is opinionated and strict, and it brings a consistent style and today's best practices. How do I bring my legacy codebase up to this standard?
A consistent style and standard and the consistent use of the same tools in all your code, makes it easier to reason about, reduces context switching, thus reducing waste (in the LEAN sense). A clean environment is good for your health and safety, enabling you to deliver quality faster.
This talk goes deeper into how to modernize your legacy codebase to reduce your technical debt, to make it easier for you to tackle the real challenges without ever having to discuss a style guide again. It will provide tips, tricks and tools to make your “hypermodernization” effort as smooth and easy as possible.
The most important thing I have done as a programmer in recent years is to aggressively pursue static code analysis. Even more valuable than the hundreds of serious bugs I have prevented with it is the change in mindset about the way I view software reliability and code quality.
-- John Carmack
- Awesome Python Code Formatters
- Awesome Flake8 Extensions
- Awesome Python Typing
- Awesome Python Testing
- Awesome PyTest
- Bandit is a tool designed to find common security issues in Python code.
- GuardDog is a CLI tool that allows to identify malicious PyPI packages.
- Safety checks Python dependencies for known security vulnerabilities and suggests the proper remediation for vulnerabilities detected.
A Tale of Two Kitchens Hypermodernizing Your Codebase.
A Tale of Two Kitchens - Hypermodernizing Your Python Code Base
EuroPython 2022 PyCon Ireland 2022
EuroPython 2022 featured related talks about tools and techniques I only touched on in my talk.
- Clean Architectures in Python - presented by Leonardo Giordani
- Automate cleaning code in few easy steps! - presented by Ester
- Automated Refactoring Large Python Codebases - presented by Jimmy Lai
- Lint All the Things! - presented by Luke Lee
- Scalpel: The Python Static Analysis Framework - presented by Jiawei Wang
- Property-based testing the Python way - presented by Emma Saroyan
- Managing the code quality of your project. Leave the past behind: Focus on new code - Andrea Guarino
- Protocols - Static duck typing for decoupled code - presented by Ran Zvi
typing.Protocol
: type hints as Guido intended - presented by Luciano Ramalho
- What is Code Quality? Lessons learned in over 10 years of helping engineering teams create high quality software.
- Type Annotation via Automated Refactoring
- Tips for clean code in Python
- Tools for rewriting Python code
- Static Analysis at Scale: An Instagram Story
While most of my 'hypermodernizing' was done on proprietary code, there is a good example in pygeoif, which was brought up to the standard 10 years after the 0.1 version was released. The diff is not very helpful, almost every line was touched in the end, but you can compare the version 0.6 to the current implementation.
This is a git repository, treat it as one. If you have questions, corrections or additions do not hesitate to join the discussion, create an issue or a pull request ;-)