Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks done
NeilHanlon opened this issue Mar 2, 2025 · 4 comments · Fixed by #8057
Closed
4 tasks done

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

NeilHanlon opened this issue Mar 2, 2025 · 4 comments · Fixed by #8057
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@NeilHanlon
Copy link
Contributor

NeilHanlon commented Mar 2, 2025

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

@facelessuser
Copy link
Contributor

Ugh, I see what happened. It was supposed to be from backrefs import bre, but in one place it is import backrefs as bre.

@facelessuser
Copy link
Contributor

I've uploaded a PR fixing the issue. I mistakenly had a mismatch where the src version was wrong, but the copied version was correct, so on a later update, the src overwrote the copy.

NeilHanlon added a commit to rocky-linux/docs.rockylinux.org that referenced this issue Mar 2, 2025
@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open labels Mar 3, 2025
@squidfunk
Copy link
Owner

Released as part of 9.6.7. – 3 hours from bug report to fix to release, pretty good @facelessuser!

@NeilHanlon
Copy link
Contributor Author

Released as part of 9.6.7. – 3 hours from bug report to fix to release, pretty good @facelessuser!

The power of F/OSS!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants