-
Notifications
You must be signed in to change notification settings - Fork 135
Add backend-controlled format options to data explorer #11051
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
base: main
Are you sure you want to change the base?
Conversation
|
Thank you all for this PR! We ask that you sign our Contributor License Agreement before we accept your contribution. You can sign the CLA by posting a comment on this PR saying: I have read the CLA Document and I hereby sign the CLA 1 out of 2 committers have signed the CLA. |
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
1b478e1 to
2e51bef
Compare
|
@juliasilge I can't get copilot to sign the CLA, can you help me with this? |
|
recheck |
|
@juliasilge Hmm the same problem (Copilot not included in the allowlist) also appears here: positron/.github/workflows/cla.yml Line 52 in 50d0337
|
Addresses #4818. I attempted to address this problem by #7266, but that was rejected for the reason that it is more desirable to let the backends control formatting options rather than a global config. This PR takes exactly the latter approach.
Note that this PR only adds an optional format_options field to the protocol, and the functionality requires corresponding changes to the backends to respect the new protocol. posit-dev/ark#987 implements this for ark (the R backend).
The combined end result looks like (using the code example in the original issue):

Changes
Protocol Layer
format_optionsfield toBackendStateindata_explorer-backend-openrpc.jsonFormatOptionsin backend stateFrontend Integration
DataExplorerClientInstance.updateBackendState()to merge backend-provided format options with defaultsDEFAULT_DATA_THOUSANDS_SEPandDEFAULT_PROFILE_THOUSANDS_SEP'') vs profiles (',')Python Backend
_get_format_options()method toDataExplorerTableViewbase class for subclass overrideformat_optionsinBackendStatereturned byget_state()Documentation
max_integral_digits = 7 + scipencalculationHow It Works
Backends now return format options in their state:
Frontend merges backend options with defaults, falling back to
max_integral_digits: 7if not provided. This allows:scipen(requires ark repository changes)Release Notes
New Features
Bug Fixes
QA Notes
Risk Level: Low. Changes are additive and backward compatible.
Testing after ark implementation:
scipen=0: Numbers ≥10M display as scientific notationoptions(scipen=10): Larger numbers display in fixed notationoptions(scipen=-3): Smaller numbers display as scientific notationAdjacent areas: None. Format option merging is self-contained in
updateBackendState().Context: The ark repository needs updates to implement
format_optionscalculation from R'sscipenoption. SeeARK_IMPLEMENTATION.mdfor detailed guidance.