Repository: bokeh/bokeh

Issue:
Make license obligations easier and clearer to understand
- [x] ~~~The wording of LICENSE.txt should be improved to make it unambiguous that normal, expected use does not constitute source redistribution.~~~
- [x] LICENSE.txt file should be included within the installed python lib of installed`conda` packages and `sdist` tarballs. 
- [x] The text of the LICENSE.txt should be embedded directly into BokehJS. 
- [x] Suggest a `bokeh.license()` function to print the text of the license in the console. 
- [x] When moving from `grunt` to `gulp` the inclusion of license headers in minified BokehJS was lost. This must be restored and maintained under test (suggest grep for one of the known headers as sufficient)



Discussion:
Reference: https://github.com/twosigma/beaker-notebook/issues/2651


Resolving patch:
diff --git a/bokeh/__init__.py b/bokeh/__init__.py
--- a/bokeh/__init__.py
+++ b/bokeh/__init__.py
@@ -10,7 +10,7 @@
 For full documentation, please visit: http://bokeh.pydata.org
 
 """
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 
 # configure Bokeh version
 from .util.version import __version__; __version__
@@ -29,3 +29,14 @@
 def test(args=None):
     from .util.testing import runtests
     return runtests(args)
+
+def license():
+    ''' Print the Bokeh license to the console.
+
+    Returns:
+        None
+
+    '''
+    from os.path import join
+    with open(join(__path__[0], 'LICENSE.txt')) as lic:
+        print(lic.read())
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,7 @@
 # Stdlib imports
 import os, platform, re, shutil, site, subprocess, sys, time
 from os.path import abspath, dirname, exists, isdir, join, realpath, relpath
+from shutil import copy
 
 try:
     import colorama
@@ -83,8 +84,7 @@ def yellow(text) : return text
 # Classes and functions
 # -----------------------------------------------------------------------------
 
-package_data = []
-
+package_data = ['LICENSE.txt']
 
 def package_path(path, filters=()):
     if not os.path.exists(path):
@@ -97,12 +97,11 @@ def package_path(path, filters=()):
             for f in files:
                 if not filters or f.endswith(filters):
                     package_data.append(join(path, f))
+
 # You can't install Bokeh in a virtualenv because the lack of getsitepackages()
 # This is an open bug: https://github.com/pypa/virtualenv/issues/355
 # And this is an intended PR to fix it: https://github.com/pypa/virtualenv/pull/508
 # Workaround to fix our issue: https://github.com/bokeh/bokeh/issues/378
-
-
 def getsitepackages():
     """Returns a list containing all global site-packages directories
     (and possibly site-python)."""
@@ -526,6 +525,8 @@ def parse_jsargs():
 if bdist_wheel is not None:
     _cmdclass["bdist_wheel"] = bdist_wheel
 
+copy("LICENSE.txt", "bokeh/")
+
 setup(
     name='bokeh',
     version=_version,


Test patch:
diff --git a/bokeh/tests/test_bokeh_init.py b/bokeh/tests/test_bokeh_init.py
--- a/bokeh/tests/test_bokeh_init.py
+++ b/bokeh/tests/test_bokeh_init.py
@@ -9,6 +9,7 @@ def test_dir(self):
         names = dir(bokeh)
         self.assertTrue("__version__" in names)
         self.assertTrue("__base_version__" in names)
+        self.assertTrue("license" in names)
         self.assertTrue("test" in names)
         self.assertTrue("sampledata" in names)
 
@@ -16,5 +17,9 @@ def test_version_defined(self):
         import bokeh
         self.assertTrue(bokeh.__version__ != 'unknown')
 
+    def test_license(self):
+        import bokeh
+        bokeh.license()
+
 if __name__ == "__main__":
     unittest.main()