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

Markup.__init__ causes error #1400

Closed
kernc opened this issue Apr 18, 2021 · 4 comments · Fixed by #1401
Closed

Markup.__init__ causes error #1400

kernc opened this issue Apr 18, 2021 · 4 comments · Fixed by #1401
Labels

Comments

@kernc
Copy link

kernc commented Apr 18, 2021

I obviously don't expect you to debug my --pre CI runs, but what I read points to recent Jinja 3.0.0rc1 / markupsafe 2.0.0rc2 prereleases. Please see: https://github.com/kernc/backtesting.py/runs/2371946706?check_suite_focus=true#step:11:234

The error:

TypeError: object.__init__() takes exactly one argument (the instance to initialize)

issued here:

super().__init__(*args, **kwargs)

seems to indicate markupsafe.Markup for some reason is object rather than str. 😕

Environment:

  • Python version: 3.8
  • MarkupSafe version: 2.0.0rc2
@davidism
Copy link
Member

davidism commented Apr 18, 2021

It looks like Bokeh is doing from jinja2 import Markup. They should update to from markupsafe import Markup. (This has been the case for a while, but we only recently noticed and made it issue a deprecation warning.)

It does look like overriding __init__ to show a warning is causing issues in this case because of how subclassing str works, so I'll fix that, but ultimately Bokeh will need to update. You can report it to them if you'd like, or if they run their tests with DeprecationWarning turned into errors they'll see failures once they test against Jinja 3.0.

@davidism davidism transferred this issue from pallets/markupsafe Apr 18, 2021
@davidism davidism added the bug label Apr 18, 2021
@davidism davidism changed the title Markupsafe 2.0.0rc2 breaks CI Markup.__init__ causes error Apr 18, 2021
@kernc
Copy link
Author

kernc commented Apr 18, 2021

Reported to Bokeh in bokeh/bokeh#11174 and bokeh/bokeh#11175.

Many thanks for your feedback!

@davidism
Copy link
Member

I'm not going to make an rc2 release quite yet, I'll wait to see what other feedback comes in. I'd suggest pinning your dependencies for testing (and possibly in general depending on whether you're a library or end-user project), unless you were deliberately testing all pre-releases.

@davidism
Copy link
Member

pip install --pre -U jinja2 to get Jinja 3.0.0rc2.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants