-
Notifications
You must be signed in to change notification settings - Fork 626
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
Create plotly.js bundle map programmatically #2336
base: master
Are you sure you want to change the base?
Conversation
Creates the proper `bundleTraceMap` list as internal data object directly from the upstream JS file when updating plotly.js. This commit adds an updated `bundleTraceMap` for the currently used plotly.js v2.11.1 to `R/sysdata.rda`.
Note that the failing tests are unrelated to this PR, AFAICT. |
DESCRIPTION
Outdated
@@ -23,7 +23,7 @@ Description: Create interactive web graphics from 'ggplot2' graphs and/or a cust | |||
URL: https://plotly-r.com, https://github.com/plotly/plotly.R, https://plotly.com/r/ | |||
BugReports: https://github.com/plotly/plotly.R/issues | |||
Depends: | |||
R (>= 3.2.0), | |||
R (>= 3.5), |
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.
Is this necessary?
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.
It's a requirement for R's latest serialization format (v3), cf. this line. We could stay on the v2 format if it's really important to support R < 3.5.
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.
The line you're referring to is a build time, not run time dependency, so the version bump requirement isn't necessary
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.
Yeah, but it also becomes a runtime dependency once we ship pkg-internal data in v3 format (which we do with this PR). To cite the relevant doc:
Version 3 became the default from R 3.6.0 and can only be read by R versions 3.5.0 and higher.
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.
Ahh, right, thanks for pointing that out. Could we just keep the current behavior? It doesn't seem worth it to me to break compatibility for relatively small R objects that only get loaded once
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.
Keeping the current behaviour is fine with me. But OTOH, R 3.5.0 was released more than 6 years ago, so I don't think we ought to care about supporting even more ancient versions.
I'll have a look at your other comments tomorrow. I'll revert to v2 serialization format then if you still think it's worth it :)
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.
I've reverted to the v2 serialization format, see 93ef777.
This makes non-base-R dependencies clearly apparent
@cpsievert Anything else I need to do to get this merged? |
tools/update_plotlyjs.R
Outdated
stringr::str_extract(pattern = "(?<=var partialBundleTraces = )\\{[^}]+\\}") |> | ||
yaml::read_yaml(text = _) |
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.
It'd be nice if this could also handle const
as well as throw informative errors if the str_extract()
comes up empty
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.
Addressed in 74a4f4f.
Creates the proper
bundleTraceMap
list as internal package data object directly from the upstream JS file when plotly.js is updated.The data is sourced from the file
tasks/util/constants.js
of the matching plotly.js Git tagviayay::gh_text_file()
, which I wrote. The package is not (yet) available on CRAN and thus must be installed viaremotes::install_gitlab("rpkg.dev/yay")
for the time being. I think this shouldn't be an issue sincetools/update_plotlyjs.R
is run manually during development and is not intended to be run by users.This commit adds an updated
bundleTraceMap
for the currently used plotly.js v2.11.1 toR/sysdata.rda
, which now also includes plotly.js'strict
bundle, so nowplotly::partial_bundle(type = "strict")
works as intended.