Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I have a requirements.txt file that I'm using with Travis-CI. It seems silly to duplicate the requirements in both requirements.txt and setup.py, so I was hoping to pass a filehandle to the install_requires kwarg in setuptools.setup.

Is this possible? If so, how should I go about doing it?

Here is my requirements.txt file:

guessit>=0.5.2

tvdb_api>=1.8.2

hachoir-metadata>=1.3.3

hachoir-core>=1.3.3

hachoir-parser>=1.3.4

1 Answer

0 votes
by (106k points)

To install_requires kwarg in setuptools setup.py file, you can flip it around and list the dependencies in setup.py and have a single character — a dot .— in requirements.txt instead.

You can use the following piece of code:-

install_reqs = parse_requirements('requirements.txt', session='hack')

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...