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

[Insiders] RecursionError when adding Blog plugin #4365

Closed
5 tasks done
davelevine opened this issue Sep 14, 2022 · 4 comments
Closed
5 tasks done

[Insiders] RecursionError when adding Blog plugin #4365

davelevine opened this issue Sep 14, 2022 · 4 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@davelevine
Copy link
Sponsor

davelevine commented Sep 14, 2022

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

After adding the Blog plugin to a large documentation repo (~500 pages), running mkdocs serve --verbose produces RecursionError: maximum recursion depth exceeded. Creating a copy of this repo and removing ~300 pages of documentation no longer produces the error.

Expected behaviour

Blog plugin should work without error.

Actual behaviour

Running mkdocs serve produces the following:

Traceback (most recent call last):
File "/Users/dave/.pyenv/versions/3.9.13/bin/mkdocs", line 8, in
sys.exit(cli())
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/mkdocs/main.py", line 181, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 63, in serve
config = builder()
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 58, in builder
build(config, live_server=live_server, dirty=dirty)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/mkdocs/commands/build.py", line 295, in build
env = config['plugins'].run_event(
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/mkdocs/plugins.py", line 102, in run_event
result = method(item, **kwargs)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/site-packages/material/plugins/blog/plugin.py", line 408, in on_env
config = deepcopy(config)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 264, in _reconstruct
y = func(*args)
File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 263, in
args = (deepcopy(arg, memo) for arg in args)

The errors beginning at File "/Users/dave/.pyenv/versions/3.9.13/lib/python3.9/copy.py", line 172, in deepcopy y = _reconstruct(x, memo, *rv) run until eventually producing the following error:

RecursionError: maximum recursion depth exceeded

Steps to reproduce

Package versions

  • Python: python --version: Python 3.9.13
  • MkDocs: mkdocs --version: mkdocs, version 1.3.1
  • Material: pip show mkdocs-material | grep -E ^Version: Version: 8.5.0+insiders.4.23.3

Configuration

site_name: My Docs
docs_dir: content
theme: 
  name: material
  custom_dir: theme
  include_search_page: false
  search_index_only: true
  features:
    - navigation.tabs
    - navigation.tabs.sticky
    - navigation.top
    - navigation.tracking
    - navigation.instant
    - navigation.indexes
    - search.suggest
    - search.share
    - announce.dismiss
    - content.code.annotate
    - content.tooltips
plugins:
  # Built-in
  - search:
      separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
  # Extra
  - git-revision-date-localized:
      type: timeago
      enable_creation_date: true
      exclude:
        - index.md
        - blog/archive/*
        - blog/category/*
  - glightbox:
      touchNavigation: true
      loop: false
      effect: zoom
      width: 100%
      height: auto
      zoomable: true
      draggable: true
  - minify:
      minify_html: true
  - offline:
      enabled: !ENV [OFFLINE, false]
  # Ensure Data Privacy
  - privacy:
      enabled: !ENV [PRIVACY, true]
      externals: bundle
      externals_dir: assets/externals
  - blog
nav:
  - Home: 'index.md'
  - Blog:
    - 'blog/index.md'

System information

  • Operating system: ... macOS 12.5.1
  • Browser: ... Firefox 104.0.2
@squidfunk
Copy link
Owner

Thanks for reporting. Please provide a reproducible example and attach it here as a zip.

@squidfunk squidfunk added the needs input Issue needs further input by the reporter label Sep 14, 2022
@squidfunk
Copy link
Owner

Okay, never mind, other users also reported problems with deepcopy. I've replaced it in squidfunk/mkdocs-material-insiders@88f60a2d4 with a shallow copy, which is sufficient – please try the latest master:

pip install --force git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open and removed needs input Issue needs further input by the reporter labels Sep 14, 2022
@davelevine
Copy link
Sponsor Author

That did the trick! Thanks so much for the extremely fast turnaround, @squidfunk!

@squidfunk
Copy link
Owner

Released as part of 8.5.0-insiders-4.23.4.

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

No branches or pull requests

2 participants