Comments (3)
If you have something that you want to store in state but avoid serialising, you can prefix them with an underscore. More info here.
Numpy arrays are serialisable, however you may have something inside them that's preventing serialisation. For example, complex numbers.
Here's an example of a non-serialisable Numpy array that can be kept in state, but isn't serialised (nor send to the frontend).
initial_state = ss.init_state({
"_k": np.array([1+2j, 2, 3])
})
def print_k(state):
print(state["_k"])
Hope this helps!
from streamsync.
Hello, I'm glad to hear you're enjoying this library and that it's working well for you.
I have good news, I've just released a new version which runs all event handlers asynchronously to better support long-running tasks. It seems to be perfectly in line with what you were requesting. There's also other new features targeting background/long-running tasks.
It seems like you're building something interesting by the way.
from streamsync.
Yes I can see that however I can't seem to put some of the variables in the state dict as they are non serialisable (numpy arrays). What's the proposed way of tackling this issue as I want to avoid using global variables. Is there anyway I can send in other variables with events?
from streamsync.
Related Issues (20)
- change on value of a graph as vega spec does not trigger mutation in extension HOT 6
- Python 3.12 tests issuing DeprecationWarning related to multiprocessing HOT 2
- use poetry instead of setup tools as package manager
- github action enforce PR continuous integration rules
- Changing font-family for entire app not intuitive
- Unable to build docker image with Dockerfile from docs HOT 2
- Event context not working for repeater objects where the repeater object is specified using square brackets "[ ]" HOT 2
- Serving large numbers of images
- pagination component documentation is missing on the official documentation
- Add checkbox column to dataframe that is interactive HOT 1
- Use Pydantic for automating most event payload sanitisers HOT 1
- Question: How to link message component with a state element HOT 1
- How to convert <streamsync.core.BytesWrapper object at 0x1065ca890> to base64
- Create separate test apps for backend and manual frontend testing HOT 1
- declare optional schema on streamsync state HOT 1
- Implement pylint HOT 6
- Update Repeater docs to explain use of dynamic accessors
- add a tooltip option on icon, button, ... component
- File input component doesn't show the name of the uploaded files HOT 1
- Embed Iframe into Streamsync HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamsync.