example_pypi_package icon indicating copy to clipboard operation
example_pypi_package copied to clipboard

Reading requirements.txt in setup.py

Open erelsgl opened this issue 3 years ago • 0 comments
trafficstars

In my setup.py, I read both the README.md and the requirements.txt:

  import setuptools, pathlib
  HERE = pathlib.Path(__file__).parent
  README = (HERE / "README.md").read_text()
  REQUIRES = (HERE / "requirements.txt").read_text().strip().split("\n")
  REQUIRES = [lin.strip() for lin in REQUIRES]
  
  setuptools.setup(
      ...
      install_requires=REQUIRES,
      long_description=README,
      long_description_content_type="text/markdown",
      ...
  )

For this to work, I had to add requirements.txt to MANIFEST.in.

I hope it helps someone.

erelsgl avatar Feb 06 '22 23:02 erelsgl