Repository: sunpy/sunpy

Issue:
Make requests an extra_dependency
The `requests` package is used by e.g. `sunpy/net/jsoc/jsoc.py`, but not listed as any kind of a dependency in setup.py.
##### Fix

Add `'requests'` to `extras_require['net']` in setup.py.

setup.py install does not install all needed data files
##### Issue

Running `sunpy.tests.main()` fails if the package is installed using `python setup.py install` because setup.py does not detail all the data packages needed for the tests. It works fine with `python setup.py develop` since that effectively just creates a symbolic link (hence "installs all files").

When running the test suite, this results in errors such as

```
IOError: File does not exist: '/tmp/sunpy/lib/python2.7/site-packages/sunpy-0.4.0-py2.7-linux-x86_64.egg/sunpy/data/test/BIR_*'
ValueError: Unable to read location /tmp/sunpy/lib/python2.7/site-packages/sunpy-0.4.0-py2.7-linux-x86_64.egg/sunpy/data/test/EVE_He_II_304_averages.csv.
OSError: [Errno 2] No such file or directory: '/tmp/sunpy/lib/python2.7/site-packages/sunpy-0.4.0-py2.7-linux-x86_64.egg/sunpy/data/test/2013_06_24__17_31_30_84__SDO_AIA_AIA_193.jp2'
```
##### Fix

Add all necessary data files in `sunpy/sunpy/data/test/` (and perhaps other directories as well?) to `setup.py`.
##### Setup

python 2.7.2, sunpy 41e301ee78.



Discussion:
Ah good spot, I forgot to add that before I merged JSOC.

Ooohhhhh interesting!! I am pretty sure there is some flags to setup that allows the install of whole data folders.

I don't think so, and additionally, what if someone decided to host sunpy on subversion (for whatever reason)? Then the .svn subdirectory would be copied as well. I think the Python team thought this through.

I think wildcards suffice in this case.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@
     'Operating System :: MacOS'
 ]
 
-VERSION = '0.4.0'
+VERSION = '0.4.1'
 
 def git_description():
     import subprocess
@@ -103,6 +103,14 @@ def install(setup): #pylint: disable=W0621
 
     write_version_py()
 
+    # Define the extra requirements in a sensible manner.
+    extras_require = {'database': ["sqlalchemy"],
+                      'image': ["scikit-image"],
+                      'jpeg2000': ["glymur"],
+                      'net': ["suds", "beautifulsoup4", "requests"]}
+    # All is everything except glymur.
+    extras_require['all'] = extras_require['database'] + extras_require['image'] + extras_require['net']
+
     setup(
 	author="Steven Christe, Russell Hewett, Keith Hughitt, Jack Ireland, Florian Mayer, Stuart Mumford,  Albert Shih, David Perez-Suarez et. al",
         author_email="sunpy@googlegroups.com",
@@ -112,15 +120,11 @@ def install(setup): #pylint: disable=W0621
             'numpy>1.7.1',
             'astropy>=0.3.0',
             'scipy',
-            'pandas>=0.12.0',
+            'pandas>=0.12.1',
             'matplotlib>=1.1',
             'sqlalchemy',
         ],
-        extras_require={
-            'net': ["suds", "beautifulsoup4"],
-            'database': ["sqlalchemy"],
-            'all': ["suds", "beautifulsoup4", "sqlalchemy"]
-        },
+        extra_requires=extras_require,
         license="BSD",
         long_description="\n".join(DOCLINES[2:]),
         maintainer="SunPy Developers",
@@ -132,6 +136,7 @@ def install(setup): #pylint: disable=W0621
         provides=['sunpy'],
         url="http://www.sunpy.org/",
         use_2to3=True,
+        include_package_data=True,
         version=VERSION,
         ext_modules = ext_modules
     )


Test patch: