Releases: reactive-python/reactpy-django
Releases · reactive-python/reactpy-django
4.0.0
Added
- Client-side Python components can now be rendered via the new
{% pyscript_component %}
template tag- You must first call the
{% pyscript_setup %}
template tag to load PyScript dependencies
- You must first call the
- Client-side components can be embedded into existing server-side components via
reactpy_django.components.pyscript_component
. - Tired of writing JavaScript? You can now write PyScript code that runs directly within client browser via the
reactpy_django.html.pyscript
element.- This is a viable substitution for most JavaScript code.
Changed
-
New syntax for
use_query
anduse_mutation
hooks. Here's a quick comparison of the changes:query = use_query(QueryOptions(thread_sensitive=True), get_items, foo="bar") # Old query = use_query(get_items, {"foo":"bar"}, thread_sensitive=True) # New mutation = use_mutation(MutationOptions(thread_sensitive=True), remove_item) # Old mutation = use_mutation(remove_item, thread_sensitive=True) # New
Removed
QueryOptions
andMutationOptions
have been removed. The value contained within these objects are now passed directly into the hook.
Fixed
- Resolved a bug where Django-ReactPy would not properly detect
settings.py:DEBUG
.
3.8.1
Added
- Python 3.12 compatibility
3.8.0
Added
- Built-in cross-process communication mechanism via the
reactpy_django.hooks.use_channel_layer
hook. - Access to the root component's
id
via thereactpy_django.hooks.use_root_id
hook. - More robust control over ReactPy clean up tasks!
settings.py:REACTPY_CLEAN_INTERVAL
to control how often ReactPy automatically performs cleaning tasks.settings.py:REACTPY_CLEAN_SESSIONS
to control whether ReactPy should clean up expired sessions during automatic cleanups.settings.py:REACTPY_CLEAN_USER_DATA
to control whether ReactPy should clean up orphaned user data during automatic cleanups.python manage.py clean_reactpy
command to manually perform ReactPy clean up tasks.
Changed
- Simplified code for cascading deletion of user data.
3.7.0
Added
- An "offline component" can now be displayed when the client disconnects from the server.
- URL router now supports a
*
wildcard to create default routes.
3.6.0
Added
- Built-in Single Page Application (SPA) support!
reactpy_django.router.django_router
can be used to render your Django application as a SPA.
- SEO compatible rendering!
settings.py:REACTPY_PRERENDER
can be set toTrue
to make components pre-render by default.- Or, you can enable it on individual components via the template tag:
{% component "..." prerender="True" %}
.
- New
view_to_iframe
feature!reactpy_django.components.view_to_iframe
uses an<iframe>
to render a Django view.reactpy_django.utils.register_iframe
tells ReactPy which viewsview_to_iframe
can use.
- New Django
User
related features!reactpy_django.hooks.use_user
can be used to access the current user.reactpy_django.hooks.use_user_data
provides a simplified interface for storing user key-value data.reactpy_django.decorators.user_passes_test
is inspired by the equivalent Django decorator, but ours works with ReactPy components.settings.py:REACTPY_AUTO_RELOGIN
will cause component WebSocket connections to automatically re-login users that are already authenticated. This is useful to continuously updatelast_login
timestamps and refresh the Django login session.
Changed
- Renamed undocumented utility function
ComponentPreloader
toRootComponentFinder
. - It is now recommended to call
as_view()
when usingview_to_component
orview_to_iframe
with Class Based Views. - For thread safety,
thread_sensitive=True
has been enabled in allsync_to_async
functions where ORM queries are possible. reactpy_django.hooks.use_mutation
now has a__call__
method. So rather than writingmy_mutation.execute(...)
, you can now writemy_mutation(...)
.
Deprecated
- The
compatibility
argument onreactpy_django.components.view_to_component
is deprecated.- Use
view_to_iframe
as a replacement.
- Use
reactpy_django.components.view_to_component
usage as a decorator is deprecated.- Check the docs on how to use
view_to_component
as a function instead.
- Check the docs on how to use
reactpy_django.decorators.auth_required
is deprecated.- Use
reactpy_django.decorators.user_passes_test
instead. - An equivalent to
auth_required
's default is@user_passes_test(lambda user: user.is_active)
.
- Use
3.5.1
Added
- Warning W018 (
Suspicious position of 'reactpy_django' in INSTALLED_APPS
) has been added.
Changed
- The default postprocessor can now disabled by setting
REACTPY_DEFAULT_QUERY_POSTPROCESSOR
toNone
. - Massive overhaul of docs styling.
3.5.0
Added
- More customization for reconnection behavior through new settings!
REACTPY_RECONNECT_INTERVAL
REACTPY_RECONNECT_MAX_INTERVAL
REACTPY_RECONNECT_MAX_RETRIES
REACTPY_RECONNECT_BACKOFF_MULTIPLIER
- ReactPy-Django docs are now version controlled via mike!
Changed
- Bumped the minimum ReactPy version to
1.0.2
. - Prettier websocket URLs for components that do not have sessions.
- Template tag will now only validate
args
/kwargs
ifsettings.py:DEBUG
is enabled. - Bumped the minimum
@reactpy/client
version to0.3.1
- Bumped the minimum Django version to
4.2
. - Use TypeScript instead of JavaScript for this repository.
- Note: ReactPy-Django will continue bumping minimum Django requirements to versions that increase async support. This "latest-only" trend will continue until Django has all async features that ReactPy benefits from. After this point, ReactPy-Django will begin supporting all maintained Django versions.
Removed
settings.py:REACTPY_RECONNECT_MAX
is removed. See the docs for the newREACTPY_RECONNECT_*
settings.
3.4.0
Added
- Distributed Computing: ReactPy components can now optionally be rendered by a completely separate server!
REACTPY_DEFAULT_HOSTS
setting can round-robin a list of ReactPy rendering hosts.host
argument has been added to thecomponent
template tag to force components to render on a specific host.
reactpy_django.utils.register_component
function can manually register root components.- Useful if you have dedicated ReactPy rendering application(s) that do not use HTML templates.
Changed
- ReactPy will now provide a warning if your HTTP URLs are not on the same prefix as your websockets.
- Cleaner logging output for auto-detected ReactPy root components.
Deprecated
reactpy_django.REACTPY_WEBSOCKET_PATH
is deprecated. The identical replacement isREACTPY_WEBSOCKET_ROUTE
.settings.py:REACTPY_WEBSOCKET_URL
is deprecated. The similar replacement isREACTPY_URL_PREFIX
.
Removed
- Warning W007 (
REACTPY_WEBSOCKET_URL doesn't end with a slash
) has been removed. ReactPy now automatically handles slashes. - Warning W008 (
REACTPY_WEBSOCKET_URL doesn't start with an alphanumeric character
) has been removed. ReactPy now automatically handles this scenario. - Error E009 (
channels is not in settings.py:INSTALLED_APPS
) has been removed. Newer versions ofchannels
do not require installation viaINSTALLED_APPS
to receive an ASGI webserver.
3.3.2
Added
- ReactPy Websocket will now decode messages via
orjson
resulting in an ~6% overall performance improvement. - Built-in
asyncio
event loops are now patched vianest_asyncio
, resulting in an ~10% overall performance improvement. This has no performance impact if you are running your webserver withuvloop
.
Fixed
- Fix bug where
REACTPY_WEBSOCKET_URL
always generates a warning if unset. - Fixed bug on Windows where
assert f is self._write_fut
would be raised byuvicorn
whenREACTPY_BACKHAUL_THREAD = True
. - Fixed bug on Windows where rendering behavior would be jittery with
daphne
whenREACTPY_BACKHAUL_THREAD = True
.
3.3.1
Added
- Additional system checks for ReactPy misconfigurations.
Changed
REACTPY_BACKHAUL_THREAD
now defaults toFalse
.