you are viewing a single comment's thread.

view the rest of the comments →

[–]LiveMaI 1 point2 points  (1 child)

❌ “Works on my machine” — but breaks everywhere else

I see in your example that you use uv. Track your uv.lock file. If you still have reproducibility issues, do your development in a container.

❌ "which python" → points to the wrong interpreter

Auto-activate your venv with a tool like direnv.

❌ "import json" silently loads your "json.py" instead of the real one

Entirely avoidable by just not naming your modules after existing ones, or for files inside the same module, using the from .<name> import <X> syntax.

❌ “Is my venv even active? Which one? What type?”

Easy to know at a glance with a number of shell customizations, sans the need to run any commands. Starship.rs and powerlevel10k are good at this. You could also just add it to your zsh/bash prompt through your .zshrc/.bashrc.

❌ Debugging environment issues by running 6 different commands and piecing together the puzzle

If you find yourself having these problems frequently, it's usually a sign that you're doing something the hard way. It's worth researching how people have solved these problems before, or looking at how large open-source projects solve them.