Skip to content

Commit

Permalink
rename idom to reactpy
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed Jan 28, 2023
1 parent e9c6f3c commit fce5cc0
Show file tree
Hide file tree
Showing 237 changed files with 2,465 additions and 1,918 deletions.
2 changes: 1 addition & 1 deletion .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/idom/discussions
url: https://github.com/reactpy-team/reactpy/discussions
about: Report issues, request features, ask questions, and share ideas
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --- Build Artifacts ---
src/idom/_client
src/reactpy/_client

# --- Jupyter ---
*.ipynb_checkpoints
Expand Down
6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
recursive-include src/idom/_client *
recursive-include src/idom/web/templates *
include src/idom/py.typed
recursive-include src/reactpy/_client *
recursive-include src/reactpy/web/templates *
include src/reactpy/py.typed
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# IDOM · [![Tests](https://github.com/idom-team/idom/workflows/test/badge.svg)](https://github.com/idom-team/idom/actions?query=workflow%3ATest) [![PyPI Version](https://img.shields.io/pypi/v/idom.svg)](https://pypi.python.org/pypi/idom) [![License](https://img.shields.io/badge/License-MIT-purple.svg)](https://github.com/idom-team/idom/blob/main/LICENSE)
# ReactPy · [![Tests](https://github.com/reactpy-team/reactpy/workflows/test/badge.svg)](https://github.com/reactpy-team/reactpy/actions?query=workflow%3ATest) [![PyPI Version](https://img.shields.io/pypi/v/reactpy.svg)](https://pypi.python.org/pypi/reactpy) [![License](https://img.shields.io/badge/License-MIT-purple.svg)](https://github.com/reactpy-team/reactpy/blob/main/LICENSE)

IDOM connects your Python web framework of choice to a ReactJS frontend, allowing you to create **interactive websites without needing JavaScript!**
ReactPy connects your Python web framework of choice to a ReactJS frontend, allowing you to create **interactive websites without needing JavaScript!**

Following ReactJS styling, web elements are combined into [reusable "components"](https://idom-docs.herokuapp.com/docs/guides/creating-interfaces/your-first-components/index.html#parametrizing-components). These components can utilize [hooks](https://idom-docs.herokuapp.com/docs/reference/hooks-api.html) and [events](https://idom-docs.herokuapp.com/docs/guides/adding-interactivity/responding-to-events/index.html#async-event-handlers) to create infinitely complex web pages.
Following ReactJS styling, web elements are combined into [reusable "components"](https://reactpy-docs.herokuapp.com/docs/guides/creating-interfaces/your-first-components/index.html#parametrizing-components). These components can utilize [hooks](https://reactpy-docs.herokuapp.com/docs/reference/hooks-api.html) and [events](https://reactpy-docs.herokuapp.com/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://idom-docs.herokuapp.com/docs/guides/escape-hatches/javascript-components.html#dynamically-loaded-components). For additional flexibility, components can also be [fully developed in JavaScript](https://idom-docs.herokuapp.com/docs/guides/escape-hatches/javascript-components.html#custom-javascript-components).
When needed, ReactPy can [use components directly from NPM](https://reactpy-docs.herokuapp.com/docs/guides/escape-hatches/javascript-components.html#dynamically-loaded-components). For additional flexibility, components can also be [fully developed in JavaScript](https://reactpy-docs.herokuapp.com/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.

| Supported Frameworks | Supported Frameworks (External) |
| --- | --- |
| [`Flask`, `FastAPI`, `Sanic`, `Tornado`](https://idom-docs.herokuapp.com/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) |
Any Python web framework with Websockets can support ReactPy. See below for what frameworks are supported out of the box.

| Supported Frameworks | Supported Frameworks (External) |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`Flask`, `FastAPI`, `Sanic`, `Tornado`](https://reactpy-docs.herokuapp.com/docs/guides/getting-started/installing-reactpy.html#officially-supported-servers) | [`Django`](https://github.com/reactpy-team/django-idom), [`Plotly-Dash`](https://github.com/reactpy-team/idom-dash), [`Jupyter`](https://github.com/reactpy-team/idom-jupyter) |

# At a Glance

To get a rough idea of how to write apps in IDOM, take a look at this tiny _Hello World_ application.
To get a rough idea of how to write apps in ReactPy, take a look at this tiny _Hello World_ application.

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

@component
def HelloWorld():
Expand All @@ -31,8 +30,8 @@ run(HelloWorld)

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-docs.herokuapp.com/) - 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.
- [Contributor Guide](https://idom-docs.herokuapp.com/docs/developing-idom/contributor-guide.html) - see how you can help develop this project.
- [Code of Conduct](https://github.com/idom-team/idom/blob/main/CODE_OF_CONDUCT.md) - standards for interacting with this community.
- [Try it Now](https://mybinder.org/v2/gh/reactpy-team/idom-jupyter/main?urlpath=lab/tree/notebooks/introduction.ipynb) - check out ReactPy in a Jupyter Notebook.
- [Documentation](https://reactpy-docs.herokuapp.com/) - learn how to install, run, and use ReactPy.
- [Community Forum](https://github.com/reactpy-team/reactpy/discussions) - ask questions, share ideas, and show off projects.
- [Contributor Guide](https://reactpy-docs.herokuapp.com/docs/developing-reactpy/contributor-guide.html) - see how you can help develop this project.
- [Code of Conduct](https://github.com/reactpy-team/reactpy/blob/main/CODE_OF_CONDUCT.md) - standards for interacting with this community.
2 changes: 1 addition & 1 deletion branding/svg/idom-logo-backed-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion branding/svg/idom-logo-backed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion branding/svg/idom-logo-square-small.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion branding/svg/idom-logo-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion branding/svg/idom-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --upgrade pip

# Install IDOM
# Install ReactPy
# ------------
COPY requirements ./requirements
RUN pip install -r requirements/build-docs.txt
Expand Down Expand Up @@ -44,6 +44,6 @@ RUN sphinx-build -v -W -b html docs/source docs/build
# Define Entrypoint
# -----------------
ENV PORT 5000
ENV IDOM_DEBUG_MODE=1
ENV IDOM_CHECK_VDOM_SPEC=0
ENV ReactPy_DEBUG_MODE=1
ENV ReactPy_CHECK_VDOM_SPEC=0
CMD python scripts/run_docs.py
5 changes: 2 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# IDOM's Documentation
# ReactPy's Documentation

We provide two main ways to run the docs. Both use `nox` which has a `noxfile.py` at the
root of the repository. Running the docs with `nox -s docs` will start up an iteractive
session which will rebuild the docs any time a file is modified. Using `nox -s
docs_in_docker` on the other hand, will build a docker image and run the docs from
session which will rebuild the docs any time a file is modified. Using `nox -s docs_in_docker` on the other hand, will build a docker image and run the docs from
there. The latter command mimics how the docs will behave in production. As such, if any
changes to the core of the documentation are made (i.e. to non-`*.rst` files), then you
should run a manual test of the documentation using the `docs_in_docker` session.
Expand Down
12 changes: 6 additions & 6 deletions docs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

from sanic import Sanic, response

from idom import component
from idom.backend.sanic import Options, configure, use_request
from idom.core.types import ComponentConstructor
from reactpy import component
from reactpy.backend.sanic import Options, configure, use_request
from reactpy.core.types import ComponentConstructor

from .examples import get_normalized_example_name, load_examples


HERE = Path(__file__).parent
IDOM_MODEL_SERVER_URL_PREFIX = "/_idom"
ReactPy_MODEL_SERVER_URL_PREFIX = "/_reactpy"

logger = getLogger(__name__)


IDOM_MODEL_SERVER_URL_PREFIX = "/_idom"
ReactPy_MODEL_SERVER_URL_PREFIX = "/_reactpy"


@component
Expand Down Expand Up @@ -52,7 +52,7 @@ async def forward_to_index(request):
configure(
app,
Example,
Options(url_prefix=IDOM_MODEL_SERVER_URL_PREFIX),
Options(url_prefix=ReactPy_MODEL_SERVER_URL_PREFIX),
)

return app
32 changes: 18 additions & 14 deletions docs/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
from traceback import format_exc
from typing import Callable, Iterator

import idom
from idom.types import ComponentType
import reactpy
from reactpy.types import ComponentType


HERE = Path(__file__)
SOURCE_DIR = HERE.parent / "source"
CONF_FILE = SOURCE_DIR / "conf.py"
RUN_IDOM = idom.run
RUN_ReactPy = reactpy.run


def load_examples() -> Iterator[tuple[str, Callable[[], ComponentType]]]:
Expand Down Expand Up @@ -95,7 +95,7 @@ def capture_component(component_constructor):
nonlocal captured_component_constructor
captured_component_constructor = component_constructor

idom.run = capture_component
reactpy.run = capture_component
try:
code = compile(file.read_text(), str(file), "exec")
exec(
Expand All @@ -109,20 +109,24 @@ def capture_component(component_constructor):
except Exception:
return _make_error_display(format_exc())
finally:
idom.run = RUN_IDOM
reactpy.run = RUN_ReactPy

if captured_component_constructor is None:
return _make_example_did_not_run(str(file))

@idom.component
@reactpy.component
def Wrapper():
return idom.html.div(captured_component_constructor(), PrintView())
return reactpy.html.div(captured_component_constructor(), PrintView())

@idom.component
@reactpy.component
def PrintView():
text, set_text = idom.hooks.use_state(print_buffer.getvalue())
text, set_text = reactpy.hooks.use_state(print_buffer.getvalue())
print_buffer.set_callback(set_text)
return idom.html.pre(text, class_name="printout") if text else idom.html.div()
return (
reactpy.html.pre(text, class_name="printout")
if text
else reactpy.html.div()
)

return Wrapper()

Expand Down Expand Up @@ -159,16 +163,16 @@ def write(self, text: str) -> None:


def _make_example_did_not_run(example_name):
@idom.component
@reactpy.component
def ExampleDidNotRun():
return idom.html.code(f"Example {example_name} did not run")
return reactpy.html.code(f"Example {example_name} did not run")

return ExampleDidNotRun()


def _make_error_display(message):
@idom.component
@reactpy.component
def ShowError():
return idom.html.pre(message)
return reactpy.html.pre(message)

return ShowError()
2 changes: 1 addition & 1 deletion docs/source/_custom_js/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Custom Javascript for IDOM's Docs
# Custom Javascript for ReactPy's Docs

Build the javascript with

Expand Down
54 changes: 27 additions & 27 deletions docs/source/_custom_js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/source/_custom_js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "idom-docs-example-loader",
"name": "reactpy-docs-example-loader",
"version": "1.0.0",
"description": "simple javascript client for IDOM's documentation",
"main": "index.js",
Expand All @@ -15,6 +15,6 @@
"rollup": "^2.35.1"
},
"dependencies": {
"idom-client-react": "file:../../../src/client/packages/idom-client-react"
"@reactpy/client": "file:../../../src/client/packages/@reactpy/client"
}
}
Loading

0 comments on commit fce5cc0

Please sign in to comment.