News for hackers. Stuff that matters.
Re:Free-threaded CPython is ready to experiment with by simonw on Friday July 12, 2024 @06:34PM (#40950079)
"I don't want a bunch of venvs"

That's your problem right there.

Virtual environments are the Python ecosystem's solution to the problem of wanting to install different things on the same machine that have different conflicting requirements.

If you refuse to use virtual environments and you install more than one separate Python project you're going to run into conflicting requirements and it's going to suck.

Have you tried pipx? If you're just installing Python tools (and not hacking on them yourself) it's fantastic - it manages separate virtual environments for each of your installations without you having to think about them (or even know what a virtual environment is).

Re:Free-threaded CPython is ready to experiment with by arp242 on Friday July 12, 2024 @06:57PM (#40950213)
Managing a farm of virtualenvs and mucking about with my PATH doesn't address the user-installable problem at all. And it seems there's a new tool to try every few months that really will fix all problems this time.

And maybe if you're a Python developer working on the code every day that's all brilliant. But most people aren't Python developers, and I just want to try that "Show HN" project or whatnot.

Give me a single command I can run. Always. For any project. And that always works. If you don't have that then your build system needs work.

Re:Free-threaded CPython is ready to experiment with by simonw on Friday July 12, 2024 @08:31PM (#40950743)
"Give me a single command I can run. Always. For any project. And that always works."

    pipx install X
Re:Free-threaded CPython is ready to experiment with by arp242 on Saturday July 13, 2024 @03:35AM (#40952474)
Right so; I'll try that next time. Thanks. I just go by the very prominent "pip install X" on every pypi page (as well as "pip install .." in many READMEs).
Re:Free-threaded CPython is ready to experiment with by simonw on Saturday July 13, 2024 @10:06AM (#40954190)
Yeah, totally understand that - pipx is still pretty poorly known by people who are active in Python development!

A few of my READMEs start like this: https://github.com/simonw/paginate-json?tab=readme-ov-file#i...

    ## Installation

    pip install paginate-json

    Or use pipx (link to pipx site)

    pipx install paginate-json
But I checked and actually most them still don't even mention it. I'll be fixing that in the future.
Re:Free-threaded CPython is ready to experiment with by arp242 on Sunday July 14, 2024 @09:08PM (#40964510)
Out of the 3 things I want to install 2 don't work. Both of these seem bugs in pipx so I reported one, but the feedback was borderline hostile and it ended up being closed with "unclear what you want". I'm not even going to bother reporting the other bug.

So whatever the goals are, it doesn't really work. And in general pipx does not strike me as a serious project.

Re:Free-threaded CPython is ready to experiment with by pletnes on Saturday July 13, 2024 @08:19AM (#40953649)
Pipx is great! Although, I always seem to have to set up PATH, at least on windows?
Re:Free-threaded CPython is ready to experiment with by Ringz on Saturday July 13, 2024 @01:27AM (#40951996)
That single command is pipx.
Re:Free-threaded CPython is ready to experiment with by zo1 on Saturday July 13, 2024 @06:56AM (#40953273)
I could say the exact same stuff about NodeJs, c++, go, rust, php, etc. All of these are easy to use and debug and "install easily" when you know them and use them regularly, and the opposite if you're new. Doubly-so if you personally don't like that language or have some personal pet peeve about it's choices.

Guys let's not pretend like this is somehow unique to python. It's only until about a few years ago that it was incredibly difficult to install and use npm on windows. Arguably the language ecosystem with the most cumulative hipster-dev hours thrown at it, and it still was a horrible "dev experience".

Re:Free-threaded CPython is ready to experiment with by lordfrikk on Tuesday July 16, 2024 @04:10AM (#40974495)
That does not match my experience. I've been working with Python for a year or so and the packaging problems come up every now and then still.

I've installed/built a few packages written in Go and Rust specifically and had no problems.

Re:Free-threaded CPython is ready to experiment with by guhidalg on Friday July 12, 2024 @07:00PM (#40950232)
Normal users who just want to run some code shouldn't need to learn why they need a venv or any of its alternatives. Normal users just want to download a package and run some code without having to think about interfering with other packages. Many programming languages package managers give them that UX and you can't blame them for expecting that from Python. The added step of having to think about venvs with Python is not good. It is a non-trivial system that every single Python user is forced to learn, understand, and the continually remember every time they switch from one project to another.
Re:Free-threaded CPython is ready to experiment with by nine_k on Friday July 12, 2024 @08:21PM (#40950672)
This is correct. The whole application installation process, including the creation of a venv, installing stuff into it, and registering it with some on-PATH launcher should be one command.

BTW pyenv comes relatively close.

Re:Free-threaded CPython is ready to experiment with by simonw on Friday July 12, 2024 @08:32PM (#40950748)
I agree with that. Until we solve that larger problem, people need to learn to use virtual environments, or at least learn to install Python tools using pipx.
Re:Free-threaded CPython is ready to experiment with by VagabundoP on Saturday July 13, 2024 @03:32PM (#40956281)
sudo apt install pipx

pipx install package_name

Takes care of the venv and the script/app path is added to system path.

Re:Free-threaded CPython is ready to experiment with by kallapy on Saturday July 13, 2024 @07:55AM (#40953537)
I reject the virtual environments and have no issues. On an untrusted machine (see e.g. the recent token leak):

  /a/bin/python3 -m pip install foo
  /b/bin/python3 -m pip install bar
The whole venv thing is overblown but a fertile source for blogs and discussions. If C-extensions link to installed libraries in site-packages, of course they should use RPATH.
Re:Free-threaded CPython is ready to experiment with by imtringued on Saturday July 13, 2024 @02:02PM (#40955671)
Pythons venvs are a problem to the solution of solving the dependency problem. Consider the following: it is not possible to relocate venvs. In what universe does this make sense? Consider a C++ or Rust binary that would only run when it is placed in /home/simonw/.