-
Notifications
You must be signed in to change notification settings - Fork 794
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
Update to Vega-Lite 4.17.0 #2513
Conversation
Sample417
The way the schema is written for TopLevelRepeatSpec gives the current code trouble. We patch it in an ad hoc way, and should later find a more sustainable method.
This looks great! Thanks for taking a stab at it. In terms of the RepeatSpec issue, I do think this is an Altair issue rather than a Vega-Lite issue. In the past, all top-level specs have been objects rather than unions, but I don't think deviating from this is indicative of a bug. It's just something the Altair wrappers need to be expanded to handle. I think rather than patching the JSON, the best fix would be to define the expected API in this class: https://github.com/altair-viz/altair/blob/8a8642b2e7eeee3b914850a8f7aacd53335302d9/altair/vegalite/v3/api.py#L1824 That is, you can derive that from |
Regarding the testing: the way I've done it in the past is to add a branch to altair viewer with the necessary changes, and temporarily adjust the CI in this branch to point to that. Then when we're happy with everything, we cut a new altair-viewer release and then change this CI back to normal. |
From here: 3fc9a86 I see you update master of altair_viewer to include support for VL4.8.1. Once altair-viz/altair_viewer#43 is merged we can follow same principle. |
Hmm, this isn't an error I've seen before; is it obvious what it means? Trying it on my computer I got a similar error, and it seemed to point to line 278 here: https://github.com/ChristopherDavisUCI/altair/blob/25baa86dbd921a30761bcc5300b0c06397eae99d/altair/sphinxext/altairplot.py#L275-L282 |
Ah, yeah I think the issue there is that our default class wrapper thing is too aggressive now. We probably don't want that. So we'll need a way to distinguish between Perhaps we could explicitly register "simple" schemas (like |
Another piece of context here: it's very tempting to introduce specific patches or checks to fix this kind of bug as it comes up... the problem with that is that as Vega-Lite evolves, those kinds of one-off changes become very difficult to manage and maintain. It's a mistake I made early on in writing Altair. That's why, for each of these issues, my inclination is to try to solve the most general version of the problem that's surfacing, because then maybe future upgrades will be just a bit easier. |
I experimented a little with some of the examples and most of them still seem to work correctly. Here is the smallest example I could find that does not work:
Here is the result of
|
Ah, that’s helpful. My guess is there’s a to_dict call missing somewhere in the dataset handler. |
I'm not sure if my commit resolves the effect or the cause. But before, this:
resolved into So I apply |
if isinstance(data.values, core.InlineDataset): | ||
values = data.values.to_dict() | ||
else: | ||
values = data.values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find! This seems like the right fix. Maybe make it a bit more robust and do
values = data.to_dict()['values']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I think this is looking pretty good! What do you think? Anything missing at this point? Before merging, I'll create a new altair_viewer release and we can change the CI requirements back to normal. |
Nothing missing that I'm aware of! |
Merge-ready! +1 |
This is awesome! Thank you all so much for working on this PR, the notifications from this thread have been my favorite morning read over the last few days ❤️ |
In altair-viz/altair_viewer#45 I added the most recent vega & vega-embed versions to altair viewer. I triggered a re-run of the CI here to make sure there are no issues. |
Alright, altair-viewer 0.4.0 is released! We can remove the temporary reference to its github branch from this PR |
I checked if the tests use |
Thanks all - I think we should merge this! Given the number of commits & nonlinear history, I think I'll opt to squash and merge – I believe that will maintain correct authorship (@ChristopherDavisUCI will be in the author field, @mattijn will be listed in "Co-authored By" and I would be in the committer field). Is everyone happy with that? |
Great! That definitely sounds good to me. (It will be especially nice to get rid of some of those commits going back and forth between different fixes for TopLevelRepeatSpec.) |
Perfect |
Alright, it's done! Thanks all, this is really great work 🎉 |
Awesome! Will there be a corresponding "release"? This has been a very fun (and fast-moving) process so I'd like to try playing around with vega-lite version 5. Is it better if I make a pull request early and then you can see what we're trying along the way, or should I wait until we're "finished" or "stuck" and then make the pull request? I think many changes will be necessary related to selections. In general I'm very open to suggestions, like "make fewer commits" or "make smaller self-contained pull requests" or whatever. Thanks for all the attention! |
Regarding a release... I'd like to iron-out the "default data" issue discussed above. I also did a bit of maintenance stuff this morning (updating CI jobs, etc.) but yes, it would be great if we could get a release candidate out sometime this week. Regarding VL5 - that would be great if you want to open a draft PR! The biggest issue I anticipate there is that VL5 replaced "selections" with a more general "params" specification, so I suspect a number of things will have to change to accommodate that. |
I've experimented a little with Vega-Lite v5 on this branch, although I might want to redo some things now that I better understand what's going on. Surprisingly the biggest obstacle so far hasn't been
I don't see a good way to deal with that. Do you have a suggestion? I've read the list of "breaking changes" for the Vega-Lite 5.0.0 release and don't see anything that seems related to this, so it does make me wonder if maybe I misunderstand the cause of the problem. |
Hi Chris, if you move your last comment to here #2425, or start a new pull request titled 'WIP: update to Vega-Lite 5' and add your observations there, than I'm more than happy to join the process (and maybe others as well!). It would be nice if we can get further with fewer help from Jake. Its indeed super awesome to align a few brains and go forward, but be careful, it's addicting and if its your spare-time than other things also probably like attention;) But if we can give ourselves a Christmas gift with a new Altair release, either based on VL4.17 or 5, then I think we are doing great. |
Hi again,
@mattijn and I have tried to update the Pull Request from last week, taking into account your suggestions and trying to get all the tests (that I know about) to work.
Here are some of the main changes from the current Altair release:
DatumSchemaGenerator
andDatumChannelMixin
ingenerate_schema_wrapper.py
.generate_vegalite_channel_wrappers
here to allow for the possibility of a datum.infer_encoding_types
fromaltair/utils/core.py
here to recognize Datum class names.get_valid_identifier
intools/schemapi/utils.py
to deal with some symbols like[]
appearing in certain names in the Vega-Lite schema. (Removing those symbols led to some duplicated class names.)TopLevelMixin
fromaltair/vegalite/v4/api.py
to allow forlayer
to be repeated, in addition torow
andcolumn
.Row
withColumn
withFacet
.)mark_arc
and layering in repeat here.test_vegalite_to_vega_mimebundle
to work here.Main outstanding issue that we know of:
v4.9
, the format ofTopLevelRepeatSpec
changed in the Vega-Lite schema. We have some code to deal with this by editing the definition ofTopLevelRepeatSpec
in the downloaded JSON file. We've tried asking on the Vega-Lite Slack channel and as a Vega-Lite GitHub issue, but it seems like the issue is on the Altair side, not the Vega-Lite side. If the rest of the changes seem mostly in good shape, I can focus on finding a more adequate solution.This is not part of the current Pull Request, but to get some of the tests to work, we made the following changes to altair_viewer:
vega-lite-4.17.0.js
inaltair_viewer\altair_viewer\scripts
listing.json
inaltair_viewer\scripts
Thank you for any feedback!