requriements.txt and a module

22 views
Skip to first unread message

Mike Rochford

unread,
Jun 3, 2014, 9:22:47 PM6/3/14
to pym...@googlegroups.com
I am currently working on a module that requires fabric.  I have created a setup.py file to create the module with 'python setup.py sdist'. I have been told that putting dependent modules in the setup.py file is not best practice. I have read that using a requirements.txt file is favorable. 

How do the dependent modules get install using pip? 

I have a mirror I use internally and copy the dependent modules into that repository. 

When I use pip to install the module I created how do the dependent modules get installed? 

pip install --no-index --find-links http://internalmirror/python/ custom_module

Do I have to just install them individually?

Any help would be greatful. 

Thanks,

Mike

Kyle Marek-Spartz

unread,
Jun 4, 2014, 9:52:02 AM6/4/14
to pym...@googlegroups.com
Hello,

I saw this on StackOverflow a while back, and its made its way into most of my modules:

import os
from setuptools import setup, find_packages
from pip.req import parse_requirements


basedir = os.path.dirname(__file__)
requirements_path = os.path.join(basedir, 'requirements.txt')

# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_requirements = parse_requirements(requirements_path)

# Convert to setup's list of strings format:
requirements = [str(ir.req) for ir in install_requirements]

setup(
    install_requires=requirements,
    …
)


Kyle Marek-Spartz



On Jun 3, 2014, 8:22:47 PM, Mike Rochford <mroc...@gmail.com> wrote:
--
Meetings Schedule / RVSP on our Meetup at http://python.mn
---
You received this message because you are subscribed to the Google Groups "PyMNtos" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymntos+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages