-
Notifications
You must be signed in to change notification settings - Fork 130
Python SDK: Add read_signals helpers #850
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: develop
Are you sure you want to change the base?
Conversation
aadc9ab
to
03e9524
Compare
Thoughts on the fastapi dependency name? It's |
Don't think the test failures are anything to do with this change.. |
I changed the FastAPI dep to be called |
…signals found Allows read_signals to be used as a dependency in fastapi or litestar
I tested the django read_signals helper now, and changed the behavior to return None rather than error if the request was not sent from datastar, or had no signals attached. This lets FastAPI and Litestar use read_signals as a dependency, even if the route handler gets hit by requests that aren't from datastar. I think this is in a pretty good state now. Also added examples of how to use read_signals for all the different frameworks. |
Naming conventions should follow the SDK spec as closely as possible, so it should absolutely be |
Factor out a common implementation for all the frameworks.
Make all the example scripts directly runnable.
Previous implementation raised an exception with the |
This is looking great! If we could get a Python SKD contributor to look at and approve this PR, that would be reassuring, as I’m less familiar with Python. |
In hopes of making reviewing this easier I stripped out all the other fixes and cleanups not related directly to read_signals. I still think those are good, but I'll raise them in a separate PR. |
Adds read_signals functions to all the supported python frameworks. Also adds a dependency for FastAPI so that they can be read idiomatically in that framework. @jmoppel Can you validate the Django one?
I also put a ruff config and formatted the files. Added
__all__
to the files as well to make sure that imports that were unused and only included for re-exporting don't get accidentally removed. These can be separated out into different PRs if needed, I was just wanted the ability to easily lint and format my work and ended up adding it in here.