0

I am preparing a python package for distribution. Currently it only has setup.cfg and pyproject.toml files (with no setup.py or requirements.txt). Inside setup.cfg I have install_requires

setup.cfg:

...
[options]
...
python_requires = >=3.6
install_requires=
    requests>=2
    numpy>=1.13
    matplotlib>=2
    .
    .
    .
...

Now, do I still need to provide a requirements.txt with specific versions of dependencies and sub-dependencies? Even if it is not strictly needed, are there any benefits to doing so?


My thoughts currently:

When I use don't have a requirements.txt, it automatically installs the latest version of the required packages which are available in that version of pip. And my package is installing and running in the limited number of environments I tested.

I understand that putting specific version numbers for dependencies can lightly guard against any breaking changes made by a dependency.

On the other hand, dependencies may stop supporting a specific version of python. So if I generate requirements.txt in python 3.8, the specific version of that dependency may not be available in python 3.6.

Sriram
  • 390
  • 3
  • 9
  • 1
    requirement.txt and install_requires quite have different purpose. check it out this link this may help [--->](https://stackoverflow.com/questions/14399534/reference-requirements-txt-for-the-install-requires-kwarg-in-setuptools-setup-py) – abhi patil Nov 01 '21 at 15:54
  • @abhipatil Thank you. Since I am just the developer here, I shouldn't bother with `requirements.txt`. I wonder why so many packaging tutorials talk about `requirements.txt`. Should have just stuck to the Official packaging guidelines. – Sriram Nov 01 '21 at 16:39
  • 1
    https://packaging.python.org/discussions/install-requires-vs-requirements/ cleared all my doubts about the purposes of the various files – Sriram Nov 17 '21 at 08:55
  • related: https://stackoverflow.com/q/43658870, https://stackoverflow.com/q/46205648 – djvg Dec 13 '22 at 09:05

0 Answers0