News for hackers. Stuff that matters.
Re:Pipenv: Promises a Lot, Delivers Little (2020) by ptx on Saturday July 16, 2022 @12:38PM (#32119646)
> Also the requirements.txt file tends to get cluttered with non top level dependencies that make upgrading your dependencies an herculean task. Instead on poetry you define your top level dependencies in your pyproject.toml and all the actual pinned dependencies will be compiled into a poetry.lock file.

This has now been solved [1] in pip, so no third-party tool is needed. Put your pinned dependencies in constraints.txt and your top-level dependencies plus the line "-c constraints.txt" in requirements.txt.

[1] https://pip.pypa.io/en/stable/user_guide/#constraints-files

Re:Pipenv: Promises a Lot, Delivers Little (2020) by partido3619463 on Saturday July 16, 2022 @02:28PM (#32120578)
Constraints are not the same thing. Poetry locks the entire dependency closure. You can install with “no-deps” option, but then you have to specify specific versions of every dependency in requirements.txt
Re:Pipenv: Promises a Lot, Delivers Little (2020) by ptx on Saturday July 16, 2022 @02:43PM (#32120734)
What do you mean? If you do "pip freeze >constraints.txt", that locks the versions of all installed packages, no matter where they came from.

As an example, let's create a venv and install some older versions of Django and its dependencies (current versions are 0.4.2, 3.5.2 and 4.0.6)

  $ python3 -m venv env1
  $ ./env1/bin/pip install sqlparse==0.4.0 asgiref==3.5.0 django=4.0.0
...and also Flask just to complicate the constraints file for the example:

  $ ./env1/bin/pip install flask
Lock all dependency versions in constraints.txt:

  $ ./env1/bin/pip freeze >constraints.txt 
Create a requirements file that specifies just "django" and references the constraints file:

  $ echo '-c constraints.txt' >requirements.txt
  $ echo 'django' >>requirements.txt

  $ cat requirements.txt 
  -c constraints.txt
  django

  $ cat constraints.txt 
  asgiref==3.5.0
  click==8.1.3
  Django==4.0
  Flask==2.1.3
  itsdangerous==2.1.2
  Jinja2==3.1.2
  MarkupSafe==2.1.1
  sqlparse==0.4.0
  Werkzeug==2.1.2
Now we can create another venv with the exact same versions of Django and all its dependencies (but not Flask or its dependencies) using just pip and the requirements file:

  $ python3 -m venv env2
  $ ./env2/bin/pip install -r requirements.txt 
  $ ./env2/bin/pip freeze
  asgiref==3.5.0
  Django==4.0
  sqlparse==0.4.0
Re:Pipenv: Promises a Lot, Delivers Little (2020) by ok_dad on Saturday July 16, 2022 @07:32PM (#32122917)
That’sa lot more than just

    poetry init
    poetry add x y z
    
Then later

    poetry install
And maybe

    poetry remove y