Skip to content

Use "backend" instead of "server" #726

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 11 commits into from
Apr 13, 2022
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
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# --- Build Artifacts ---
src/idom/_client

# --- Jupyter ---
*.ipynb_checkpoints
*Untitled*.ipynb
Expand Down Expand Up @@ -37,6 +40,5 @@ pip-wheel-metadata
.vscode

# --- JS ---

node_modules
src/idom/client

2 changes: 1 addition & 1 deletion 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/_client *
recursive-include src/idom/web/templates *
include src/idom/py.typed
2 changes: 1 addition & 1 deletion docs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
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 idom.server.sanic import Options, configure, use_request

from .examples import get_normalized_example_name, load_examples

Expand Down
5 changes: 5 additions & 0 deletions docs/source/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ Changed:

- IDOM's client now uses Preact instead of React - :pull:`721`

- Renamed ``idom.server`` to ``idom.backend`` - :pull:`726`

Other references to "server implementations" have been renamed to "backend
implementations" throughout the documentation and code.

Removed:

- ``redirect_root`` server option - :pull:`721`
Expand Down
23 changes: 13 additions & 10 deletions docs/source/about/contributor-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ Still aren't sure what you have to offer? Just :discussion-type:`ask us <questio
we'll help you make your first contribution.


.. note::

If you have any questions during set up or development post on our
:discussion-type:`discussion board <question>` and we'll answer them.


Making a Pull Request
---------------------

Expand All @@ -53,21 +47,25 @@ about how to get started. To make a change to IDOM you'll do the following:
You use a ``git clone`` command to copy the code from GitHub to your computer.

`Create a new branch <https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging>`__:
You'll ``git checkout -b your-first-branch`` to create a new space to start your work
You'll ``git checkout -b your-first-branch`` to create a new space to start your work.

:ref:`Prepare your Development Environment <Development Environment>`:
We explain in more detail below how to install all IDOM's dependencies
We explain in more detail below how to install all IDOM's dependencies.

`Push your changes <https://docs.github.com/en/github/using-git/pushing-commits-to-a-remote-repository>`__:
Once you've made changes to IDOM, you'll ``git push`` them to your fork.

:ref:`Create a changelog entry <Creating a changelog entry>`:
Record your changes in the :ref:`changelog` so we can publicize them in the next release.

`Create a Pull Request <https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request>`__:
We'll review your changes, run some :ref:`tests <Running The Tests>` and
:ref:`equality checks <Code Quality Checks>` and, with any luck, accept your request.
At that point your contribution will be merged into the main codebase!


Creating a Changelog Entry
..........................
--------------------------

As part of your pull request, you'll want to edit the `Changelog
<https://github.com/idom-team/idom/blob/main/docs/source/about/changelog.rst>`__ by
Expand Down Expand Up @@ -112,6 +110,11 @@ might look like:
Development Environment
-----------------------

.. note::

If you have any questions during set up or development post on our
:discussion-type:`discussion board <question>` and we'll answer them.

In order to develop IDOM locally you'll first need to install the following:

.. list-table::
Expand All @@ -120,7 +123,7 @@ In order to develop IDOM locally you'll first need to install the following:
* - What to Install
- How to Install

* - Git_
* - Git
- https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

* - Python >= 3.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ does not work:

Try clicking the button to see that it does not cause a change.

After clicking "Next", if you check the server logs, you'll discover an
After clicking "Next", if you check your web server's logs, you'll discover an
``UnboundLocalError`` error. It turns out that in this case, the ``index = index + 1``
statement is similar to `trying to set global variables
<https://stackoverflow.com/questions/9264763/dont-understand-why-unboundlocalerror-occurs-closure>`__.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Event Data Serialization

Not all event data is serialized. The most notable example of this is the lack of a
``target`` key in the dictionary sent back to the handler. Instead, data which is not
inherhently JSON serializable must be treated on a case-by-case basis. A simple case
inherently JSON serializable must be treated on a case-by-case basis. A simple case
to demonstrate this is the ``currentTime`` attribute of ``audio`` and ``video``
elements. Normally this would be accessible via ``event.target.currentTime``, but here
it's simply passed in under the key ``currentTime``:
Expand Down
4 changes: 2 additions & 2 deletions docs/source/guides/creating-interfaces/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ conditionally display more complex UIs.
Section 1: HTML with IDOM
-------------------------

In a typical Python-base web application the resonsibility of defining the view along
In a typical Python-base web application the responsibility of defining the view along
with its backing data and logic are distributed between a client and server
respectively. With IDOM, both these tasks are centralized in a single place. The most
foundational pilar of this capability is formed by allowing HTML interfaces to be
Expand Down Expand Up @@ -112,7 +112,7 @@ Section 3: Rendering Data
The last pillar of knowledge you need before you can start making :ref:`interactive
interfaces <adding interactivity>` is the ability to render sections of the UI given a
collection of data. This will require you to understand how elements which are derived
from data in this way must be orgnized with :ref:`"keys" <Organizing Items With Keys>`.
from data in this way must be organized with :ref:`"keys" <Organizing Items With Keys>`.
One case where we might want to do this is if items in a todo list come from a list of
data that we want to sort and filter:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/guides/escape-hatches/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Escape Hatches

javascript-components
distributing-javascript
writing-your-own-server
writing-your-own-client
using-a-custom-backend
using-a-custom-client

.. note::

Expand Down
9 changes: 9 additions & 0 deletions docs/source/guides/escape-hatches/using-a-custom-backend.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _Writing Your Own Backend:
.. _Using a Custom Backend:

Using a Custom Backend 🚧
=========================

.. note::

Under construction 🚧
9 changes: 9 additions & 0 deletions docs/source/guides/escape-hatches/using-a-custom-client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _Writing Your Own Client:
.. _Using a Custom Client:

Using a Custom Client 🚧
========================

.. note::

Under construction 🚧
8 changes: 0 additions & 8 deletions docs/source/guides/escape-hatches/writing-your-own-client.rst

This file was deleted.

8 changes: 0 additions & 8 deletions docs/source/guides/escape-hatches/writing-your-own-server.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/source/guides/getting-started/_examples/run_fastapi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# :lines: 11-

from idom import run
from idom.server import fastapi as fastapi_server
from idom.backend import fastapi as fastapi_server


# the run() function is the entry point for examples
Expand All @@ -11,7 +11,7 @@
from fastapi import FastAPI

from idom import component, html
from idom.server.fastapi import configure
from idom.backend.fastapi import configure


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/source/guides/getting-started/_examples/run_flask.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# :lines: 11-

from idom import run
from idom.server import flask as flask_server
from idom.backend import flask as flask_server


# the run() function is the entry point for examples
Expand All @@ -11,7 +11,7 @@
from flask import Flask

from idom import component, html
from idom.server.flask import configure
from idom.backend.flask import configure


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/source/guides/getting-started/_examples/run_sanic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# :lines: 11-

from idom import run
from idom.server import sanic as sanic_server
from idom.backend import sanic as sanic_server


# the run() function is the entry point for examples
Expand All @@ -11,7 +11,7 @@
from sanic import Sanic

from idom import component, html
from idom.server.sanic import configure
from idom.backend.sanic import configure


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/source/guides/getting-started/_examples/run_starlette.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# :lines: 11-

from idom import run
from idom.server import starlette as starlette_server
from idom.backend import starlette as starlette_server


# the run() function is the entry point for examples
Expand All @@ -11,7 +11,7 @@
from starlette.applications import Starlette

from idom import component, html
from idom.server.starlette import configure
from idom.backend.starlette import configure


@component
Expand Down
4 changes: 2 additions & 2 deletions docs/source/guides/getting-started/_examples/run_tornado.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# :lines: 11-

from idom import run
from idom.server import tornado as tornado_server
from idom.backend import tornado as tornado_server


# the run() function is the entry point for examples
Expand All @@ -12,7 +12,7 @@
import tornado.web

from idom import component, html
from idom.server.tornado import configure
from idom.backend.tornado import configure


@component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sanic.response import file

from idom import component, html
from idom.server.sanic import Options, configure
from idom.backend.sanic import Options, configure


app = Sanic("MyApp")
Expand Down
6 changes: 3 additions & 3 deletions docs/source/guides/getting-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ Section 2: Running IDOM

Once you've :ref:`installed IDOM <Installing IDOM>`, you'll want to learn how to run an
application. Throughout most of the examples in this documentation, you'll see the
:func:`~idom.server.utils.run` function used. While it's convenient tool for development
it shouldn't be used in production settings - it's slow, and could leak secrets through
debug log messages.
:func:`~idom.backend.utils.run` function used. While it's convenient tool for
development it shouldn't be used in production settings - it's slow, and could leak
secrets through debug log messages.

.. idom:: _examples/hello_world

Expand Down
36 changes: 18 additions & 18 deletions docs/source/guides/getting-started/installing-idom.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Installing IDOM
===============

Installing IDOM with ``pip`` will generally require doing so alongside a supported
server implementation. This can be done by specifying an installation extra using square
brackets. For example, if we want to run IDOM using `Starlette
<https://www.starlette.io/>`__ we would run:
You will typically ``pip`` install IDOM to alongside one of it's natively supported
backends. For example, if we want to run IDOM using the `Starlette
<https://www.starlette.io/>`__ backend you would run

.. code-block:: bash

pip install "idom[starlette]"

If you want to install a "pure" version of IDOM without a server implementation you can
do so without any installation extras. You might do this if you wanted to user a server
which is not officially supported or if you wanted to manually pin your dependencies:
If you want to install a "pure" version of IDOM without a backend implementation you can
do so without any installation extras. You might do this if you wanted to :ref:`use a
custom backend <using a custom backend>` or if you wanted to manually pin your
dependencies:

.. code-block:: bash

pip install idom


Officially Supported Servers
----------------------------
Native Backends
---------------

IDOM includes built-in support for a variety web server implementations. To install the
IDOM includes built-in support for a variety backend implementations. To install the
required dependencies for each you should substitute ``starlette`` from the ``pip
install`` command above with one of the options below:

Expand All @@ -39,15 +39,15 @@ If you need to, you can install more than one option by separating them with com
pip install "idom[fastapi,flask,sanic,starlette,tornado]"

Once this is complete you should be able to :ref:`run IDOM <Running IDOM>` with your
chosen server implementation.
chosen implementation.


Installing In Other Frameworks
------------------------------
Other Backends
--------------

While IDOM can run in a variety of contexts, sometimes web frameworks require extra work
in order to integrate with them. In these cases, the IDOM team distributes bindings for
various frameworks as separate Python packages. For documentation on how to install and
While IDOM can run in a variety of contexts, sometimes frameworks require extra work in
order to integrate with them. In these cases, the IDOM team distributes bindings for
those frameworks as separate Python packages. For documentation on how to install and
run IDOM in these supported frameworks, follow the links below:

.. raw:: html
Expand Down Expand Up @@ -96,8 +96,8 @@ run IDOM in these supported frameworks, follow the links below:
:transparent-text-color:`Plotly Dash`


Installing for Development
--------------------------
For Development
---------------

If you want to contribute to the development of IDOM or modify it, you'll want to
install a development version of IDOM. This involves cloning the repository where IDOM's
Expand Down
Loading