Inheriting a Sloppy Codebase: A Practical Guide to Wrangling Chaotic Code
summary
Get a copy on a new branch, create a disposable virtualenv, run tests under coverage.py and write broad integration tests for every view plus unit tests for business-critical logic, aiming for 95% coverage. Use an IDE with refactoring and a debugger (PyCharm, pdb/ipdb), lint with pylint/pep8, then audit and trim third-party packages — a real case removes 133 dependencies — freeze requirements, upgrade libraries, and reorganize apps (move models first), eliminate hidden signals/context-processor middleware side effects, and document while you change.
AI-written summary · about
chapters (12)
- 0:00Introduction and context
- 0:44Origins of sloppy code
- 6:12Essential developer tools
- 10:53Initial project setup
- 13:10Establishing test coverage
- 18:27Dependency management
- 22:12Refactoring the monolith
- 26:13Fixing distributed apps
- 27:30Signal and receiver audit
- 31:13Middleware and context
- 34:09Documentation and best practices
- 38:45Conclusion
related talks
21mTeach Your Old Code New Tricks: Automating Code Quality in Large Projects
38mDeleting Code Is Hard And You Should Do It
30mAutomating Code Quality
35mUpgrading Legacy Projects: Lessons Learned
22mPublishing well formed Python packages
01h 01mDoes Your Codebase Spark Joy?
32mFrom Unfamiliar to Confident: A Guide to Taking Over Someone Else's Project
29mManaging the code quality of your project. Leave the past behind: Focus on new code.
