robdmc / pandashells

:panda_face: Bringing the python data stack to the shell prompt
Other
788 stars 26 forks source link

Extras require #32

Closed moreati closed 9 years ago

moreati commented 9 years ago

fixes #25

The console_script labels correspond to names in extras_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

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