0

I ran into a problem when trying to figure out how to specify dependencies for a python application which uses pyproject.toml.
What is the best practice when it comes to installing applications? Couple of approaches I am considering:

  • have requirements.txt with resolved and pinned dependencies, have dynamic dependencies in pyproject.toml, which would reference this requirements file.
  • pin only top level dependencies in pyproject.toml, without any requirements file
  • have requirements.txt as in first case, which would again be referenced as dynamic dependencies in pyproject.toml, but also have optional dev dependencies, which would contain unpinned top level dependencies

Things I am looking for is reproducibility, but also minimal manual work needed when developing the app. Third approach makes the most sense to me, as it would only require pip freeze before pushing my new changes. I have used pyproject.toml only for developing python libraries so far (well, this is actually the first app I am creating in python in general).
I have been playing around with poetry, but would be more interested how to do it with minimal set up that is pip + pyproject.toml.

user430953
  • 191
  • 2
  • 19
  • 1
    We have to agree that the Python packaging ecosystem is quite good at "libraries", but comparatively bad at "applications". So my first advice would be to try and look beyond just standard, mainstream Python tools if you want to get serious about packaging a Python application. -- Anyway... My vote would be for your first suggestion: only direct dependencies with loose/optimistic version constraints in `pyproject.toml` and all dependencies with pinned versions in `requirements.txt`. If one wants, they can use the `requirements.txt`, but it should not be the default. – sinoroc Nov 14 '22 at 17:38

0 Answers0