Skip to content
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

Possibility to save spec when spec param is not json file #619

Closed
ymurong opened this issue Sep 13, 2024 · 2 comments
Closed

Possibility to save spec when spec param is not json file #619

ymurong opened this issue Sep 13, 2024 · 2 comments
Assignees

Comments

@ymurong
Copy link

ymurong commented Sep 13, 2024

Currently, the walker instance does not have updated spec unless you click on the save button that inject the newest spec back to python backend (which does not work when spec param is not json_file).

I am providing pygwalker in streamlit as a standalone application for a group of people as an online tool. Instead of having a json file on server for each user, it is more practical to keep their spec in their session/localstorage. However, as the save does not work for spec in memory mode, the user has to export first their spec and then copy back so that I could regenerate a renderer with the new spec.

Is it technically feasible?

Thank you !

@ymurong ymurong changed the title Possibility to save spec in memory mode ( Possibility to save spec in memory mode (apart from json_file mode) Sep 13, 2024
@ymurong ymurong changed the title Possibility to save spec in memory mode (apart from json_file mode) Possibility to save spec when spec param is not json file Sep 13, 2024
@longxiaofei longxiaofei self-assigned this Sep 14, 2024
@longxiaofei
Copy link
Contributor

Hi @ymurong

pygwalker already supports returning events when the spec changes in streamlit.

from pygwalker.api.streamlit import StreamlitRenderer
import pandas as pd
import streamlit as st

@st.cache_resource
def get_pyg_renderer() -> "StreamlitRenderer":
    df = pd.read_csv("xxx")
    return StreamlitRenderer(df)

renderer = get_pyg_renderer()

event = renderer.explorer()

print(event)

you can refer this issue: #580

@ymurong
Copy link
Author

ymurong commented Sep 14, 2024

Hi @longxiaofei,
Thank you for you rapid feedback. It works perfectly !

@ymurong ymurong closed this as completed Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants