Skip to content

Rename django-idom to reactpy-django #131

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

Merged
merged 15 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @idom-team/django
* @reactive-python/django
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Start a Discussion
url: https://github.com/idom-team/django-idom/discussions
about: Report issues, request features, ask questions, and share ideas
- name: Start a Discussion
url: https://github.com/reactive-python/reactpy-django/discussions
about: Report issues, request features, ask questions, and share ideas
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Django IDOM Build Artifacts
src/django_idom/static/
# ReactPy-Django Build Artifacts
src/reactpy_django/static/*

# Django #
logs
Expand Down
110 changes: 55 additions & 55 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,35 @@ Using the following categories, list your changes in this order:

???+ note

This is Django-IDOM's biggest update yet!
This is ReactPy-Django'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
1. Install `reactpy-django >= 3.0.0`
2. Run `reactpy rewrite-keys <DIR>` and `reactpy rewrite-camel-case-props <DIR>` to update your `reactpy.html.*` calls to the new syntax
3. Run `python manage.py migrate` to create the new ReactPy-Django database entries

### Added

- The `idom` client will automatically configure itself to debug mode depending on `settings.py:DEBUG`.
- The `reactpy` client will automatically configure itself to debug mode depending on `settings.py:DEBUG`.
- `use_connection` hook for returning the browser's active `Connection`.
- `IDOM_CACHE` is now configurable within `settings.py` to whatever cache name you wish.
- `REACTPY_CACHE` is now configurable within `settings.py` to whatever cache name you wish.

### Changed

- 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.*`...
- It is now mandatory to run `manage.py migrate` after installing ReactPy.
- Bumped the minimum ReactPy version to 1.0.0. Due to ReactPy 1.0.0, `reactpy.html.*`...
- HTML properties can now be `snake_case`. For example `className` now becomes `class_name`.
- `key=...` is now declared within the props `dict` (rather than as a `kwarg`).
- 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 to `IDOM_RECONNECT_MAX`.
- `REACTPY_WS_MAX_RECONNECT_TIMEOUT` setting has been renamed to `REACTPY_RECONNECT_MAX`.

### Removed

- `django_idom.hooks.use_websocket` has been removed. The similar replacement is `django_idom.hooks.use_connection`.
- `django_idom.types.IdomWebsocket` has been removed. The similar replacement is `django_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 the `IDOM_CACHE` setting.
- `reactpy_django.hooks.use_websocket` has been removed. The similar replacement is `reactpy_django.hooks.use_connection`.
- `reactpy_django.types.ReactPyWebsocket` has been removed. The similar replacement is `reactpy_django.types.Connection`.
- `settings.py:CACHE['reactpy']` is no longer used by default. The name of the cache backend must now be specified with the `REACTPY_CACHE` setting.

### Fixed

Expand All @@ -86,7 +86,7 @@ Using the following categories, list your changes in this order:
### Fixed

- 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.
- ReactPy preloader will now print out the exception stack when failing to import a module.

## [2.2.0] - 2022-12-28

Expand All @@ -100,7 +100,7 @@ Using the following categories, list your changes in this order:

### Removed

- `django_idom.hooks._fetch_lazy_fields` has been deleted. The equivalent replacement is `django_idom.utils.django_query_postprocessor`.
- `reactpy_django.hooks._fetch_lazy_fields` has been deleted. The equivalent replacement is `reactpy_django.utils.django_query_postprocessor`.

## [2.1.0] - 2022-11-01

Expand Down Expand Up @@ -139,7 +139,7 @@ Using the following categories, list your changes in this order:
- Allow `use_mutation` to have `refetch=None`, as the docs suggest is possible.
- `use_query` will now prefetch all fields to prevent `SynchronousOnlyOperation` exceptions.
- `view_to_component`, `django_css`, and `django_js` type hints will now display like normal functions.
- IDOM preloader no longer attempts to parse commented out IDOM components.
- ReactPy preloader no longer attempts to parse commented out ReactPy components.
- Tests are now fully functional on Windows

## [1.2.0] - 2022-09-19
Expand All @@ -149,16 +149,16 @@ Using the following categories, list your changes in this order:
- `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.
- `view_to_component` utility to convert legacy Django views to ReactPy components.

### Changed

- Bumped the minimum IDOM version to 0.40.2
- Bumped the minimum ReactPy version to 0.40.2
- Testing suite now uses `playwright` instead of `selenium`

### Fixed

- IDOM preloader is no longer sensitive to whitespace within template tags.
- ReactPy preloader is no longer sensitive to whitespace within template tags.

## [1.1.0] - 2022-07-01

Expand All @@ -168,98 +168,98 @@ Using the following categories, list your changes in this order:

### Changed

- Bumped the minimum IDOM version to 0.39.0
- Bumped the minimum ReactPy version to 0.39.0

## [1.0.0] - 2022-05-22

### Added

- Django-specific hooks! `use_websocket`, `use_scope`, and `use_location` are now available within the `django_idom.hooks` module.
- Django-specific hooks! `use_websocket`, `use_scope`, and `use_location` are now available within the `reactpy_django.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.

### Changed

- `idom_component` template tag has been renamed to `component`
- Bumped the minimum IDOM version to 0.38.0
- `reactpy_component` template tag has been renamed to `component`
- Bumped the minimum ReactPy version to 0.38.0

### Removed

- `websocket` parameter for components has been removed. Functionally, it is replaced with `django_idom.hooks.use_websocket`.
- `websocket` parameter for components has been removed. Functionally, it is replaced with `reactpy_django.hooks.use_websocket`.

## [0.0.5] - 2022-04-04

### Changed

- Bumped the minimum IDOM version to 0.37.2
- Bumped the minimum ReactPy version to 0.37.2

### Fixed

- ModuleNotFoundError: No module named `idom.core.proto` caused by IDOM 0.37.2
- ModuleNotFoundError: No module named `reactpy.core.proto` caused by ReactPy 0.37.2

## [0.0.4] - 2022-03-05

### Changed

- Bumped the minimum IDOM version to 0.37.1
- Bumped the minimum ReactPy version to 0.37.1

## [0.0.3] - 2022-02-19

### Changed

- Bumped the minimum IDOM version to 0.36.3
- Bumped the minimum ReactPy version to 0.36.3

## [0.0.2] - 2022-01-30

### Added

- Ability to declare the HTML class of the top-level component `div`
- `name = ...` parameter to IDOM HTTP paths for use with `django.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`
- `name = ...` parameter to ReactPy HTTP paths for use with `django.urls.reverse()`
- Cache versioning to automatically invalidate old web module files from the cache backend
- Automatic pre-population of the ReactPy component registry
- Type hinting for `ReactPyWebsocket`

### Changed

- 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`
- Static files are now contained within a `reactpy_django/` parent folder
- Upgraded ReactPy to version `0.36.0`
- Minimum Django version required is now `4.0`
- Minimum Python version required is now `3.8`

### Removed

- `IDOM_WEB_MODULES_PATH` has been replaced with Django `include(...)`
- `IDOM_WS_MAX_RECONNECT_DELAY` has been renamed to `IDOM_WS_MAX_RECONNECT_TIMEOUT`
- `idom_web_modules` cache back-end has been renamed to `idom`
- `REACTPY_WEB_MODULES_PATH` has been replaced with Django `include(...)`
- `REACTPY_WS_MAX_RECONNECT_DELAY` has been renamed to `REACTPY_WS_MAX_RECONNECT_TIMEOUT`
- `reactpy_web_modules` cache backend has been renamed to `reactpy`

### Fixed

- Increase test timeout values to prevent false positives
- Windows compatibility for building Django-IDOM
- Windows compatibility for building ReactPy-Django

### Security

- Fixed potential directory traversal attack on the IDOM web modules URL
- Fixed potential directory traversal attack on the ReactPy web modules URL

## [0.0.1] - 2021-08-18

### Added

- Support for IDOM within the Django

[unreleased]: https://github.com/idom-team/django-idom/compare/3.0.0...HEAD
[3.0.0]: https://github.com/idom-team/django-idom/compare/2.2.1...3.0.0
[2.2.1]: https://github.com/idom-team/django-idom/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/idom-team/django-idom/compare/2.1.0...2.2.0
[2.1.0]: https://github.com/idom-team/django-idom/compare/2.0.1...2.1.0
[2.0.1]: https://github.com/idom-team/django-idom/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/idom-team/django-idom/compare/1.2.0...2.0.0
[1.2.0]: https://github.com/idom-team/django-idom/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/idom-team/django-idom/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/idom-team/django-idom/compare/0.0.5...1.0.0
[0.0.5]: https://github.com/idom-team/django-idom/compare/0.0.4...0.0.5
[0.0.4]: https://github.com/idom-team/django-idom/compare/0.0.3...0.0.4
[0.0.3]: https://github.com/idom-team/django-idom/compare/0.0.2...0.0.3
[0.0.2]: https://github.com/idom-team/django-idom/compare/0.0.1...0.0.2
[0.0.1]: https://github.com/idom-team/django-idom/releases/tag/0.0.1
- Support for ReactPy within the Django

[unreleased]: https://github.com/reactive-python/reactpy-django/compare/3.0.0...HEAD
[3.0.0]: https://github.com/reactive-python/reactpy-django/compare/2.2.1...3.0.0
[2.2.1]: https://github.com/reactive-python/reactpy-django/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/reactive-python/reactpy-django/compare/2.1.0...2.2.0
[2.1.0]: https://github.com/reactive-python/reactpy-django/compare/2.0.1...2.1.0
[2.0.1]: https://github.com/reactive-python/reactpy-django/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/reactive-python/reactpy-django/compare/1.2.0...2.0.0
[1.2.0]: https://github.com/reactive-python/reactpy-django/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/reactive-python/reactpy-django/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/reactive-python/reactpy-django/compare/0.0.5...1.0.0
[0.0.5]: https://github.com/reactive-python/reactpy-django/compare/0.0.4...0.0.5
[0.0.4]: https://github.com/reactive-python/reactpy-django/compare/0.0.3...0.0.4
[0.0.3]: https://github.com/reactive-python/reactpy-django/compare/0.0.2...0.0.3
[0.0.2]: https://github.com/reactive-python/reactpy-django/compare/0.0.1...0.0.2
[0.0.1]: https://github.com/reactive-python/reactpy-django/releases/tag/0.0.1
6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include src/django_idom/py.typed
recursive-include src/django_idom/static *
recursive-include src/django_idom/templates *.html
include src/reactpy_django/py.typed
recursive-include src/reactpy_django/static *
recursive-include src/reactpy_django/templates *.html
58 changes: 39 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
<!--header-start-->

# Django-IDOM &middot; [![Tests](https://github.com/idom-team/django-idom/workflows/Test/badge.svg?event=push)](https://github.com/idom-team/django-idom/actions?query=workflow%3ATest) [![PyPI Version](https://img.shields.io/pypi/v/django-idom.svg?label=PyPI)](https://pypi.python.org/pypi/django-idom) [![License](https://img.shields.io/badge/License-MIT-purple.svg)](https://github.com/idom-team/django-idom/blob/main/LICENSE) [![Docs](https://img.shields.io/website?down_message=offline&label=Docs&logo=read%20the%20docs&logoColor=white&up_message=online&url=https%3A%2F%2Fidom-team.github.io%2Fdjango-idom%2F)](https://idom-team.github.io/django-idom/)
# <img src="https://raw.githubusercontent.com/reactive-python/reactpy/main/branding/svg/reactpy-logo-square.svg" align="left" height="45"/> ReactPy Django

<!--header-end-->
<!--intro-start-->

Django-IDOM connects your Python project to a ReactJS front-end, allowing you to create **interactive websites without needing JavaScript!**
[![Tests](https://github.com/idom-team/django-idom/workflows/Test/badge.svg?event=push)](https://github.com/idom-team/django-idom/actions?query=workflow%3ATest) [![PyPI Version](https://img.shields.io/pypi/v/django-idom.svg?label=PyPI)](https://pypi.python.org/pypi/django-idom) [![License](https://img.shields.io/badge/License-MIT-purple.svg)](https://github.com/idom-team/django-idom/blob/main/LICENSE) [![Docs](https://img.shields.io/website?down_message=offline&label=Docs&logo=read%20the%20docs&logoColor=white&up_message=online&url=https%3A%2F%2Fidom-team.github.io%2Fdjango-idom%2F)](https://idom-team.github.io/django-idom/)

Following ReactJS styling, web elements are combined into [reusable "components"](https://reactpy.dev/docs/guides/creating-interfaces/your-first-components/index.html#parametrizing-components). These components can utilize [hooks](https://reactpy.dev/docs/reference/hooks-api.html) and [events](https://reactpy.dev/docs/guides/adding-interactivity/responding-to-events/index.html#async-event-handlers) to create infinitely complex web pages.

When needed, IDOM can [use components directly from NPM](https://reactpy.dev/docs/guides/escape-hatches/javascript-components.html#dynamically-loaded-components). For additional flexibility, components can also be [fully developed in JavaScript](https://reactpy.dev/docs/guides/escape-hatches/javascript-components.html#custom-javascript-components).
<!--header-end-->

Any Python web framework with Websockets can support IDOM. See below for what frameworks are supported out of the box.
<!--intro-start-->

| Supported Frameworks | Supported Frameworks (External) |
| --- | --- |
| [`Flask`, `FastAPI`, `Sanic`, `Tornado`](https://reactpy.dev/docs/guides/getting-started/installing-idom.html#officially-supported-servers) | [`Django`](https://github.com/idom-team/django-idom), [`Plotly-Dash`](https://github.com/idom-team/idom-dash), [`Jupyter`](https://github.com/idom-team/idom-jupyter) |
[ReactPy](https://reactpy.dev/) is a library for building user interfaces in Python without Javascript. ReactPy interfaces are made from components which look and behave similarly to those found in [ReactJS](https://reactjs.org/). Designed with simplicity in mind, ReactPy can be used by those without web development experience while also being powerful enough to grow with your ambitions.

<table align="center">
<thead>
<tr>
<th colspan="2" style="text-align: center">Supported Backends</th>
<tr>
<th style="text-align: center">Built-in</th>
<th style="text-align: center">External</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://reactpy.dev/docs/guides/getting-started/installing-reactpy.html#officially-supported-servers">
Flask, FastAPI, Sanic, Tornado
</a>
</td>
<td>
<a href="https://github.com/reactive-python/reactpy-django">Django</a>,
<a href="https://github.com/reactive-python/reactpy-jupyter">Jupyter</a>,
<a href="https://github.com/reactive-python/reactpy-dash">Plotly-Dash</a>
</td>
</tr>
</tbody>
</table>

<!--intro-end-->

Expand All @@ -25,13 +43,13 @@ Any Python web framework with Websockets can support IDOM. See below for what fr

<!--py-header-start-->

You will need a file to define your [IDOM](https://github.com/idom-team/idom) components. We recommend creating a `components.py` file within your chosen **Django app** to start out. Within this file, we will create a simple `hello_world` component.
You will need a file to define your [ReactPy](https://github.com/reactive-python/reactpy) components. We recommend creating a `components.py` file within your chosen **Django app** to start out. Within this file, we will create a simple `hello_world` component.

<!--py-header-end-->
<!--py-code-start-->

```python
from idom import component, html
from reactpy import component, html

@component
def hello_world(recipient: str):
Expand All @@ -44,15 +62,15 @@ def hello_world(recipient: str):

<!--html-header-start-->

In your **Django app**'s HTML template, you can now embed your IDOM component using the `component` template tag. Within this tag, you will need to type in your dotted path to the component function as the first argument.
In your **Django app**'s HTML template, you can now embed your ReactPy component using the `component` template tag. Within this tag, you will need to type in your dotted path to the component function as the first argument.

Additionally, you can pass in `args` and `kwargs` into your component function. For example, after reading the code below, pay attention to how the function definition for `hello_world` (_in the previous example_) accepts a `recipient` argument.

<!--html-header-end-->
<!--html-code-start-->

```jinja
{% load idom %}
{% load reactpy %}
<!DOCTYPE html>
<html>
<body>
Expand All @@ -69,8 +87,10 @@ Additionally, you can pass in `args` and `kwargs` into your component function.

Follow the links below to find out more about this project.

- [Try it Now](https://mybinder.org/v2/gh/idom-team/idom-jupyter/main?urlpath=lab/tree/notebooks/introduction.ipynb) - Check out IDOM in a Jupyter Notebook.
- [Documentation](https://idom-team.github.io/django-idom) - Learn how to install, run, and use IDOM.
- [Community Forum](https://github.com/idom-team/idom/discussions) - Ask questions, share ideas, and show off projects.
- [Try it Now](https://mybinder.org/v2/gh/reactive-python/reactpy-jupyter/main?urlpath=lab/tree/notebooks/introduction.ipynb) - check out ReactPy in a Jupyter Notebook.
- [Documentation](https://reactive-python.github.io/reactpy-django) - learn how to install, run, and use ReactPy.
- [Community Forum](https://github.com/reactive-python/reactpy/discussions) - ask questions, share ideas, and show off projects.
- [Contributor Guide](https://idom-team.github.io/django-idom/contribute/code/) - see how you can help develop this project.
- [Code of Conduct](https://github.com/reactive-python/reactpy-django/blob/main/CODE_OF_CONDUCT.md) - standards for interacting with this community.

<!--resources-end-->
2 changes: 1 addition & 1 deletion docs/includes/orm.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ These `SynchronousOnlyOperation` exceptions may be resolved in a future version

<!--orm-fetch-start-->

By default, automatic recursive fetching of `ManyToMany` or `ForeignKey` fields is enabled within the default `QueryOptions.postprocessor`. This is needed to prevent `SynchronousOnlyOperation` exceptions when accessing these fields within your IDOM components.
By default, automatic recursive fetching of `ManyToMany` or `ForeignKey` fields is enabled within the default `QueryOptions.postprocessor`. This is needed to prevent `SynchronousOnlyOperation` exceptions when accessing these fields within your ReactPy components.

<!--orm-fetch-end-->
Loading