Skip to content

Specifying dependencies in the install_requires #731

@ddelpiano

Description

@ddelpiano

As discussed at the last sprint meeting for the UI, it would be nice to minimise the range of versions available for each dependency netpyne needs in order to ensure the functionalities.

The setup.py script contains the description of a package. All Python packages that are registered with PyPI (the PYthon
 Package Index) need to have a setup script in their root folder, because installation tools like pip read it to know how the
 package needs to be installed.

The section inside the setup script that describes package dependencies is called install_requires. 
Dependencies are specified as a list of strings, with each string containing the name of a package plus optionally one or 
more version specifiers to restrict the range of supported versions.

As an example, here is the package dependency specification for Flask 0.10:

install_requires=[
    'Werkzeug>=0.7',
    'Jinja2>=2.4',
    'itsdangerous>=0.21'
]
As you can see, this is a "loose" mechanism to define dependencies. 
Versions aren't called directly but instead ranges of accepted versions are specified.

The best way to specify dependencies for a reusable component is through the setup.py file. 
Reusable components are, by definition, going to be imported as dependencies by other projects, and you want pip to be 
able to sort out the dependencies for parent projects automatically, without giving the developer the extra work of having 
to install indirect dependencies manually.

source https://blog.miguelgrinberg.com/post/the-package-dependency-blues

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions