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

Unable to build 9.5.3-insiders-4.49.1 with tags plugin on Netlify (Python 3.8) #6627

Closed
4 tasks done
shepherdjerred opened this issue Jan 8, 2024 · 10 comments
Closed
4 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@shepherdjerred
Copy link

shepherdjerred commented Jan 8, 2024

Context

No response

Bug description

9.5.3-insiders-4.49.1 with the tags plugin does not build on Python 3.8:

$ pipenv install
Creating a virtualenv for this project...
Pipfile: /Users/jerred/git/posit/docs.rstudio.com/Pipfile
Using /Users/jerred/.local/share/mise/installs/python/3.8/bin/python3.8 (3.8.18) to create virtualenv...
⠦ Creating virtual environment...created virtual environment CPython3.8.18.final.0-64 in 551ms
  creator CPython3Posix(dest=/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/jerred/Library/Application Support/virtualenv)
    added seed packages: pip==23.2.1, setuptools==68.1.2, wheel==0.41.2
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F
Installing dependencies from Pipfile.lock (922421)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

$ pipenv run mkdocs build
Traceback (most recent call last):
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/__main__.py", line 283, in build_command
    cfg = config.load_config(**kwargs)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/base.py", line 378, in load_config
    errors, warnings = cfg.validate()
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/base.py", line 230, in validate
    run_failed, run_warnings = self._validate()
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/base.py", line 188, in _validate
    self[key] = config_option.validate(value)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 182, in validate
    return self.run_validation(value)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 1064, in run_validation
    self.load_plugin_with_namespace(name, cfg)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 1102, in load_plugin_with_namespace
    return (name, self.load_plugin(name, config))
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 1120, in load_plugin
    plugin_cls = self.installed_plugins[name].load()
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 184, in load
    module = import_module(match.group('module'))
  File "/Users/jerred/.local/share/mise/installs/python/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/plugins/tags/plugin.py", line 28, in <module>
    from material.utilities.filter import PageFilter
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/utilities/filter/__init__.py", line 32, in <module>
    class Filter:
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/utilities/filter/__init__.py", line 51, in Filter
    def __call__(self, value: str, ref: str | None = None) -> bool:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType

Union types were added in Python 3.10, but Netlify only supports Python 3.8. Netlify does not plan to support newer versions.

Related links

Reproduction

mkdocs.zip

Steps to reproduce

  1. Install Python 3.8
  2. Create a project using 9.5.3-insiders-4.49.1
  3. Enable the tags plugin
  4. Run mkdocs build

Browser

No response

Before submitting

@evan-flynn-apexai
Copy link

fyi @shepherdjerred the last insiders tag before this breaking change was 9.5.2-insiders-4.47.1 👍

@squidfunk
Copy link
Owner

Thanks for reporting! We're definitely interested in supporting Python 3.8, so this is an oversight on our side. It should be fixed with 691849d. Note that we're also working on setting up a proper testing environment right now, so that we catch problems like this earlier, but it is still a way to go. We hope to finish it before 3.8 EOL 😅

I'm quite amazed to read that Netlify isn't doing anything to support newer Python versions. Are there maybe alternative platforms that could be used?

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open labels Jan 9, 2024
@shepherdjerred
Copy link
Author

Thanks for such a quick fix!

Are there maybe alternative platforms that could be used?

It's pretty embarrassing that Netlify hasn't updated their supported Python versions. We only use Netlify for deploy previews since it's so convenient and already setup. I'm sure there are alternatives, but we just haven't prioritized it.

@shepherdjerred
Copy link
Author

shepherdjerred commented Jan 9, 2024

I tried with the latest commit on master (https://github.com/squidfunk/mkdocs-material-insiders/commit/8721121c2ce4151d86fe868d5f8c9ca7257b9708)

I now see this error:

$ pipenv run mkdocs build
Traceback (most recent call last):
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/__main__.py", line 283, in build_command
    cfg = config.load_config(**kwargs)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/base.py", line 378, in load_config
    errors, warnings = cfg.validate()
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/base.py", line 230, in validate
    run_failed, run_warnings = self._validate()
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/base.py", line 188, in _validate
    self[key] = config_option.validate(value)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 182, in validate
    return self.run_validation(value)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 1064, in run_validation
    self.load_plugin_with_namespace(name, cfg)
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 1102, in load_plugin_with_namespace
    return (name, self.load_plugin(name, config))
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 1120, in load_plugin
    plugin_cls = self.installed_plugins[name].load()
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 184, in load
    module = import_module(match.group('module'))
  File "/Users/jerred/.local/share/mise/installs/python/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/plugins/tags/plugin.py", line 35, in <module>
    from .config import TagsConfig
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/plugins/tags/config.py", line 30, in <module>
    from .structure.listing import ListingConfig
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/plugins/tags/structure/listing/__init__.py", line 30, in <module>
    from .config import ListingConfig
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/plugins/tags/structure/listing/config.py", line 23, in <module>
    from material.plugins.tags.structure.tag.options import TagSet
  File "/Users/jerred/.local/share/virtualenvs/docs.rstudio.com-TOJwUm7F/lib/python3.8/site-packages/material/plugins/tags/structure/tag/options.py", line 32, in <module>
    class TagSet(BaseConfigOption[set[Tag]]):
TypeError: 'type' object is not subscriptable

I'm not sure if this is just an issue with tags on Python 3.8, or if it's something more specific. I can provide a full reproduction if you'd like.

@squidfunk
Copy link
Owner

Fixed in 210aedf. I'm so much looking forward to 3.8 EOL 😅

@normandy7
Copy link

Fixed in 210aedf. I'm so much looking forward to 3.8 EOL 😅

Any idea when we can expect a release? 🙂

@squidfunk
Copy link
Owner

As soon as we know that all issues are fixed. My testing shows that the latest commit fixes all issues with Python 3.8. If you can confirm that I can push out a release in 15min.

@squidfunk
Copy link
Owner

Okay, I went ahead and released the changes because I'm quite confident that this should be fixed. Sorry for the inconvenience, but I'm happy that we could resolve it in half a day. Released as part of 9.5.3+insiders-4.49.2.

@normandy7
Copy link

I can confirm that our build (also on Python 3.8) no longer fails when installing from the commit you mentioned. Thanks!

@shepherdjerred
Copy link
Author

That worked for me. Thanks again for fixing this so quickly.

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

4 participants