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
Vega-lite JSON schema validation fails with uri-reference errors #2794
Comments
Ouch! What a trip.. Not nice that jupyter cause a break of Altair now. Luckily you found, the hard way, a method to make it work again🫥. |
Thanks. I naively thought I was the first one to uncover this because my Google searches came back empty, but as you pointed out it looks like similar issues are already being discussed in #2705, #2767 and #2771. In particular @binste already figured out the problem, including the tricky interaction with Sorry about the duplicate report. Hopefully, at some point there will be enough of these that they will turn up in Google searches :/ |
See vega/altair#2794 for details.
See vega/altair#2794 for details.
Yes that is new information, also your suggestion how you can circumvent it with the latest jsonschema installed.
|
Thanks for reporting this in such detail. It is indeed quite worrying that an update to Jupyter breaks Altair and the large amount of people that would be affected by that. Happy to see that there is already a PR in progress for this. And @mattijn it seems like you are correct that Altair is installed around 300-400k times daily, and most of it seems to be automatic installs judging from that Linux is the dominating platform. |
Steps to reproduce:
With
altair-4.2.0
, the above fails with:But here's the twist: if you remove
rfc3986-validator
from thepip install
command in the above repro, it works!As you can imagine this is a bit of an head-scratcher. Here's what's going on:
jsonschema
fails to validate the Vega-lite schema. To be clear, the problem is not the vega-lite output - it's the schema itself that's invalid, because it contains$ref
values that are not validuri-reference
s. In the example above, the$ref
is#/definitions/Dict<unknown>
which is invalid because the<
and>
characters are not allowed in a RFC 3986 URI reference.Even though the schema is invalid, that goes unnoticed most of the time because
jsonschema
only validates uri-references if therfc3986-validator
orrfc3987
package is installed! This explains why Altair seems to work fine if these packages are missing.You may wonder how I ended up in this situation. Well this is where things gets a bit worrying, because I ended up triggering this latent bug simply by installing
jupyter
! This is because, a few months ago,jupyter_events
(whichjupyter
depends on) added a dependency onjsonschema[format-nongpl]
(see jupyter/jupyter_events@decd0ec), which in turns pullsrfc3986-validator
(figuring out that dependency chain was surprisingly hard - see pypa/pip#11683). Hilarity ensues, with the somewhat mind-blowing outcome that Altair is broken when a recentjupyter
is also installed.One workaround is to uninstall
rfc3986-validator
right after installing the package that pulled it (e.g.jupyter
):The text was updated successfully, but these errors were encountered: