diff --git a/configurations/__init__.py b/configurations/__init__.py index 64e382a..eed8762 100644 --- a/configurations/__init__.py +++ b/configurations/__init__.py @@ -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} diff --git a/configurations/sphinx.py b/configurations/sphinx.py new file mode 100644 index 0000000..d999436 --- /dev/null +++ b/configurations/sphinx.py @@ -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} diff --git a/docs/cookbook.rst b/docs/cookbook.rst index 8d00133..206b5e9 100644 --- a/docs/cookbook.rst +++ b/docs/cookbook.rst @@ -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 `_, you need add django-configurations to your ``extensions`` config variable and set @@ -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`. diff --git a/tests/docs/conf.py b/tests/docs/conf.py index 482b44d..4025988 100644 --- a/tests/docs/conf.py +++ b/tests/docs/conf.py @@ -9,7 +9,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.main") os.environ.setdefault('DJANGO_CONFIGURATION', 'Test') extensions = [ - 'configurations', + 'configurations.sphinx', ] # The suffix of source filenames. diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py index 5ee61d3..2bfa22a 100644 --- a/tests/test_sphinx.py +++ b/tests/test_sphinx.py @@ -6,7 +6,7 @@ from django.test import TestCase from django.conf import settings -class ShpinxTests(TestCase): +class SphinxTests(TestCase): docs_dir = os.path.join(settings.BASE_DIR, 'docs') def test_multiprocessing(self): diff --git a/tox.ini b/tox.ini index 3257b42..2bde8f2 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ skipsdist = True usedevelop = True minversion = 1.8 -whitelist_externals=build-sphinx +whitelist_externals=sphinx-build envlist = flake8-py27, flake8-py35,