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

social plugin build issue #5493

Closed
4 tasks done
fengtality opened this issue May 9, 2023 · 13 comments
Closed
4 tasks done

social plugin build issue #5493

fengtality opened this issue May 9, 2023 · 13 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@fengtality
Copy link

Context

No response

Bug description

I just started seeing errors in the build process related to social card plugins that is blocking deployment. Nothing changed in our docs, so I'm flagging this issue just in case.

Here's my Netlify build command:

pip install git+[https://$](https://%24/){GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git mkdocs-git-revision-date-plugin pillow cairosvg p && mkdocs build

I was able to resolve this issue by commenting out the social cards feature in (hummingbot/hummingbot-site#188, but I'd like to bring them back.

Related links

Reproduction

Here's the error from Netlify logs:

6:05:32 AM: Traceback (most recent call last):
6:05:32 AM:   File "/opt/buildhome/python3.8/bin/mkdocs", line 8, in <module>
6:05:32 AM:     sys.exit(cli())
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/click/core.py", line 829, in __call__
6:05:32 AM:     return self.main(*args, **kwargs)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/click/core.py", line 782, in main
6:05:32 AM:     rv = self.invoke(ctx)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
6:05:32 AM:     return _process_result(sub_ctx.command.invoke(sub_ctx))
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
6:05:32 AM:     return ctx.invoke(self.callback, **ctx.params)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/click/core.py", line 610, in invoke
6:05:32 AM:     return callback(*args, **kwargs)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/__main__.py", line 247, in build_command
6:05:32 AM:     cfg = config.load_config(**kwargs)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/config/base.py", line 363, in load_config
6:05:32 AM:     errors, warnings = cfg.validate()
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/config/base.py", line 228, in validate
6:05:32 AM:     run_failed, run_warnings = self._validate()
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/config/base.py", line 186, in _validate
6:05:32 AM:     self[key] = config_option.validate(value)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 148, in validate
6:05:32 AM:     return self.run_validation(value)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 940, in run_validation
6:05:33 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:05:32 AM:     self.load_plugin_with_namespace(name, cfg)
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 976, in load_plugin_with_namespace
6:05:32 AM:     return (name, self.load_plugin(name, config))
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 994, in load_plugin
6:05:32 AM:     plugin_cls = self.installed_plugins[name].load()
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 210, in load
6:05:32 AM:     module = import_module(match.group('module'))
6:05:32 AM:   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
6:05:32 AM:     return _bootstrap._gcd_import(name[level:], package, level)
6:05:32 AM:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
6:05:32 AM:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
6:05:32 AM:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
6:05:32 AM:   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
6:05:32 AM:   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
6:05:32 AM:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/material/plugins/social/plugin.py", line 48, in <module>
6:05:32 AM:     from material.plugins.social.layout import Layer, Layout, Line
6:05:32 AM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/material/plugins/social/layout.py", line 94, in <module>
6:05:32 AM:     def get_size(layer: Layer | Layout):
6:05:32 AM: TypeError: unsupported operand type(s) for |: '_TypedDictMeta' and '_TypedDictMeta'
6:05:32 AM: ​
6:05:32 AM: "build.command" failed                                        
6:05:32 AM: ────────────────────────────────────────────────────────────────

Steps to reproduce

I wasn't able to reproduce the issue on my Mac

Browser

No response

Before submitting

@squidfunk
Copy link
Owner

Thanks for reporting. I think it's related to the Python version – you're using 3.8, we're using 3.11 without issues. I'll check if we can support 3.8 as well, or add a note to the documentation that 3.11 is needed for that.

@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label May 9, 2023
@squidfunk
Copy link
Owner

Should be fixed in 44f0897. My research tells me that the pipe syntax for union typings was first introduced in 3.10. Using Union[...] achieves the same, so I switched to that syntax. I searched the code base and this seems to be the only instance. Could you try again with the master of Insiders?

@zanieb
Copy link

zanieb commented May 9, 2023

@squidfunk that does resolve that error but we're seeing another version compatibility issue

2:42:19 PM:   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
2:42:19 PM:     return _bootstrap._gcd_import(name[level:], package, level)
2:42:19 PM:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2:42:19 PM:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2:42:19 PM:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2:42:19 PM:   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2:42:19 PM:   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
2:42:19 PM:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2:42:19 PM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/material/plugins/social/plugin.py", line 56, in <module>
2:42:19 PM:     class SocialPlugin(BasePlugin[SocialConfig]):
2:42:19 PM:   File "/opt/buildhome/python3.8/lib/python3.8/site-packages/material/plugins/social/plugin.py", line 641, in SocialPlugin
2:42:19 PM:     def _resolve_font(self, family: str, styles: set[str]):
2:42:19 PM: TypeError: 'type' object is not subscriptable

See PrefectHQ/prefect#9501 for example

Thanks!

@zanieb
Copy link

zanieb commented May 9, 2023

FYI Netlify only supports Python 3.8 so it's important to maintain compatibility with 3.8 for many users. Your package also says it supports 3.7+ — might be worth running a CI workflow that tests the lowest compatible version too.

@squidfunk
Copy link
Owner

Fixed in a9dda0990 – tested with Python 3.7 and 3.8 and the social plugin now runs without errors in 3.8. 3.7 does not run due to the use of some typings, so we'll up the requirement to Python 3.8+. I'm sorry for the inconvenience this was causing you, and yes, we'll be working on improving compatibility testing in the future!

@squidfunk
Copy link
Owner

squidfunk commented May 10, 2023

Bumped the version to 3.8+ in 88515d2. – reverted it for now. I'll check if we can do better.

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open and removed needs investigation Issue must be investigated by the maintainers labels May 10, 2023
@bilal-fazlani
Copy link

Does not appear be to fixed in a9dda0990

Checked on latest insider too 43c30522afe4bdbd89da17b0c3c314d17e621541

@squidfunk
Copy link
Owner

squidfunk commented May 12, 2023

@bilal-fazlani could you please create a reproduction? I'm not sure what you're now seeing, but I can't reproduce the error anymore. Please use the info plugin, so we have all information available (especially environment).

@squidfunk
Copy link
Owner

Released as part of 9.1.12+insiders-4.33.2. @bilal-fazlani if you manage to create a reproduction, please open a new issue.

@bilal-fazlani
Copy link

Its working now. Not sure what was the issue but it was definitely on my local environment.

@squidfunk
Copy link
Owner

squidfunk commented May 27, 2023

As of 9.1.14+insiders-4.35.0, the social plugin should be compatible with Python 3.7. We replaced TypedDict, which was the main problem, with instances of Config when adding validation to custom layouts.

@shaloo
Copy link

shaloo commented Mar 29, 2024

Its working now. Not sure what was the issue but it was definitely on my local environment.

I began seeing the same issue again today with 3.8 (Netlify). Works fine in my local environment (Python 3.9). How did it get fixed for you? I did not change the code - Netlify deployment was working for the same commit until March 26 (it is published), but since March 27 the same commit build is failing with this zipfile error for google font loading in social plugin. Weird.

@alexvoss
Copy link
Collaborator

Hi @shaloo, the Google Fonts issue is a separate issue documented here: #6983

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

6 participants