All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Nothing (yet)!
- 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.
-
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
QueryOptions
andMutationOptions
have been removed. The value contained within these objects are now passed directly into the hook.
- Resolved a bug where Django-ReactPy would not properly detect
settings.py:DEBUG
.
3.8.1 - 2024-05-07
- Python 3.12 compatibility
3.8.0 - 2024-02-20
- 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.
- Simplified code for cascading deletion of user data.
3.7.0 - 2024-01-30
- 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 - 2024-01-10
- 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.
- 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(...)
.
- 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
- Fixed a bug where exception stacks would not print on failed component renders.
3.5.1 - 2023-09-07
- Warning W018 (
Suspicious position of 'reactpy_django' in INSTALLED_APPS
) has been added.
- The default postprocessor can now disabled by setting
REACTPY_DEFAULT_QUERY_POSTPROCESSOR
toNone
. - Massive overhaul of docs styling.
3.5.0 - 2023-08-26
- 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!
- 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
- Use TypeScript instead of JavaScript for this repository.
- Bumped the minimum Django version to
4.2
.
???+ note "Django 4.2+ is required"
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.
settings.py:REACTPY_RECONNECT_MAX
is removed. See the docs for the newREACTPY_RECONNECT_*
settings.
3.4.0 - 2023-08-18
- 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.
- 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.
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
.
- 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 web server.
3.3.2 - 2023-08-13
- 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 web server withuvloop
.
- 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 - 2023-08-08
- Additional system checks for ReactPy misconfigurations.
REACTPY_BACKHAUL_THREAD
now defaults toFalse
.
3.3.0 - 2023-08-05
- Added system checks for a variety of common ReactPy misconfigurations.
REACTPY_BACKHAUL_THREAD
setting to enable/disable threading behavior.
- If using
settings.py:REACTPY_DATABASE
,reactpy_django.database.Router
must now be registered insettings.py:DATABASE_ROUTERS
. - By default, ReactPy will now use a backhaul thread to increase performance.
- Minimum Python version required is now
3.9
- A thread-safe cache is no longer required.
3.2.1 - 2023-06-29
- Template tag exception details are now rendered on the webpage when
settings.py:DEBUG
is enabled.
- Prevent exceptions within the
component
template tag from causing the whole template to fail to render.
3.2.0 - 2023-06-08
- Added warning if poor system/cache/database performance is detected while in
DEBUG
mode. - Added
REACTPY_AUTH_BACKEND
setting to allow for custom authentication backends.
- Using
SessionMiddlewareStack
is now optional. - Using
AuthMiddlewareStack
is now optional.
3.1.0 - 2023-05-06
use_query
now supports async functions.use_mutation
now supports async functions.reactpy_django.types.QueryOptions.thread_sensitive
option to customize how sync queries are executed.reactpy_django.hooks.use_mutation
now acceptsreactpy_django.types.MutationOptions
option to customize how mutations are executed.
- The
mutate
argument onreactpy_django.hooks.use_mutation
has been renamed tomutation
.
- Fix bug where ReactPy utilizes Django's default cache timeout, which can prematurely expire the component cache.
3.0.1 - 2023-04-06
reactpy-django
database entries are no longer cleaned during Django application startup. Instead, it will occur on webpage loads ifREACTPY_RECONNECT_MAX
seconds has elapsed since the last cleaning.
3.0.0-reactpy - 2023-03-30
django-idom
has been renamed toreactpy-django
! Please note that all references to the wordidom
in your code should be changed toreactpy
. See the docs for more details.
3.0.0 - 2023-03-08
???+ note
This is Django-IDOM's biggest update yet!
To upgrade from previous version you will need to...
1. Install `django-idom >= 3.0.0`
2. Run `idom rewrite-keys <DIR>` and `idom rewrite-camel-case-props <DIR>` to update your `idom.html.*` calls to the new syntax
3. Run `python manage.py migrate` to create the new Django-IDOM database entries
- The
idom
client will automatically configure itself to debug mode depending onsettings.py:DEBUG
. use_connection
hook for returning the browser's activeConnection
.IDOM_CACHE
is now configurable withinsettings.py
to whatever cache name you wish.
- It is now mandatory to run
manage.py migrate
after installing IDOM. - Bumped the minimum IDOM version to 1.0.0. Due to IDOM 1.0.0,
idom.html.*
...- HTML properties can now be
snake_case
. For exampleclassName
now becomesclass_name
. key=...
is now declared within the propsdict
(rather than as akwarg
).
- HTML properties can now be
- The
component
template tag now supports both positional and keyword arguments. - The
component
template tag now supports non-serializable arguments. IDOM_WS_MAX_RECONNECT_TIMEOUT
setting has been renamed toIDOM_RECONNECT_MAX
.
django_idom.hooks.use_websocket
has been removed. The similar replacement isdjango_idom.hooks.use_connection
.django_idom.types.IdomWebsocket
has been removed. The similar replacement isdjango_idom.types.Connection
.settings.py:CACHE['idom']
is no longer used by default. The name of the cache back-end must now be specified with theIDOM_CACHE
setting.
view_to_component
will now retain the contents of a<head>
tag when rendering.- React client is now set to
production
rather thandevelopment
. use_query
will now utilizefield.related_name
when postprocessing many-to-one relationships.
- Fixed a potential method of component template tag argument spoofing.
- Exception information will no longer be displayed on the page, based on the value of
settings.py:DEBUG
.
2.2.1 - 2023-01-09
- Fixed bug where
use_query
would not recursively fetch many-to-one relationships. - IDOM preloader will now print out the exception stack when failing to import a module.
2.2.0 - 2022-12-28
- Add
options: QueryOptions
parameter touse_query
to allow for configuration of this hook.
- By default,
use_query
will recursively prefetch all many-to-many or many-to-one relationships to preventSynchronousOnlyOperation
exceptions.
django_idom.hooks._fetch_lazy_fields
has been deleted. The equivalent replacement isdjango_idom.utils.django_query_postprocessor
.
2.1.0 - 2022-11-01
- Minimum
channels
version is now4.0.0
.
- Change type hint on
view_to_component
callable to haverequest
argument be optional. - Change type hint on
view_to_component
to represent it as a decorator with parenthesis (such as@view_to_component(compatibility=True)
)
- Add note to docs about potential information exposure via
view_to_component
when usingcompatibility=True
.
2.0.1 - 2022-10-18
- Ability to use
key=...
parameter on all prefabricated components.
2.0.0 - 2022-10-17
use_origin
hook for returning the browser'slocation.origin
.
view_to_component
now returns aCallable
, instead of directly returning aComponent
. Check the docs for new usage info.use_mutation
anduse_query
will now log any query failures.
- Allow
use_mutation
to haverefetch=None
, as the docs suggest is possible. use_query
will now prefetch all fields to preventSynchronousOnlyOperation
exceptions.view_to_component
,django_css
, anddjango_js
type hints will now display like normal functions.- IDOM preloader no longer attempts to parse commented out IDOM components.
- Tests are now fully functional on Windows
1.2.0 - 2022-09-19
auth_required
decorator to prevent your components from rendering to unauthenticated users.use_query
hook for fetching database values.use_mutation
hook for modifying database values.view_to_component
utility to convert legacy Django views to IDOM components.
- Bumped the minimum IDOM version to 0.40.2
- Testing suite now uses
playwright
instead ofselenium
- IDOM preloader is no longer sensitive to whitespace within template tags.
1.1.0 - 2022-07-01
django_css
anddjango_js
components to defer loading CSS & JS files until needed.
- Bumped the minimum IDOM version to 0.39.0
1.0.0 - 2022-05-22
- Django specific hooks!
use_websocket
,use_scope
, anduse_location
are now available within thedjango_idom.hooks
module. - Documentation has been placed into a formal docs webpage.
- Logging for when a component fails to import, or if no components were found within Django.
idom_component
template tag has been renamed tocomponent
- Bumped the minimum IDOM version to 0.38.0
websocket
parameter for components has been removed. Functionally, it is replaced withdjango_idom.hooks.use_websocket
.
0.0.5 - 2022-04-04
- Bumped the minimum IDOM version to 0.37.2
- ModuleNotFoundError: No module named
idom.core.proto
caused by IDOM 0.37.2
0.0.4 - 2022-03-05
- Bumped the minimum IDOM version to 0.37.1
0.0.3 - 2022-02-19
- Bumped the minimum IDOM version to 0.36.3
0.0.2 - 2022-01-30
- Ability to declare the HTML class of the top-level component
div
name = ...
parameter to IDOM HTTP paths for use withdjango.urls.reverse()
- Cache versioning to automatically invalidate old web module files from the cache back-end
- Automatic pre-population of the IDOM component registry
- Type hinting for
IdomWebsocket
- Fetching web modules from disk and/or cache is now fully async
- Static files are now contained within a
django_idom/
parent folder - Upgraded IDOM to version
0.36.0
- Minimum Django version required is now
4.0
- Minimum Python version required is now
3.8
IDOM_WEB_MODULES_PATH
has been replaced with Djangoinclude(...)
IDOM_WS_MAX_RECONNECT_DELAY
has been renamed toIDOM_WS_MAX_RECONNECT_TIMEOUT
idom_web_modules
cache back-end has been renamed toidom
- Increase test timeout values to prevent false positives
- Windows compatibility for building Django-IDOM
- Fixed potential directory traversal attack on the IDOM web modules URL
0.0.1 - 2021-08-18
- Support for IDOM within the Django