Skip to content

Reading requirements.txt in setup.py #2

@erelsgl

Description

@erelsgl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions