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 all 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
2 changes: 2 additions & 0 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
run: |
pip install -r requirements/build-docs.txt
linkcheckMarkdown docs/ -v -r
linkcheckMarkdown README.md -v -r
linkcheckMarkdown CHANGELOG.md -v -r
mkdocs build --strict
- name: Check docs examples
run: |
Expand Down
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
32 changes: 16 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Using the following categories, list your changes in this order:

## [Unreleased]

- Nothing (yet)
- `django-idom` has been renamed to `reactpy-django`! Please note that all references to the word `idom` in your code should be changed to `reactpy`. See the docs for more details.

## [3.0.0] - 2023-03-08

Expand Down Expand Up @@ -248,18 +248,18 @@ Using the following categories, list your changes in this order:

- 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
[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
61 changes: 40 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
<!--header-start-->
# <img src="https://raw.githubusercontent.com/reactive-python/reactpy/main/branding/svg/reactpy-logo-square.svg" align="left" height="45"/> ReactPy Django

# 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/)
<!--badge-start-->

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

Django-IDOM connects your Python project to a ReactJS front-end, allowing you to create **interactive websites without needing JavaScript!**

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.
[![Tests](https://github.com/reactive-python/reactpy-django/workflows/Test/badge.svg?event=push)](https://github.com/reactive-python/reactpy-django/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/reactive-python/reactpy-django/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%2Freactive-python.github.io%2Freactpy-django%2F)](https://reactive-python.github.io/reactpy-django/)

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).

Any Python web framework with Websockets can support IDOM. See below for what frameworks are supported out of the box.
<!--badge-end-->
<!--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/idom-team/idom-jupyter">Jupyter</a>,
<a href="https://github.com/idom-team/idom-dash">Plotly-Dash</a>
</td>
</tr>
</tbody>
</table>

<!--intro-end-->

Expand All @@ -25,13 +42,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 +61,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 +86,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://reactive-python.github.io/reactpy-django/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-->
2 changes: 1 addition & 1 deletion docs/includes/pr.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Now, you can create/modify the Django-IDOM source code, and Pull Request (PR) your changes to our GitHub repository.
Now, you can create/modify the ReactPy-Django source code, and Pull Request (PR) your changes to our GitHub repository.

To learn how to create GitHub PRs, [click here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
4 changes: 2 additions & 2 deletions docs/python/auth-required-attribute.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.decorators import auth_required
from reactpy_django.decorators import auth_required


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/auth-required-component-fallback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.decorators import auth_required
from reactpy_django.decorators import auth_required


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/auth-required-custom-attribute.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.decorators import auth_required
from reactpy_django.decorators import auth_required


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/auth-required-vdom-fallback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.decorators import auth_required
from reactpy_django.decorators import auth_required


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/auth-required.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.decorators import auth_required
from reactpy_django.decorators import auth_required


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/configure-asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
from channels.routing import ProtocolTypeRouter, URLRouter # noqa: E402
from channels.sessions import SessionMiddlewareStack # noqa: E402

from django_idom import IDOM_WEBSOCKET_PATH # noqa: E402
from reactpy_django import REACTPY_WEBSOCKET_PATH # noqa: E402


application = ProtocolTypeRouter(
{
"http": django_asgi_app,
"websocket": SessionMiddlewareStack(
AuthMiddlewareStack(URLRouter([IDOM_WEBSOCKET_PATH]))
AuthMiddlewareStack(URLRouter([REACTPY_WEBSOCKET_PATH]))
),
}
)
2 changes: 1 addition & 1 deletion docs/python/configure-installed-apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INSTALLED_APPS = [
"django_idom",
"reactpy_django",
...,
]
2 changes: 1 addition & 1 deletion docs/python/configure-urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


urlpatterns = [
path("idom/", include("django_idom.http.urls")),
path("reactpy/", include("reactpy_django.http.urls")),
...,
]
2 changes: 1 addition & 1 deletion docs/python/django-css-external-link.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from idom import component, html
from reactpy import component, html


@component
Expand Down
2 changes: 1 addition & 1 deletion docs/python/django-css-local-link.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.templatetags.static import static
from idom import component, html
from reactpy import component, html


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/django-css.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.components import django_css
from reactpy_django.components import django_css


@component
Expand Down
2 changes: 1 addition & 1 deletion docs/python/django-js-local-script.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.templatetags.static import static
from idom import component, html
from reactpy import component, html


@component
Expand Down
2 changes: 1 addition & 1 deletion docs/python/django-js-remote-script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from idom import component, html
from reactpy import component, html


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/django-js.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.components import django_js
from reactpy_django.components import django_js


@component
Expand Down
10 changes: 5 additions & 5 deletions docs/python/django-query-postprocessor.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from example.models import TodoItem
from idom import component
from reactpy import component

from django_idom.hooks import use_query
from django_idom.types import QueryOptions
from django_idom.utils import django_query_postprocessor
from reactpy_django.hooks import use_query
from reactpy_django.types import QueryOptions
from reactpy_django.utils import django_query_postprocessor


def get_items():
Expand All @@ -12,7 +12,7 @@ def get_items():

@component
def todo_list():
# These `QueryOptions` are functionally equivalent to Django-IDOM's default values
# These `QueryOptions` are functionally equivalent to ReactPy-Django's default values
item_query = use_query(
QueryOptions(
postprocessor=django_query_postprocessor,
Expand Down
18 changes: 9 additions & 9 deletions docs/python/settings.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# IDOM requires a multiprocessing-safe and thread-safe cache.
IDOM_CACHE = "default"
# ReactPy requires a multiprocessing-safe and thread-safe cache.
REACTPY_CACHE = "default"

# IDOM requires a multiprocessing-safe and thread-safe database.
IDOM_DATABASE = "default"
# ReactPy requires a multiprocessing-safe and thread-safe database.
REACTPY_DATABASE = "default"

# Maximum seconds between reconnection attempts before giving up.
# Use `0` to prevent component reconnection.
IDOM_RECONNECT_MAX = 259200
REACTPY_RECONNECT_MAX = 259200

# The URL for IDOM to serve the component rendering websocket
IDOM_WEBSOCKET_URL = "idom/"
# The URL for ReactPy to serve the component rendering websocket
REACTPY_WEBSOCKET_URL = "reactpy/"

# Dotted path to the default `django_idom.hooks.use_query` postprocessor function, or `None`
IDOM_DEFAULT_QUERY_POSTPROCESSOR = "django_idom.utils.django_query_postprocessor"
# Dotted path to the default `reactpy_django.hooks.use_query` postprocessor function, or `None`
REACTPY_DEFAULT_QUERY_POSTPROCESSOR = "reactpy_django.utils.django_query_postprocessor"
2 changes: 1 addition & 1 deletion docs/python/template-tag-args-kwargs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from idom import component
from reactpy import component


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/use-connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.hooks import use_connection
from reactpy_django.hooks import use_connection


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/use-location.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component, html
from reactpy import component, html

from django_idom.hooks import use_location
from reactpy_django.hooks import use_location


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/python/use-mutation-args-kwargs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from idom import component
from reactpy import component

from django_idom.hooks import use_mutation
from reactpy_django.hooks import use_mutation


def example_mutation(value: int, other_value: bool = False):
Expand Down
Loading