squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
20.68k stars 3.52k forks source link

Google font loading breaks build on v9.5.7 (resolved in current release) #7012

Closed lmmx closed 6 months ago

lmmx commented 6 months ago

[Note this issue is resolved and just reported here for reference, please close as desired]

Context

I’ve been merrily deploying to Vercel for the last few months, and all was well until last week all of a sudden 4 or 5 of my builds suddenly broke.

These were pre-commit CI bot auto-updates, but upon review the breakage occurs even when I just re-run previous builds that succeeded.

I don’t suppose you have any idea why this might have happened?

The traceback seems to point to attempting to load a Google font and then getting something that’s not a zip file

I fixed by simply running pdm update to update my dependencies, and bumping to mkdocs-material 9.5.17

I thought I should report as I couldn’t find this reported anywhere else, and was surprised to see breakage introduced ‘retrospectively’ in this way, on a build that had previously succeeding.

Bug description

[20:10:36.075] DEBUG   -  Loading configuration file: /vercel/path0/mkdocs.yml
[20:10:36.241] DEBUG   -  Loaded theme configuration for 'material' from '/vercel/path0/.venv/lib/python3.11/site-packages/material/templates/mkdocs_theme.yml': {'language': 'en', 'direction': None, 'features': [], 'font': {'text': 'Roboto', 'code': 'Roboto Mono'}, 'icon': None, 'favicon': 'assets/images/favicon.png', 'static_templates': ['404.html']}
[20:10:37.060] DEBUG   -  Config value 'config_file_path' = '/vercel/path0/mkdocs.yml'
[20:10:37.060] DEBUG   -  Config value 'site_name' = 'Classipypi'
[20:10:37.060] DEBUG   -  Config value 'nav' = ['index.md', {'Setup': ['setup/install.md', 'setup/development.md']}, {'Usage': ['usage/index.md', 'usage/ls.md', 'usage/sel.md']}, {'API': [{'APIs': 'api/index.md'}, 'api/cli.md', 'api/core.md', {'Interfaces': ['api/interfaces/index.md', 'api/interfaces/display.md', 'api/interfaces/listing.md', 'api/interfaces/select.md']}]}]
[20:10:37.060] DEBUG   -  Config value 'pages' = None
[20:10:37.060] DEBUG   -  Config value 'exclude_docs' = None
[20:10:37.060] DEBUG   -  Config value 'not_in_nav' = None
[20:10:37.061] DEBUG   -  Config value 'site_url' = 'https://classipypi.vercel.app/'
[20:10:37.061] DEBUG   -  Config value 'site_description' = "Neural PyPI package 'Trove classifier' selector."
[20:10:37.061] DEBUG   -  Config value 'site_author' = 'Louis Maddox'
[20:10:37.061] DEBUG   -  Config value 'theme' = Theme(name='material', dirs=['/vercel/path0/.venv/lib/python3.11/site-packages/material/templates', '/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/templates'], static_templates={'sitemap.xml', '404.html'}, name='material', locale=Locale('en'), language='en', direction=None, features=['announce.dismiss', 'content.tabs.link', 'content.code.annotate', 'content.code.copy', 'header.autohide', 'navigation.indexes', 'navigation.instant', 'navigation.instant.progress', 'navigation.prune', 'navigation.tabs', 'navigation.tabs.sticky', 'navigation.sections', 'search', 'search.suggest'], font={'text': 'Inter', 'code': 'Source Code Pro'}, icon={'repo': 'fontawesome/brands/github'}, favicon='assets/images/favicon.png', palette=[{'scheme': 'default', 'primary': 'white'}])
[20:10:37.061] DEBUG   -  Config value 'docs_dir' = '/vercel/path0/docs'
[20:10:37.061] DEBUG   -  Config value 'site_dir' = '/vercel/path0/site'
[20:10:37.061] DEBUG   -  Config value 'copyright' = 'Copyright © 2024 Louis Maddox'
[20:10:37.061] DEBUG   -  Config value 'google_analytics' = None
[20:10:37.061] DEBUG   -  Config value 'dev_addr' = _IpAddressValue(host='127.0.0.1', port=8000)
[20:10:37.061] DEBUG   -  Config value 'use_directory_urls' = True
[20:10:37.061] DEBUG   -  Config value 'repo_url' = 'https://github.com/lmmx/classipypi'
[20:10:37.061] DEBUG   -  Config value 'repo_name' = 'lmmx/classipypi'
[20:10:37.062] DEBUG   -  Config value 'edit_uri_template' = None
[20:10:37.062] DEBUG   -  Config value 'edit_uri' = 'edit/master/docs/'
[20:10:37.062] DEBUG   -  Config value 'extra_css' = ['stylesheets/extra.css']
[20:10:37.062] DEBUG   -  Config value 'extra_javascript' = []
[20:10:37.062] DEBUG   -  Config value 'extra_templates' = []
[20:10:37.062] DEBUG   -  Config value 'markdown_extensions' = ['toc', 'tables', 'fenced_code', 'admonition', 'attr_list', 'md_in_html', 'pymdownx.blocks.definition', 'pymdownx.details', 'pymdownx.emoji', 'pymdownx.highlight', 'pymdownx.inlinehilite', 'pymdownx.snippets', 'pymdownx.superfences', 'pymdownx.tasklist']
[20:10:37.062] DEBUG   -  Config value 'mdx_configs' = {'pymdownx.emoji': {'emoji_index': <function twemoji at 0x7f29feb09800>, 'emoji_generator': <function to_svg at 0x7f29fea314e0>}, 'pymdownx.highlight': {'anchor_linenums': True, 'line_spans': '__span', 'pygments_lang_class': True, 'noclasses': True, 'pygments_style': 'lovelace'}, 'toc': {'permalink': True}, 'pymdownx.tasklist': {'custom_checkbox': True}}
[20:10:37.062] DEBUG   -  Config value 'strict' = True
[20:10:37.062] DEBUG   -  Config value 'remote_branch' = 'gh-pages'
[20:10:37.063] DEBUG   -  Config value 'remote_name' = 'origin'
[20:10:37.063] DEBUG   -  Config value 'extra' = {'social': [{'icon': 'fontawesome/brands/github', 'link': 'https://github.com/lmmx'}], 'generator': False}
[20:10:37.063] DEBUG   -  Config value 'plugins' = {'autorefs': <mkdocs_autorefs.plugin.AutorefsPlugin object at 0x7f29fe167bd0>, 'macros': <mkdocs_macros.plugin.MacrosPlugin object at 0x7f29fe168ad0>, 'mkdocstrings': <mkdocstrings.plugin.MkdocstringsPlugin object at 0x7f29fe165910>, 'material/search': <material.plugins.search.plugin.SearchPlugin object at 0x7f29fdd59ad0>, 'section-index': <mkdocs_section_index.plugin.SectionIndexPlugin object at 0x7f29fde1bbd0>, 'material/social': <material.plugins.social.plugin.SocialPlugin object at 0x7f29fde1b610>}
[20:10:37.063] DEBUG   -  Config value 'hooks' = {}
[20:10:37.063] DEBUG   -  Config value 'watch' = ['/vercel/path0/src']
[20:10:37.063] DEBUG   -  Config value 'validation' = {'nav': {'omitted_files': 20, 'not_found': 30, 'absolute_links': 20}, 'links': {'not_found': 30, 'absolute_links': 20, 'unrecognized_links': 20}}
[20:10:37.063] DEBUG   -  Running 1 `startup` events
[20:10:37.064] DEBUG   -  Running 5 `config` events
[20:10:37.064] DEBUG   -  mkdocs_autorefs: Adding AutorefsExtension to the list
[20:10:37.064] INFO    -  [macros] - Macros arguments: {'module_name': 'docs/hooks/macros', 'modules': [], 'render_by_default': True, 'include_dir': '', 'include_yaml': [], 'j2_block_start_string': '', 'j2_block_end_string': '', 'j2_variable_start_string': '', 'j2_variable_end_string': '', 'on_undefined': 'keep', 'on_error_fail': False, 'verbose': False}
[20:10:37.082] DEBUG   -  [macros] - Project dir '/vercel/path0'
[20:10:37.082] INFO    -  [macros] - Found local Python module 'docs/hooks/macros' in: /vercel/path0
[20:10:37.083] INFO    -  [macros] - Found external Python module 'docs/hooks/macros' in: /vercel/path0
[20:10:37.083] DEBUG   -  [macros] - Variables: ['extra', 'config', 'environment', 'plugin', 'git', 'social', 'generator']
[20:10:37.083] INFO    -  [macros] - Extra variables (config file): ['social', 'generator']
[20:10:37.083] DEBUG   -  [macros] - Content of extra variables (config file): {'social': [{'icon': 'fontawesome/brands/github', 'link': 'https://github.com/lmmx'}], 'generator': False}
[20:10:37.083] INFO    -  [macros] - Extra filters (module): ['pretty']
[20:10:37.083] DEBUG   -  [macros] - Docs directory: /vercel/path0/docs
[20:10:37.083] DEBUG   -  [macros] - Includes directory: /vercel/path0/docs
[20:10:37.083] DEBUG   -  [macros] - Undefined behavior: <class 'jinja2.runtime.DebugUndefined'>
[20:10:37.084] DEBUG   -  mkdocstrings: Adding extension to the list
[20:10:37.084] DEBUG   -  mkdocstrings: Picked up existing autorefs instance <mkdocs_autorefs.plugin.AutorefsPlugin object at 0x7f29fe167bd0>
[20:10:37.084] DEBUG   -  Looking for translations for locale 'en'
[20:10:37.084] DEBUG   -  No translations found here: '/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/templates/locales'
[20:10:37.084] DEBUG   -  No translations found here: '/vercel/path0/.venv/lib/python3.11/site-packages/material/templates/locales'
[20:10:37.095] DEBUG   -  Looking for translations for locale 'en'
[20:10:37.095] DEBUG   -  No translations found here: '/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/templates/locales'
[20:10:37.095] DEBUG   -  No translations found here: '/vercel/path0/.venv/lib/python3.11/site-packages/material/templates/locales'
[20:10:37.104] DEBUG   -  Looking for translations for locale 'en'
[20:10:37.104] DEBUG   -  No translations found here: '/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/templates/locales'
[20:10:37.105] DEBUG   -  No translations found here: '/vercel/path0/.venv/lib/python3.11/site-packages/material/templates/locales'
[20:10:37.250] Traceback (most recent call last):
[20:10:37.250]   File "/vercel/path0/.venv/bin/mkdocs", line 8, in <module>
[20:10:37.250]     sys.exit(cli())
[20:10:37.250]              ^^^^^
[20:10:37.250]   File "/vercel/path0/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
[20:10:37.250]     return self.main(*args, **kwargs)
[20:10:37.250]            ^^^^^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.250]   File "/vercel/path0/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
[20:10:37.250]     rv = self.invoke(ctx)
[20:10:37.250]          ^^^^^^^^^^^^^^^^
[20:10:37.250]   File "/vercel/path0/.venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
[20:10:37.250]     return _process_result(sub_ctx.command.invoke(sub_ctx))
[20:10:37.251]                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.251]   File "/vercel/path0/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
[20:10:37.251]     return ctx.invoke(self.callback, **ctx.params)
[20:10:37.251]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.251]   File "/vercel/path0/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
[20:10:37.251]     return __callback(*args, **kwargs)
[20:10:37.251]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.251]   File "/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/__main__.py", line 286, in build_command
[20:10:37.251]     build.build(cfg, dirty=not clean)
[20:10:37.251]   File "/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/commands/build.py", line 277, in build
[20:10:37.251]     config = config.plugins.on_config(config)
[20:10:37.251]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.251]   File "/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 527, in on_config
[20:10:37.251]     return self.run_event('config', config)
[20:10:37.252]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.252]   File "/vercel/path0/.venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 507, in run_event
[20:10:37.252]     result = method(item, **kwargs)
[20:10:37.252]              ^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.252]   File "/vercel/path0/.venv/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 138, in on_config
[20:10:37.252]     self.font = self._load_font(config)
[20:10:37.252]                 ^^^^^^^^^^^^^^^^^^^^^^^
[20:10:37.252]   File "/vercel/path0/.venv/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 454, in _load_font
[20:10:37.252]     self._load_font_from_google(name)
[20:10:37.252]   File "/vercel/path0/.venv/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 477, in _load_font_from_google
[20:10:37.252]     zip = ZipFile(tmp)
[20:10:37.252]           ^^^^^^^^^^^^
[20:10:37.252]   File "/vercel/micromamba/lib/python3.11/zipfile.py", line 1304, in __init__
[20:10:37.252]     self._RealGetContents()
[20:10:37.252]   File "/vercel/micromamba/lib/python3.11/zipfile.py", line 1371, in _RealGetContents
[20:10:37.253]     raise BadZipFile("File is not a zip file")
[20:10:37.253] zipfile.BadZipFile: File is not a zip file
[20:10:37.393] Error: Command "bash ./docs/vercel/build.sh" exited with 1
[20:10:37.728] 

Related links

Fonts docs

Reproduction

This occurred on my package classipypi for example which uses Google fonts

Steps to reproduce

mkdocs-material 9.5.7 using this config for example

Browser

No response

Before submitting

squidfunk commented 6 months ago

Thanks for reporting. You're correct that this is resolved in 9.5.17 – so nothing more to be done here ☺️