20
submitted 1 week ago* (last edited 1 week ago) by marmelab@programming.dev to c/python@programming.dev

So I recently inherited a legacy application that was a nightmare to maintain (tooling was clearly lacking and the codebase was pretty outdated). I quickly realized that if I ever wanted to actually enjoy working on it, I would have to give it a proper overhaul.

These are the 5 changes that had some of the biggest impact IMO:

  1. uv: Being new to the Python ecosystem, I didn't want to figure out pip vs poetry vs pyenv vs virtualenv, so I just used uv and let it handle all of that. One Rust-based tool that installs and pins Python versions, manages the venv automatically and locks deps in a uv.lock for reproducible builds. Installs are also a lot faster, which makes CI a lot less painful.

  2. Ruff:

Coming from JS, I really missed eslint --fix for automatically fixing linting issues and format code on save. Ruff brought that experience back. I know that there are plenty of linters and formatters in the Python ecosystem, but this one really stands out for me. Since it's built in Rust, it's super fast.

  1. Dependabot:

Instead of remembering to update dependencies every few months, I enabled Dependabot. It automatically opens PRs when updates are available and then CI tells me whether they're safe to merge. It takes only a couple of minutes to set up but saves a lot of maintenance.

  1. Pylance:

Without it, VS Code gives generic completions and never warns you about passing the wrong type until runtime. Pylance provides proper type-aware autocompletion, jump-to-definition (even in third-party libraries), inline documentation, and real-time type checking. I personally keep it on "basic" mode for legacy codebases, since "strict" surfaced hundreds of errors (thank you, but no thank you lol).

  1. Pydantic:

Pydantic is basically Python's Zod: you declare a model, pass your data in and get either a validated typed object or a ValidationError naming the exact field at fault. It really helped me keep the codebase clean, with one place defining the shape of the data instead of raw dicts floating around. I use it wherever data comes from outside, like API payloads, forms, and env vars with pydantic-settings, which fails at startup instead of mid-request.

None of these tools changed the application itself. But together they made working on it a lot less frustrating.

top 6 comments
sorted by: hot top new old
[-] eager_eagle@lemmy.world 9 points 1 week ago* (last edited 1 week ago)

good tooling, though pylance can be mostly replaced by pyrefly or ty today - both of which are much faster and don't enter "analyzing files" loop like I'd always have with pylance, or the CPU being pegged at 100%

[-] marmelab@programming.dev 2 points 1 week ago

Thanks, I'll look into them!

[-] logging_strict@programming.dev 2 points 1 week ago* (last edited 1 week ago)

Tools i recommend:

  • rebuff -- finds places in code to replace with better algorithms. Wanted a tool to recommend itertools and itertools-more usage, but achieve that. Chosen cuz it's not Rust.

  • typos -- fixes typos in both code and docs

  • mypy+pyright+stubtest -- need all of them. pyright phones home. mypy isn't enough it misses way too much.

  • pretty format YAML

  • cyclonedx-bom -- create software bill of materials

  • pip-licenses -- NOTICE.txt and licenses.json Answers question does my toolchain include virus licensed packages?

  • interrogate -- Any code documentation missing? Does not enforce documentation quality.

  • wreck -- sync requirements files; otherwise it's tedious (i'm the author)

[-] logging_strict@programming.dev 1 points 1 week ago

The OP mentioned dealing with user input via pydantic. Which acts schema-like. strictyaml does the same for YAML config files where runtime validated against a schema.

And here is why all the other config file formats are dodgy, why-not written by author of strictyaml (not me).

Disclosure: Author of types-strictyaml, logging-strict, pytest-logging-strict, and sphinx-external-toc-strict. So yes i drank the kool-aid, but welcome challenges to preference for YAML config file format over others.

[-] logging_strict@programming.dev 1 points 1 week ago* (last edited 1 week ago)

Dependabot got annoying. For logging-strict git repo, turned off dependency graph. Blindly updating mostly nodejs crap is insane, it's a supply chain attack waiting to happen.

Disclosure: author of logging-strict

[-] logging_strict@programming.dev 1 points 1 week ago* (last edited 1 week ago)
  • uv and ruff

If it can be helped, don't want Rust nor nodejs in my toolchain. Recommending to Python coders who are very likely not Rust or node.js experts is malpractice or unethical (call it what you may). If you had a problem with any non-Python packages would be at the mercy of non-Python communities. i'm struggling just with Python community black issue 2514 now you want us to broaden that struggle?

And if people are too dumb or lazy to learn how requirement file hierarchies work, perhaps they shouldn't be Python coders.

Disclosure: author of wreck

this post was submitted on 13 Aug 2026
20 points (91.7% liked)

Python

8017 readers
23 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 3 years ago
MODERATORS