From 2e8cf26bd239a7345e016e1fe0754fa608cd9d7f Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 26 May 2026 13:55:35 -0500 Subject: [PATCH 1/3] Construct autoenum's logger locally instead of importing from sphinx.ext.autodoc Sphinx 9 dropped the re-exported `logger` symbol from `sphinx.ext.autodoc` when the module was rewritten (sphinx-doc/sphinx#13751, #14089). Switch to `sphinx.util.logging.getLogger(__name__)`, which has been available since Sphinx 1.6 and produces an equivalent logger. This is the first error reported in #118. Note that full Sphinx 9 support is still blocked on sphinx-toolbox/sphinx-toolbox#201, which is the same bug in a runtime dependency. Once that lands, the sphinx<9 cap added in 121ac05 can be lifted. Refs: https://github.com/domdfcoding/enum_tools/issues/118 Refs: https://github.com/sphinx-toolbox/sphinx-toolbox/issues/201 Co-Authored-By: Claude Opus 4.7 (1M context) --- enum_tools/autoenum.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/enum_tools/autoenum.py b/enum_tools/autoenum.py index 24de90e..51f839b 100644 --- a/enum_tools/autoenum.py +++ b/enum_tools/autoenum.py @@ -73,11 +73,16 @@ ClassLevelDocumenter, Documenter, ObjectMember, - logger ) from sphinx.locale import _ # nodep from sphinx.pycode import ModuleAnalyzer # nodep +from sphinx.util import logging as sphinx_logging # nodep from sphinx.util.inspect import memory_address_re, safe_getattr # nodep + +# sphinx.ext.autodoc.logger was dropped from the module's public surface in +# Sphinx 9 when autodoc was rewritten. Construct our own; getLogger has been +# available in sphinx.util.logging since Sphinx 1.6. +logger = sphinx_logging.getLogger(__name__) from sphinx_toolbox.more_autodoc import ObjectMembers # nodep from sphinx_toolbox.more_autodoc.typehints import format_annotation # nodep from sphinx_toolbox.utils import add_fallback_css_class # nodep From 67a703e2c21ae52633bfacbaa69c2b7634e2244a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 19:04:48 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- enum_tools/autoenum.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/enum_tools/autoenum.py b/enum_tools/autoenum.py index 51f839b..716c281 100644 --- a/enum_tools/autoenum.py +++ b/enum_tools/autoenum.py @@ -72,7 +72,7 @@ ClassDocumenter, ClassLevelDocumenter, Documenter, - ObjectMember, + ObjectMember ) from sphinx.locale import _ # nodep from sphinx.pycode import ModuleAnalyzer # nodep @@ -83,6 +83,7 @@ # Sphinx 9 when autodoc was rewritten. Construct our own; getLogger has been # available in sphinx.util.logging since Sphinx 1.6. logger = sphinx_logging.getLogger(__name__) +# 3rd party from sphinx_toolbox.more_autodoc import ObjectMembers # nodep from sphinx_toolbox.more_autodoc.typehints import format_annotation # nodep from sphinx_toolbox.utils import add_fallback_css_class # nodep From 7f413d8c540f36bfae1c3ba8f370600b395e8afe Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Fri, 29 May 2026 21:19:44 +0100 Subject: [PATCH 3/3] Move below imports --- enum_tools/autoenum.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/enum_tools/autoenum.py b/enum_tools/autoenum.py index 716c281..55d186f 100644 --- a/enum_tools/autoenum.py +++ b/enum_tools/autoenum.py @@ -78,12 +78,6 @@ from sphinx.pycode import ModuleAnalyzer # nodep from sphinx.util import logging as sphinx_logging # nodep from sphinx.util.inspect import memory_address_re, safe_getattr # nodep - -# sphinx.ext.autodoc.logger was dropped from the module's public surface in -# Sphinx 9 when autodoc was rewritten. Construct our own; getLogger has been -# available in sphinx.util.logging since Sphinx 1.6. -logger = sphinx_logging.getLogger(__name__) -# 3rd party from sphinx_toolbox.more_autodoc import ObjectMembers # nodep from sphinx_toolbox.more_autodoc.typehints import format_annotation # nodep from sphinx_toolbox.utils import add_fallback_css_class # nodep @@ -101,6 +95,11 @@ __all__ = ["EnumDocumenter", "EnumMemberDocumenter", "setup", "FlagDocumenter", "PyEnumXRefRole"] +# sphinx.ext.autodoc.logger was dropped from the module's public surface in +# Sphinx 9 when autodoc was rewritten. Construct our own; getLogger has been +# available in sphinx.util.logging since Sphinx 1.6. +logger = sphinx_logging.getLogger(__name__) + documentation.INTERACTIVE = True _filename_set_attribute = "filename_set" if sphinx.version_info < (4, 0) else "record_dependencies"