Created
April 7, 2016 23:21
-
-
Save michaelconnor00/f90f43e00553b2da34c874b9861b48e0 to your computer and use it in GitHub Desktop.
A snippet for reading install_requires from requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
req_exclusions = ['setuptools', 'pytest'] | |
def get_requirements(): | |
reqs = [] | |
with open('requirements.txt', 'r') as f: | |
for line in f: | |
add = True | |
for req in req_exclusions: | |
if req in line: | |
add = False | |
if add: | |
reqs.append(line.strip('\n')) | |
return reqs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment