Expose private attribute _config in Figure/FigureWidget class as public property
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
Hello Dev!
I have been using Plotly's Python library and encountered an issue when trying to set the figure config while preserving on_change callbacks on the same figure object.
The root cause is that _config is currently a private attribute in the BaseFigure class, and the only api way to modify it is through the fig.show(config=config) method call. However, show() rerenders the figure and won't carry existing on_change listeners.
Therefore, in theory, using __setattr__ to modify the _config attribute directly instead of using .show(config=config) would make both setting on_change() and setting config (e.g. scrollZoom = True) work well at the same fig, and this has been proven to be the case in testing.
So I suggest to make _config a public attribute that users can directly set it without calling show() or using setattr.
Many thanks for your supper awesome work on Plotly!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read packages/python/plotly/plotly/basedatatypes.py and trace BaseFigure._config, fig.show(config=...), and on_change callbacks. Establish how a public configuration setter should work without losing existing callbacks; done means Figure and FigureWidget configuration can be changed while callbacks remain attached.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100