Repository: sphinx-gallery/sphinx-gallery

Issue:
Rename package to sphinx_gallery rather than sphinxgallery?
A very minor annoyance, but I thought I would vent it out and ask for opinions, it seems to me that sphinx_gallery for the package name is more in line with sphinx-gallery as the project name.

Basically if people agree it would be wise to fix that sooner rather than later, to reduce the impact on potential users.

Discussion:

Patch:
diff --git a/README.rst b/README.rst
index 327e8cd..f6e3d05 100644
--- a/README.rst
+++ b/README.rst
@@ -49,10 +49,10 @@ After installing you need to include in your Sphinx ``conf.py`` file:
 
 .. code-block:: python
 
-    import sphinxgallery
+    import sphinx_gallery
     extensions = [
         ...
-        'sphinxgallery.gen_gallery',
+        'sphinx_gallery.gen_gallery',
         ]
 
 
diff --git a/doc/advanced_configuration.rst b/doc/advanced_configuration.rst
index e697a9c..269d567 100644
--- a/doc/advanced_configuration.rst
+++ b/doc/advanced_configuration.rst
@@ -12,7 +12,7 @@ Within your Sphinx ``conf.py`` file you need to add a configuration dictionary:
 
 .. code-block:: python
 
-    sphinxgallery_conf = {
+    sphinx_gallery_conf = {
         'examples_dirs' : '../examples',              # path to your examples scripts
         'gallery_dirs'  : 'auto_examples'}            # path where to save gallery generated examples
 
@@ -30,7 +30,7 @@ the sphinx configuration dictionary:
 
 .. code-block:: python
 
-    sphinxgallery_conf = {
+    sphinx_gallery_conf = {
         'examples_dirs'   : ['../examples', '../tutorials'],
         'gallery_dirs'    : ['auto_examples', 'tutorials'],
     }
@@ -60,10 +60,10 @@ dictionary within your Sphinx ``conf.py`` file :
 
 .. code-block:: python
 
-    sphinxgallery_conf = {
+    sphinx_gallery_conf = {
         'reference_url':  {
                  # The module you locally document uses a None
-                'sphinxgallery': None,
+                'sphinx_gallery': None,
 
                 # External python modules use their documentation websites
                 'matplotlib': 'http://matplotlib.org',
@@ -84,12 +84,12 @@ configuration dictionary:
 
 .. code-block:: python
 
-    sphinxgallery_conf = {
+    sphinx_gallery_conf = {
         # path where to store your example linker templates
         'mod_example_dir'     : 'modules/generated',
 
         # Your documented modules. You can use a string or a list of strings
-        'doc_module'          : ('sphinxgallery', 'numpy')}
+        'doc_module'          : ('sphinx_gallery', 'numpy')}
 
 The path you specified will get populated with the links to examples using your
 module and their methods. Then within your sphinx documentation files you
@@ -122,5 +122,5 @@ file. You need to add to the configuration dictionary a key called
 
 .. code-block:: python
 
-    sphinxgallery_conf = {
+    sphinx_gallery_conf = {
         'default_thumb_file'     : 'path/to/thumb/file.png'}}
diff --git a/doc/conf.py b/doc/conf.py
index 9b2b7a2..daf448c 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -15,7 +15,7 @@
 import sys
 import os
 from datetime import date
-import sphinxgallery
+import sphinx_gallery
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -37,7 +37,7 @@ extensions = [
     'sphinx.ext.todo',
     'sphinx.ext.coverage',
     'sphinx.ext.mathjax',
-    'sphinxgallery.gen_gallery',
+    'sphinx_gallery.gen_gallery',
 ]
 
 # Add any paths that contain templates here, relative to this directory.
@@ -61,9 +61,9 @@ copyright = u'2014-%s, Óscar Nájera' % date.today().year
 # built documents.
 #
 # The short X.Y version.
-version = sphinxgallery.__version__
+version = sphinx_gallery.__version__
 # The full version, including alpha/beta/rc tags.
-release = sphinxgallery.__version__ + '-git'
+release = sphinx_gallery.__version__ + '-git'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -291,10 +291,10 @@ except ImportError:
     find_mayavi_figures = False
 
 
-sphinxgallery_conf = {
-    'doc_module': ('sphinxgallery', 'numpy'),
+sphinx_gallery_conf = {
+    'doc_module': ('sphinx_gallery', 'numpy'),
     'reference_url': {
-        'sphinxgallery': None,
+        'sphinx_gallery': None,
         'matplotlib': 'http://matplotlib.org',
         'numpy': 'http://docs.scipy.org/doc/numpy-1.9.1'},
     'examples_dirs': examples_dirs,
diff --git a/doc/reference.rst b/doc/reference.rst
index 7d6c7e8..1df81a5 100644
--- a/doc/reference.rst
+++ b/doc/reference.rst
@@ -3,25 +3,25 @@ Sphinx-Gallery Reference
 ========================
 
 
-.. automodule:: sphinxgallery
+.. automodule:: sphinx_gallery
     :members:
 
-.. autodata:: sphinxgallery.__version__
+.. autodata:: sphinx_gallery.__version__
     :annotation: Sphinx Gallery current version
 
-.. include:: modules/generated/sphinxgallery.__version__.examples
+.. include:: modules/generated/sphinx_gallery.__version__.examples
 .. raw:: html
 
         <div style='clear:both'></div>
 
-.. automodule:: sphinxgallery.gen_gallery
+.. automodule:: sphinx_gallery.gen_gallery
     :members:
 
-.. automodule:: sphinxgallery.backreferences
+.. automodule:: sphinx_gallery.backreferences
     :members:
 
-.. automodule:: sphinxgallery.gen_rst
+.. automodule:: sphinx_gallery.gen_rst
     :members:
 
-.. automodule:: sphinxgallery.docs_resolv
+.. automodule:: sphinx_gallery.docs_resolv
     :members:
diff --git a/examples/plot_gallery_version.py b/examples/plot_gallery_version.py
index 7755616..bcd0cd8 100644
--- a/examples/plot_gallery_version.py
+++ b/examples/plot_gallery_version.py
@@ -13,7 +13,7 @@ version.
 
 import numpy as np
 import matplotlib.pyplot as plt
-import sphinxgallery
+import sphinx_gallery
 
 np.random.seed(32)
 
@@ -43,7 +43,7 @@ for mixture in d.T:
     mixture[[0, -1]] = 0.
     plt.fill(x, mixture, alpha=0.9)
 
-plt.annotate('Introducing Sphinx-Gallery ' + sphinxgallery.__version__,
+plt.annotate('Introducing Sphinx-Gallery ' + sphinx_gallery.__version__,
              xy=(12, 4), arrowprops=dict(arrowstyle='->'), xytext=(22, 6))
 
 plt.xticks([])
diff --git a/setup.cfg b/setup.cfg
index 4e2423b..4e43f4c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,7 @@
 verbosity=1
 detailed-errors=1
 with-coverage=1
-cover-package=sphinxgallery
+cover-package=sphinx_gallery
 with-doctest=1
 doctest-extension=rst
 
diff --git a/setup.py b/setup.py
index d2808aa..a24015b 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ Installer Sphinx extension for gallery generator
 """
 
 from setuptools import setup, find_packages
-import sphinxgallery
+import sphinx_gallery
 
 with open('README.rst') as f:
     long_description = f.read()
@@ -16,9 +16,9 @@ setup(
     name="sphinx-gallery",
     description="Sphinx extension to automatically generate an examples gallery",
     long_description=long_description,
-    version=sphinxgallery.__version__,
+    version=sphinx_gallery.__version__,
     packages=find_packages(),
-    package_data={'sphinxgallery': ['_static/gallery.css', '_static/no_image.png']},
+    package_data={'sphinx_gallery': ['_static/gallery.css', '_static/no_image.png']},
     url="https://github.com/sphinx-gallery/sphinx-gallery",
     author="Óscar Nájera",
     author_email='najera.oscar@gmail.com',
diff --git a/sphinxgallery/__init__.py b/sphinx_gallery/__init__.py
similarity index 100%
rename from sphinxgallery/__init__.py
rename to sphinx_gallery/__init__.py
diff --git a/sphinxgallery/_static/gallery.css b/sphinx_gallery/_static/gallery.css
similarity index 100%
rename from sphinxgallery/_static/gallery.css
rename to sphinx_gallery/_static/gallery.css
diff --git a/sphinxgallery/_static/gallery.scss b/sphinx_gallery/_static/gallery.scss
similarity index 100%
rename from sphinxgallery/_static/gallery.scss
rename to sphinx_gallery/_static/gallery.scss
diff --git a/sphinxgallery/_static/no_image.png b/sphinx_gallery/_static/no_image.png
similarity index 100%
rename from sphinxgallery/_static/no_image.png
rename to sphinx_gallery/_static/no_image.png
diff --git a/sphinxgallery/backreferences.py b/sphinx_gallery/backreferences.py
similarity index 100%
rename from sphinxgallery/backreferences.py
rename to sphinx_gallery/backreferences.py
diff --git a/sphinxgallery/docs_resolv.py b/sphinx_gallery/docs_resolv.py
similarity index 99%
rename from sphinxgallery/docs_resolv.py
rename to sphinx_gallery/docs_resolv.py
index 7a04f4b..fb596fd 100644
--- a/sphinxgallery/docs_resolv.py
+++ b/sphinx_gallery/docs_resolv.py
@@ -426,7 +426,7 @@ def embed_code_links(app, exception):
 
     print('Embedding documentation hyperlinks in examples..')
 
-    gallery_conf = app.config.sphinxgallery_conf
+    gallery_conf = app.config.sphinx_gallery_conf
 
     gallery_dirs = gallery_conf['gallery_dirs']
     if not isinstance(gallery_dirs, list):
diff --git a/sphinxgallery/gen_gallery.py b/sphinx_gallery/gen_gallery.py
similarity index 96%
rename from sphinxgallery/gen_gallery.py
rename to sphinx_gallery/gen_gallery.py
index 39eb931..22ae562 100644
--- a/sphinxgallery/gen_gallery.py
+++ b/sphinx_gallery/gen_gallery.py
@@ -43,10 +43,10 @@ def generate_gallery_rst(app):
     except TypeError:
         plot_gallery = bool(app.builder.config.plot_gallery)
 
-    gallery_conf.update(app.config.sphinxgallery_conf)
+    gallery_conf.update(app.config.sphinx_gallery_conf)
 
     # this assures I can call the config in other places
-    app.config.sphinxgallery_conf = gallery_conf
+    app.config.sphinx_gallery_conf = gallery_conf
     app.config.html_static_path.append(glr_path_static())
 
     if not plot_gallery:
@@ -104,7 +104,7 @@ gallery_conf = {
 def setup(app):
     """Setup sphinx-gallery sphinx extension"""
     app.add_config_value('plot_gallery', True, 'html')
-    app.add_config_value('sphinxgallery_conf', gallery_conf, 'html')
+    app.add_config_value('sphinx_gallery_conf', gallery_conf, 'html')
     app.add_stylesheet('gallery.css')
 
     app.connect('builder-inited', generate_gallery_rst)


Test patch:
diff --git a/sphinxgallery/gen_rst.py b/sphinx_gallery/gen_rst.py
similarity index 100%
rename from sphinxgallery/gen_rst.py
rename to sphinx_gallery/gen_rst.py
diff --git a/sphinxgallery/tests/reference_parse.txt b/sphinx_gallery/tests/reference_parse.txt
similarity index 100%
rename from sphinxgallery/tests/reference_parse.txt
rename to sphinx_gallery/tests/reference_parse.txt
diff --git a/sphinxgallery/tests/test_backreferences.py b/sphinx_gallery/tests/test_backreferences.py
similarity index 96%
rename from sphinxgallery/tests/test_backreferences.py
rename to sphinx_gallery/tests/test_backreferences.py
index d11deb3..ca1542b 100644
--- a/sphinxgallery/tests/test_backreferences.py
+++ b/sphinx_gallery/tests/test_backreferences.py
@@ -5,7 +5,7 @@
 Testing the rst files generator
 """
 from __future__ import division, absolute_import, print_function
-import sphinxgallery.backreferences as sg
+import sphinx_gallery.backreferences as sg
 from nose.tools import assert_equal
 
 
diff --git a/sphinxgallery/tests/test_docs_resolv.py b/sphinx_gallery/tests/test_docs_resolv.py
similarity index 96%
rename from sphinxgallery/tests/test_docs_resolv.py
rename to sphinx_gallery/tests/test_docs_resolv.py
index a858834..7162910 100644
--- a/sphinxgallery/tests/test_docs_resolv.py
+++ b/sphinx_gallery/tests/test_docs_resolv.py
@@ -5,7 +5,7 @@
 Testing the rst files generator
 """
 from __future__ import division, absolute_import, print_function
-import sphinxgallery.docs_resolv as sg
+import sphinx_gallery.docs_resolv as sg
 import tempfile
 import sys
 from nose.tools import assert_equal
diff --git a/sphinxgallery/tests/test_gen_rst.py b/sphinx_gallery/tests/test_gen_rst.py
similarity index 96%
rename from sphinxgallery/tests/test_gen_rst.py
rename to sphinx_gallery/tests/test_gen_rst.py
index 8914ab6..4fb7854 100644
--- a/sphinxgallery/tests/test_gen_rst.py
+++ b/sphinx_gallery/tests/test_gen_rst.py
@@ -7,7 +7,7 @@ Testing the rst files generator
 from __future__ import division, absolute_import, print_function
 import tempfile
 
-import sphinxgallery.gen_rst as sg
+import sphinx_gallery.gen_rst as sg
 from nose.tools import assert_equal, assert_false
 import ast
 
@@ -25,7 +25,7 @@ def test_bug_cases_of_notebook_syntax():
     """Test over the known requirements of supported syntax in the
     notebook styled comments"""
 
-    with open('sphinxgallery/tests/reference_parse.txt') as reference:
+    with open('sphinx_gallery/tests/reference_parse.txt') as reference:
         ref_blocks = ast.literal_eval(reference.read())
         blocks = sg.split_code_and_text_blocks('tutorials/plot_parse.py')