Extras can be used by a project’s entry points to specify dynamic dependencies. For example, if Project A includes a “rst2pdf” script, it might declare it like this, so that the “PDF” requirements are only resolved if the “rst2pdf” script is run:
So p.fd will require numpy, pandas etc but p.crypt won't. If you attempt to run p.df. without numpy the following occurs
(pandashells)alex@martha:~/src/pandashells$ p.df
Traceback (most recent call last):
File "/home/alex/src/pandashells/bin/p.df", line 9, in <module>
load_entry_point('pandashells==0.1.4', 'console_scripts', 'p.df')()
File "/home/alex/src/pandashells/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 552, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/alex/src/pandashells/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2672, in load_entry_point
return ep.load()
File "/home/alex/src/pandashells/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2344, in load
self.require(*args, **kwargs)
File "/home/alex/src/pandashells/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2361, in require
items = working_set.resolve(reqs, env, installer)
File "/home/alex/src/pandashells/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 833, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'numpy' distribution was not found and is required by the application
fixes #25
The
console_script
labels correspond to names inextras_require
, and they allow the command to require those packages listed against that key.https://pythonhosted.org/setuptools/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
So
p.fd
will require numpy, pandas etc butp.crypt
won't. If you attempt to runp.df
. without numpy the following occurs