Browse Source

[dist] Use conficheck from sphinx_celery

Ask Solem 9 years ago
parent
commit
357660fb04
8 changed files with 62 additions and 57 deletions
  1. 1 1
      Makefile
  2. 2 0
      celery/app/defaults.py
  3. 5 0
      docs/Makefile
  4. 34 0
      docs/conf.py
  5. 8 0
      docs/configuration.rst
  6. 5 1
      docs/userguide/routing.rst
  7. 0 53
      extra/release/verify_config_reference.py
  8. 7 2
      tox.ini

+ 1 - 1
Makefile

@@ -26,7 +26,7 @@ apicheck:
 	(cd "$(SPHINX_DIR)"; $(MAKE) apicheck)
 
 configcheck:
-	PYTHONPATH=. $(PYTHON) extra/release/verify_config_reference.py $(CONFIGREF_SRC)
+	(cd "$(SPHINX_DIR)"; $(MAKE) configcheck)
 
 flakecheck:
 	flake8 "$(PROJ)"

+ 2 - 0
celery/app/defaults.py

@@ -132,6 +132,8 @@ NAMESPACES = Namespace(
         servers=Option(type='list'),
         table=Option(type='string'),
         write_consistency=Option(type='string'),
+        auth_provider=Option(type='string'),
+        auth_kwargs=Option(type='string'),
     ),
     couchbase=Namespace(
         __old__=old_ns('celery_couchbase'),

+ 5 - 0
docs/Makefile

@@ -48,6 +48,7 @@ help:
 	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
 	@echo "  coverage   to run coverage check of the documentation (if enabled)"
 	@echo "  apicheck   to verify that all modules are present in autodoc"
+	@echo "  configcheck to verify that all modules are present in autodoc"
 
 .PHONY: clean
 clean:
@@ -215,6 +216,10 @@ coverage:
 apicheck:
 	$(SPHINXBUILD) -b apicheck $(ALLSPHINXOPTS) $(BUILDDIR)/apicheck
 
+.PHONY: configcheck
+configcheck:
+	$(SPHINXBUILD) -b configcheck $(ALLSPHINXOPTS) $(BUILDDIR)/configcheck
+
 .PHONY: xml
 xml:
 	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml

+ 34 - 0
docs/conf.py

@@ -39,3 +39,37 @@ globals().update(conf.build_config(
         'celery.utils.encoding',
     ],
 ))
+
+settings = {}
+ignored_settings = {
+    'worker_agent',
+    'worker_pool_putlocks',
+    'broker_host',
+    'broker_user',
+    'broker_password',
+    'broker_vhost',
+    'broker_port',
+    'broker_transport',
+    'chord_propagates',
+    'redis_host',
+    'redis_port',
+    'redis_db',
+    'redis_password',
+    'worker_force_execv',
+}
+
+def configcheck_project_settings():
+    from celery.app.defaults import NAMESPACES, flatten
+    settings.update(dict(flatten(NAMESPACES)))
+    return set(settings)
+
+
+def is_deprecated_setting(setting):
+    try:
+        return settings[setting].deprecate_by
+    except KeyError:
+        pass
+
+
+def configcheck_should_ignore(setting):
+    return setting in ignored_settings or is_deprecated_setting(setting)

+ 8 - 0
docs/configuration.rst

@@ -1430,6 +1430,14 @@ Using a list will implicitly set ``x-ha-policy`` to 'nodes' and
 
 See http://www.rabbitmq.com/ha.html for more information.
 
+.. setting:: task_queue_max_priority
+
+task_queue_max_priority
+~~~~~~~~~~~~~~~~~~~~~~~
+:brokers: RabbitMQ
+
+See :ref:`routing-options-rabbitmq-priorities`.
+
 .. setting:: worker_direct
 
 worker_direct

+ 5 - 1
docs/userguide/routing.rst

@@ -239,7 +239,11 @@ Queues can be configured to support priorities by setting the
     ]
 
 A default value for all queues can be set using the
-:setting:`task_queue_max_priority` setting.
+:setting:`task_queue_max_priority` setting:
+
+.. code-block:: python
+
+    app.conf.task_queue_max_priority = 10
 
 .. _amqp-primer:
 

+ 0 - 53
extra/release/verify_config_reference.py

@@ -1,53 +0,0 @@
-from __future__ import absolute_import, print_function, unicode_literals
-
-from fileinput import input as _input
-from sys import exit, stderr
-
-from celery.app.defaults import NAMESPACES, flatten
-
-ignore = {
-    'worker_agent',
-    'worker_pool_putlocks',
-    'broker_host',
-    'broker_user',
-    'broker_password',
-    'broker_vhost',
-    'broker_port',
-    'broker_transport',
-    'chord_propagates',
-    'redis_host',
-    'redis_port',
-    'redis_db',
-    'redis_password',
-    'worker_force_execv',
-}
-
-
-def is_ignored(setting, option):
-    return setting in ignore or option.deprecate_by
-
-
-def find_undocumented_settings(directive='.. setting:: '):
-    settings = dict(flatten(NAMESPACES))
-    all = set(settings)
-    inp = (l.decode('utf-8') for l in _input())
-    documented = set(
-        line.strip()[len(directive):].strip() for line in inp
-        if line.strip().startswith(directive)
-    )
-    return [setting for setting in all ^ documented
-            if not is_ignored(setting, settings[setting])]
-
-
-if __name__ == '__main__':
-    sep = '\n  * '
-    missing = find_undocumented_settings()
-    if missing:
-        print(
-            'Error: found undocumented settings:{0}{1}'.format(
-                sep, sep.join(sorted(missing))),
-            file=stderr,
-        )
-        exit(1)
-    print('-Ok- configuration reference complete :-)')
-    exit(0)

+ 7 - 2
tox.ini

@@ -1,5 +1,5 @@
 [tox]
-envlist = 2.7,pypy,3.4,3.5,pypy3,flake8,flakeplus,apicheck
+envlist = 2.7,pypy,3.4,3.5,pypy3,flake8,flakeplus,apicheck,configcheck
 
 [testenv]
 deps=
@@ -19,7 +19,7 @@ commands = pip install -U -r{toxinidir}/requirements/dev.txt
                 --cover-inclusive --cover-min-percentage=94 --cover-erase []
 
 basepython =
-    2.7,flake8,flakeplus,linkcheck,apicheck python2.7
+    2.7,flake8,flakeplus,apicheck,linkcheck,configcheck python2.7
     3.4: python3.4
     3.5: python3.5
     pypy: pypy
@@ -30,6 +30,11 @@ commands =
     pip install -U -r{toxinidir}/requirements/dev.txt
     sphinx-build -W -b apicheck -d {envtmpdir}/doctrees docs docs/_build/apicheck
 
+[testenv:configcheck]
+commands =
+    pip install -U -r{toxinidir}/requirements/dev.txt
+    sphinx-build -W -b configcheck -d {envtmpdir}/doctrees docs docs/_build/configcheck
+
 [testenv:linkcheck]
 commands =
     pip install -U -r{toxinidir}/requirements/dev.txt