Skip to content

Commit

Permalink
Move sphinx callback to a separate sphinx submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Jun 13, 2016
1 parent cd596f6 commit 9592356
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
8 changes: 1 addition & 7 deletions configurations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,5 @@ def load_ipython_extension(ipython):


def setup(app=None):
"""
The callback for Sphinx that acts as a Sphinx extension.
Add ``'configurations'`` to the ``extensions`` config variable
in your docs' ``conf.py``.
"""
"""Function used to initialize configurations similar to :func:`.django.setup`."""
_setup()
return {'version': __version__, 'parallel_read_safe': True}
12 changes: 12 additions & 0 deletions configurations/sphinx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from . import _setup, __version__


def setup(app=None):
"""
The callback for Sphinx that acts as a Sphinx extension.
Add ``'configurations'`` to the ``extensions`` config variable
in your docs' ``conf.py``.
"""
_setup()
return {'version': __version__, 'parallel_read_safe': True}
8 changes: 5 additions & 3 deletions docs/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ As you can see django-configurations provides a helper module
Sphinx
------

.. versionadded: 0.9
In case you would like to user the amazing `autodoc` feature of the
documentation tool `Sphinx <http://sphinx-doc.org/>`_, you need add
django-configurations to your ``extensions`` config variable and set
Expand All @@ -245,7 +243,11 @@ the environment variable accordingly:
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
# ...
'configurations',
'configurations.sphinx',
]
# ...
.. versionchanged:: 2.0

Please note that the sphinx callable has been moved from `configurations` to `configurations.sphinx`.
2 changes: 1 addition & 1 deletion tests/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
os.environ.setdefault('DJANGO_CONFIGURATION', 'Test')

extensions = [
'configurations',
'configurations.sphinx',
]

# The suffix of source filenames.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.conf import settings


class ShpinxTests(TestCase):
class SphinxTests(TestCase):
docs_dir = os.path.join(settings.BASE_DIR, 'docs')

def test_multiprocessing(self):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
skipsdist = True
usedevelop = True
minversion = 1.8
whitelist_externals=build-sphinx
whitelist_externals=sphinx-build
envlist =
flake8-py27,
flake8-py35,
Expand Down

0 comments on commit 9592356

Please sign in to comment.