top | item 39814630

(no title)

TomSwirly | 1 year ago

This is a truly, truly terrible idea. It adds several failure modes, some subtle so you can go a long way in a state of error, just so beginners can type `python` instead of e.g. `python3.10`.

Many developers, not just me, have a similar setup: we use virtual environments everywhere, and if you aren't in one, `python` doesn't even resolve to a symbol.

If I want to write a quick script with no dependencies, I directly call `python3.xx` on it. Otherwise, I create a virtualenv.

Yes, it's a bit harder for beginners, but from a huge amount of experience helping people who are starting up in programming, people have little issue in following a few more instructions. What demolishes beginners is getting into a bad state where nothing works and you don't know why.

discuss

order

rcarmo|1 year ago

This is not a terrible idea. It is a tool that makes it possible for people to either retrofit a newer version of Python onto an ageing OS or to develop for a specific older version of Python on a newer OS. If you don't need the features the tool uses, you shouldn't use it--I don't see why you're comparing it to virtualenvs, it provides completely different runtimes with a different engine and a standard library, and the ability to switch between those by just cd'ing to a folder with a .python-version file in them.

happymellon|1 year ago

Isn't this a completely different concept?

Virtual environments are for your installed dependencies, whilst pyenv is for installing python.

I have a client that uses Python X and another that strictly uses Python X+1.

The virtual environments are so that I can have the project dependencies installed and the pyenv lets different companies have different cadence for their Python upgrades.

I could be completely mistaken and mixing up my Python support utils as I've not had a client request Python for a couple of years.

wodenokoto|1 year ago

But how do I get a .venv with a new/different version of Python in your setup? And how do I add some kind of Python version requirement in my project?

hnfong|1 year ago

python3.xx -m venv .

fragmede|1 year ago

though, with openinterpreter, you can just ask it to fix your python and it'll help you out of a weird situation that you as an newbie don't understand. Still, node's node_modules implementation isn't a bad one, at the expense of disk space, you don't run into the same problems as you do python.