From 422a0724eb87ac8a9376d5408636aa47124320d6 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Wed, 7 Jul 2021 11:44:46 +0300 Subject: [PATCH] Don't keep our own copy of autodoc_traits Co-authored-by: Alex Leach --- docs/requirements.txt | 3 ++ docs/source/api/index.rst | 12 ------- docs/source/conf.py | 2 -- docs/sphinxext/autodoc_traits.py | 55 -------------------------------- 4 files changed, 3 insertions(+), 69 deletions(-) delete mode 100644 docs/sphinxext/autodoc_traits.py diff --git a/docs/requirements.txt b/docs/requirements.txt index 70691feb..4fff8564 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,6 @@ myst-parser pydata-sphinx-theme sphinx-copybutton +# Temporary fix of sphinx compatibility issue. +# Revert back to released autodoc-traits when 0.1.0 released. +https://github.com/jupyterhub/autodoc-traits/archive/d22282c1c18c6865436e06d8b329c06fe12a07f8.zip diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst index 08896f54..410c9a6c 100644 --- a/docs/source/api/index.rst +++ b/docs/source/api/index.rst @@ -26,15 +26,3 @@ Module: :mod:`jupyterhub_traefik_proxy` .. autoconfigurable:: TKvProxy :members: - -:class:`TraefikEtcdProxy` -------------------------- - -.. autoconfigurable:: TraefikEtcdProxy - :members: - -:class:`TraefikConsulProxy` ---------------------------- - -.. autoconfigurable:: TraefikConsulProxy - :members: diff --git a/docs/source/conf.py b/docs/source/conf.py index 00568d58..8a3b4a79 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -32,8 +32,6 @@ os.pardir, ) ) -# add sphinxext -sys.path.append(os.path.join(docs, 'sphinxext')) import jupyterhub_traefik_proxy diff --git a/docs/sphinxext/autodoc_traits.py b/docs/sphinxext/autodoc_traits.py deleted file mode 100644 index 516156cd..00000000 --- a/docs/sphinxext/autodoc_traits.py +++ /dev/null @@ -1,55 +0,0 @@ -"""autodoc extension for configurable traits""" - -from traitlets import TraitType, Undefined -from sphinx.domains.python import PyClassmember -from sphinx.ext.autodoc import ClassDocumenter, AttributeDocumenter - - -class ConfigurableDocumenter(ClassDocumenter): - """Specialized Documenter subclass for traits with config=True""" - - objtype = 'configurable' - directivetype = 'class' - - def get_object_members(self, want_all): - """Add traits with .tag(config=True) to members list""" - check, members = super().get_object_members(want_all) - get_traits = ( - self.object.class_own_traits - if self.options.inherited_members - else self.object.class_traits - ) - trait_members = [] - for name, trait in sorted(get_traits(config=True).items()): - # put help in __doc__ where autodoc will look for it - trait.__doc__ = trait.help - trait_members.append((name, trait)) - return check, trait_members + members - - -class TraitDocumenter(AttributeDocumenter): - objtype = 'trait' - directivetype = 'attribute' - member_order = 1 - priority = 100 - - @classmethod - def can_document_member(cls, member, membername, isattr, parent): - return isinstance(member, TraitType) - - def format_name(self): - return 'config c.' + super().format_name() - - def add_directive_header(self, sig): - default = self.object.get_default_value() - if default is Undefined: - default_s = '' - else: - default_s = repr(default) - sig = ' = {}({})'.format(self.object.__class__.__name__, default_s) - return super().add_directive_header(sig) - - -def setup(app): - app.add_autodocumenter(ConfigurableDocumenter) - app.add_autodocumenter(TraitDocumenter)