Python packages with dependency installation

3

I would like to know if as in .deb packages for example, it is possible in my setup.py I configure the dependencies for my package, and when executing:

$ sudo python setup.py install

They will be installed automatically. I already searched the internet but everything I found ended up confusing me, things like "requires", "install_requires" and "requirements.txt".

Thank you in advance.

    
asked by anonymous 13.11.2014 / 03:24

2 answers

2

On your setup.py you are certainly using a setup() of settuptools function. You should include in this function the install_requires argument with the list of dependencies.

For example:

setup(
    name='exemplo',
    install_requires=[
        'babel >= 1.0',
        'pytz',
    ],
)

Clarifying requirements.txt : is often used with pip to indicate a list of packages to install, instead of using that list directly in pip . It is not related to setup.py , but ends up having a function similar to ìnstall_requires', which can cause confusion.

    
13.11.2014 / 11:52
0

I suppose you will write a package in the PyPI standard (for use with the pip , for example , or easy_install ), here is a complete example of how to do this .

    
13.11.2014 / 04:23