pip-compile-multi icon indicating copy to clipboard operation
pip-compile-multi copied to clipboard

Pull requirements from pyproject.toml

Open tomprince opened this issue 4 years ago • 5 comments

I have a project that is using flit and PEP 621 configuration for declaring dependencies. I'd like to be able to use pip-compile-multi to generate minimal compatible requirements files for it.

Currently, I have a script

pip-compile -q --allow-unsafe pyproject.toml -o requirements/base.txt
pip-compile -q --allow-unsafe pyproject.toml --extra test -o requirements/test.txt
pip-compile -q --allow-unsafe pyproject.toml --extra dev --extra test -o requirements/dev.txt

for pinning the requirements, but I'd prefer to use pip-compile-multi in some way, so:

  • the requirements files don't have duplication
  • there are no conflicts between the generated requirements.

tomprince avatar Sep 07 '21 09:09 tomprince

I'm not using pyproject.toml in any of my projects, but I see the value in the standard. Having pip-compile-multi parse input requirements from pyproject.toml makes sense to me. I can see it as an extra option --pyproject pyproject.toml. Would you be interested in exploring this feature?

peterdemin avatar Sep 07 '21 19:09 peterdemin

Yes, absolutely. I don't use flit but followed the official packaging tutorial which promotes the usage of pyproject.toml and declaring dependencies inside it.

I would even suggest that pip-compile-multi read it by default, and then tries to find requirements/base.in as a fallback. What do you think about this approach?

Cf https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#dependencies-optional-dependencies

cbenz avatar Mar 06 '23 15:03 cbenz

I'd be interested in this feature too, thumbs up from me 👍 We are using Hatch, in case you need to know.

lord-haffi avatar Mar 19 '24 14:03 lord-haffi

I'm all for this, but don't have time to implement it. I can review/merge a PR and make a release, though.

peterdemin avatar Mar 19 '24 18:03 peterdemin

I'm willing to look into this but can't promise to have enough time for this either. So no stress. Btw, great project 😊 Makes it a lot easier to manage multiple environments 👍

lord-haffi avatar Mar 19 '24 19:03 lord-haffi