pipにあるparse_requirements関数を使えば簡単にできます。

試しに、 django-skel のrequirements.txtをパースしてみます。

これがサンプルコードです(Python2.7, 3.4で動作確認しています):

from pip.req import parse_requirements


install_reqs = parse_requirements('requirements.txt')
for i in install_reqs:
    print(i)

これが出力結果です:

    Django>=1.5.0,<=1.5.9 (from -r reqs/common.txt (line 1))
    django-celery==3.0.21 (from -r reqs/common.txt (line 2))
    django-compressor==1.3 (from -r reqs/common.txt (line 3))
    Fabric==1.6.1 (from -r reqs/common.txt (line 4))
    South==0.8.1 (from -r reqs/common.txt (line 5))
    Sphinx==1.1.3 (from -r reqs/common.txt (line 6))
    boto==2.9.5 (from -r reqs/prod.txt (line 2))
    cssmin==0.1.4 (from -r reqs/prod.txt (line 3))
    django-heroku-memcacheify==0.4 (from -r reqs/prod.txt (line 4))
    django-heroku-postgresify==0.3 (from -r reqs/prod.txt (line 5))
    django-storages==1.1.4 (from -r reqs/prod.txt (line 6))
    gevent==0.13.8 (from -r reqs/prod.txt (line 7))
    gunicorn==0.14.3 (from -r reqs/prod.txt (line 8))
    jsmin==2.0.3 (from -r reqs/prod.txt (line 9))
    newrelic==1.12.0.56 (from -r reqs/prod.txt (line 10))
    psycopg2==2.5 (from -r reqs/prod.txt (line 11))
    pylibmc==1.2.3 (from -r requirements.txt (line 2))

-rで参照している他のファイルの内容も読み取ってくれます。

これで、依存するモジュールをドキュメントに起こしたり、requirements.txtに変更があったタイミングでゴニョゴニョしたり、色々できそうですね。

【参考URL】

http://stackoverflow.com/questions/14399534/how-can-i-reference-requirements-txt-for-the-install-requires-kwarg-in-setuptool