←back to thread

741 points chirau | 6 comments | | HN request time: 0.21s | source | bottom
1. marifjeren ◴[] No.44359869[source]
Seems a lot of people like this and are happy about it, but I for one am tired of the proliferation of python package management tools.

Many languages have many package management tools but most languages there are one or two really popular ones.

For python you just have to memorize this basically:

- Does the project have a setup.py? if so, first run several other commands before you can run it. python -m venv .venv && source .venv/bin/activate && pip install -e .

- else does it have a requirements.txt? if so python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt

- else does it have a pyproject.toml? if so poetry install and then prefix all commands with poetry run

- else does it have a pipfile? pipenv install and then prefix all commands with pipenv run

- else does it have an environment.yml? if so conda env create -f environment.yml and then look inside the file and conda activate <environment_name>

- else I have not had to learn the rules for uv yet

Thank goodness these days I just open up a cursor tab and say "get this project running"

replies(3): >>44360620 #>>44362252 #>>44363935 #
2. kortex ◴[] No.44360620[source]
uv handles most, if not all, of those cases.

> - else does it have a pyproject.toml? if so poetry install and then prefix all commands with poetry run

That's not even correct. Not all projects with pyproject.toml use poetry (but poetry will handle everything with a pyproject.toml)

Just try uv first. `uv pip install .` should work in a large majority of cases.

pipenv is on the way out. bare `setup.py` is on the way out. `pyproject.toml` is the present and future, and the nice thing about it is it is self-describing in the tooling used to package.

replies(2): >>44360824 #>>44362185 #
3. marifjeren ◴[] No.44360824[source]
> That's not even correct. Not all projects with pyproject.toml use poetry

I didn't say "all projects with pyproject.toml use poetry"

4. eyegor ◴[] No.44362185[source]
I wish setup.py was actually on the way out, but sadly, it's the only straightforward way to handle packages that use cython or interop. In these cases, libraries use setup.py to compile the dll/so/dylib at install time. Naturally this is a bit of nightmare fuel since installing gets arbitrary code execution privileges but there's no real standard for privileges in python package installs.
5. cruffle_duffle ◴[] No.44362252[source]
Uv will quickly become the dominant player in the space. It’s that much better. There is no reason to not use it.
6. calmoo ◴[] No.44363935[source]
Or just use uv and then you don't have to think about any of that.