Skip to content

Instantly share code, notes, and snippets.

@michaelconnor00
Created April 7, 2016 23:21
Show Gist options
  • Save michaelconnor00/f90f43e00553b2da34c874b9861b48e0 to your computer and use it in GitHub Desktop.
Save michaelconnor00/f90f43e00553b2da34c874b9861b48e0 to your computer and use it in GitHub Desktop.
A snippet for reading install_requires from requirements.txt
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