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

Deprecation warning in tags plugin after upgrading MkDocs to 1.6 #7119

Closed
4 tasks done
Thiti517 opened this issue Apr 28, 2024 · 10 comments
Closed
4 tasks done

Deprecation warning in tags plugin after upgrading MkDocs to 1.6 #7119

Thiti517 opened this issue Apr 28, 2024 · 10 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@Thiti517
Copy link

Thiti517 commented Apr 28, 2024

Context

When using the Tags plugin i got an exception when i set the tags index (tags_file option in mkdocs.yml). during mkdocs build or mkdocs serve It generate an INFO entry in the logger about a DeprecationWarning exception.

Here are the used packages :

  • mkdocs==1.6.0
  • mkdocs-material==9.5.19

Bug description

At the beggining of the build/serve process it give the exception : "DeprecationWarning: To replace an existing file, call remove before append.".

Here is the exact exception :

$ mkdocs build
INFO - Cleaning site directory
INFO - Building documentation to directory: /mnt/f/projects/mkdocs-plugins/testing-ground/site
INFO - DeprecationWarning: To replace an existing file, call remove before append.
File ".../material/plugins/tags/plugin.py", line 132, in _get_tags_file
files.append(file)
File ".../mkdocs/structure/files.py", line 100, in append
warnings.warn(
INFO - Documentation built in 0.71 seconds
$

without the tags_file option set in mkdocs.yml there is no such exception

Related links

Reproduction

9.5.19-tags-plugin-deprecationwarning-exception.zip

Steps to reproduce

  1. Setup tags with the tags_file option in an mkdocs project with mkdocs-material
  2. use mkdocs build or mkdocs serve

Browser

No response

Before submitting

@perpil
Copy link
Sponsor Contributor

perpil commented Apr 29, 2024

I'm also seeing similar warnings on mkdocs_git_revision_date_localized_plugin and the privacy plugins. If you'd like a separate issue for these, let me know and I'll cut one.

INFO    -  DeprecationWarning: Do not access Theme._vars, instead access the keys of Theme directly.
             File "/opt/homebrew/lib/python3.10/site-packages/mkdocs_git_revision_date_localized_plugin/plugin.py", line 82, in on_config
               theme_locale = custom_theme._vars.get("locale")
             File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/theme.py", line 87, in _vars
               warnings.warn(
INFO    -  DeprecationWarning: To replace an existing file, call `remove` before `append`.
             File "<snip>/mkdocs-material/material/plugins/privacy/plugin.py", line 445, in _queue
               self.assets.append(file)
             File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/structure/files.py", line 100, in append
               warnings.warn(

@squidfunk
Copy link
Owner

Thanks for reporting. Yes, those deprecation warnings are from MkDocs 1.6. It's a good idea to report the warning for the git-revision-date-localized-plugin upstream, if you can spare some time. I'll take care of the other warnings. Note that they do not impact the build, so you can just ignore them for now.

@squidfunk squidfunk added the bug Issue reports a bug label Apr 29, 2024
@squidfunk
Copy link
Owner

Fixed in cff4a75. I checked the release notes of 1.6, and either I'm not seeing it, or there was no mention of the fact that the files collection seems to have undergone a refactoring, inducing those deprecations. I'll check if I can reproduce the problem with the privacy plugin, or if we need a reproduction for that.

@squidfunk
Copy link
Owner

The privacy plugin should also be fixed in ff49d74. If not, please create a new issue with a minimal reproduction ✌️

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Apr 29, 2024
@squidfunk squidfunk changed the title Non-blocking "DeprecationWarning" exception on Tags plugin with tags index option set. Deprecation warning in tags plugin after upgrading MkDocs to 1.6 Apr 29, 2024
@squidfunk
Copy link
Owner

Released as part of 9.5.20.

@HotCakeX
Copy link

I'm also seeing similar warnings on mkdocs_git_revision_date_localized_plugin and the privacy plugins. If you'd like a separate issue for these, let me know and I'll cut one.

INFO    -  DeprecationWarning: Do not access Theme._vars, instead access the keys of Theme directly.
             File "/opt/homebrew/lib/python3.10/site-packages/mkdocs_git_revision_date_localized_plugin/plugin.py", line 82, in on_config
               theme_locale = custom_theme._vars.get("locale")
             File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/theme.py", line 87, in _vars
               warnings.warn(
INFO    -  DeprecationWarning: To replace an existing file, call `remove` before `append`.
             File "<snip>/mkdocs-material/material/plugins/privacy/plugin.py", line 445, in _queue
               self.assets.append(file)
             File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/structure/files.py", line 100, in append
               warnings.warn(

Hi,
I'm still seeing this on version 9.5.20, i personally don't know the technical details behind this warning message to report it to their repo in a proper detailed issue, because to me they're just abnormal warnings.

image

@squidfunk
Copy link
Owner

Reading the stack trace, this comes from the git-revision-date-localized-plugin. Please report it upstream.

@timvink
Copy link
Contributor

timvink commented Apr 30, 2024

FYI, new release is now on pypi https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/releases/tag/v1.2.5

@HotCakeX
Copy link

Thank you ^^
updating!

@squidfunk
Copy link
Owner

Awesome, thanks for fixing this so quickly, Tim!

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

5 participants