Skip to content

'backrefs' module has no attribute 'compile' after upgrade to 9.6.6 #8056

@NeilHanlon

Description

@NeilHanlon

Context

Noticed originally in CI because the job succeeded despite failing and deployed a broken page (my fault on the CI fail ;)): https://github.com/rocky-linux/docs.rockylinux.org/actions/runs/13619078285/job/38065965051#step:4:657

Bug description

When attempting to build even a completely minimal reproducer, builds fail under multiple conditions with the following:

ERROR   -  Error building page 'index.md': module 'backrefs' has no attribute 'compile'
Traceback (most recent call last):
  File "/home/neil/.local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ~~~^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/neil/.local/lib/python3.13/site-packages/mkdocs/__main__.py", line 288, in build_command
    build.build(cfg, dirty=not clean)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/neil/.local/lib/python3.13/site-packages/mkdocs/commands/build.py", line 337, in build
    _build_page(
    ~~~~~~~~~~~^
        file.page, config, doc_files, nav, env, dirty, excluded=file.inclusion.is_excluded()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/neil/.local/lib/python3.13/site-packages/mkdocs/commands/build.py", line 213, in _build_page
    context = config.plugins.on_page_context(context, page=page, config=config, nav=nav)
  File "/home/neil/.local/lib/python3.13/site-packages/mkdocs/plugins.py", line 643, in on_page_context
    return self.run_event('page_context', context, page=page, config=config, nav=nav)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/neil/.local/lib/python3.13/site-packages/mkdocs/plugins.py", line 566, in run_event
    result = method(item, **kwargs)
  File "/home/neil/.local/lib/python3.13/site-packages/material/plugins/search/plugin.py", line 117, in on_page_context
    self.search_index.add_entry_from_context(page)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/neil/.local/lib/python3.13/site-packages/material/plugins/search/plugin.py", line 180, in add_entry_from_context
    self.create_entry_for_section(section, page.toc, page.url, page)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/neil/.local/lib/python3.13/site-packages/material/plugins/search/plugin.py", line 203, in create_entry_for_section
    title = self._segment_chinese(title)
  File "/home/neil/.local/lib/python3.13/site-packages/material/plugins/search/plugin.py", line 289, in _segment_chinese
    expr = bre.compile(r"(\p{script: Han}+)", bre.UNICODE)
           ^^^^^^^^^^^
AttributeError: module 'backrefs' has no attribute 'compile'

Reproduction

9.6.6-backrefs-has-no-attribute-compile.zip

Steps to reproduce

Download reproducer, install from venv, try mkdocs build

Browser

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions