Skip to content

Commit d9c618f

Browse files
committed
make misc corrections
1 parent 4b523ae commit d9c618f

File tree

12 files changed

+120
-54
lines changed

12 files changed

+120
-54
lines changed

docs/source/_exts/idom_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _get_file_options(file: Path) -> list[str]:
149149
def _interactive_widget(name, with_activate_button):
150150
return _interactive_widget_template.format(
151151
name=name,
152-
activate_button_opt="" if with_activate_button else ":activate-result:",
152+
activate_button_opt=":activate-button:" if with_activate_button else "",
153153
)
154154

155155

docs/source/_exts/idom_view.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class IteractiveWidget(SphinxDirective):
1919
_next_id = 0
2020

2121
option_spec = {
22-
"activate-result": directives.flag,
22+
"activate-button": directives.flag,
2323
"margin": float,
2424
}
2525

@@ -47,7 +47,7 @@ def run(self):
4747
"{container_id}",
4848
"{view_id}",
4949
"{_IDOM_EXAMPLE_HOST}",
50-
{"false" if "activate-result" in self.options else "true"},
50+
{"true" if "activate-button" in self.options else "false"},
5151
);
5252
</script>
5353
</div>

docs/source/adding-interactivity/responding-to-events.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Not all event data is serialized. The most notable example of this is the lack o
102102
``target`` key in the dictionary sent back to the handler. Instead, data which is not
103103
inherhently JSON serializable must be treated on a case-by-case basis. A simple case
104104
to demonstrate this is the ``currentTime`` attribute of ``audio`` and ``video``
105-
elements. Normally this would be accessible via ``event.target.currenTime``, but here
105+
elements. Normally this would be accessible via ``event.target.currentTime``, but here
106106
it's simply passed in under the key ``currentTime``:
107107

108108
.. idom:: _examples/audio_player
@@ -135,11 +135,10 @@ Stop Event Propogation
135135
......................
136136

137137
Similarly to :ref:`preventing default behavior <Preventing Default Event Actions>`, you
138-
can use the :func:`~idom.core.events.event` decorator to forward declare whether or not
139-
you want events from a child element propogate up through the document to parent
140-
elements by setting ``stop_propagation``. In the example below we place a red ``div``
141-
inside a parent blue ``div``. When propogation is turned on, clicking the red element
142-
will cause the handler for the outer blue one to fire. Conversely, when it's off, only
143-
the handler for the red element will fire.
138+
can use the :func:`~idom.core.events.event` decorator to prevent events originating in a
139+
child element from propagating to parent elements by setting ``stop_propagation``. In
140+
the example below we place a red ``div`` inside a parent blue ``div``. When propogation
141+
is turned on, clicking the red element will cause the handler for the outer blue one to
142+
trigger. Conversely, when it's off, only the handler for the red element will trigger.
144143

145144
.. idom:: _examples/stop_event_propagation

docs/source/conf.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,26 @@
3131
# -- Common External Links ---------------------------------------------------
3232

3333
extlinks = {
34-
"issue": ("https://github.com/idom-team/idom/issues/%s", "#"),
35-
"pull": ("https://github.com/idom-team/idom/pull/%s", "#"),
36-
"discussion": ("https://github.com/idom-team/idom/discussions/%s", "#"),
37-
"commit": ("https://github.com/idom-team/idom/commit/%s", ""),
34+
"issue": (
35+
"https://github.com/idom-team/idom/issues/%s",
36+
"#",
37+
),
38+
"pull": (
39+
"https://github.com/idom-team/idom/pull/%s",
40+
"#",
41+
),
42+
"discussion": (
43+
"https://github.com/idom-team/idom/discussions/%s",
44+
"#",
45+
),
46+
"discussion-type": (
47+
"https://github.com/idom-team/idom/discussions/categories/%s",
48+
"",
49+
),
50+
"commit": (
51+
"https://github.com/idom-team/idom/commit/%s",
52+
"",
53+
),
3854
}
3955

4056
# -- General configuration ---------------------------------------------------

docs/source/developing-idom/contributor-guide.rst

+13-9
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ Contributor Guide
44
.. note::
55

66
If you have any questions during set up or development post on our
7-
`discussion board <https://github.com/idom-team/idom/discussions>`__ and we'll
8-
answer them.
7+
:discussion-type:`discussion board <question>` and we'll answer them.
98

109
This project uses the `GitHub Flow`_ (more detail :ref:`below <Making a Pull Request>`)
1110
for collaboration and consists primarily of Python code and Javascript code. A variety
@@ -124,7 +123,7 @@ If you modify any Javascript, you'll need to re-install IDOM:
124123
125124
pip install -e .
126125
127-
However you may also ``cd`` to the ``src/idom/client/app`` directory which contains a
126+
However you may also ``cd`` to the ``src/client`` directory which contains a
128127
``package.json`` that you can use to run standard ``npm`` commands from.
129128

130129

@@ -363,12 +362,17 @@ Other Core Repositories
363362
IDOM depends on, or is used by several other core projects. For documentation on them
364363
you should refer to their respective documentation in the links below:
365364

366-
- https://github.com/idom-team/idom-react-component-cookiecutter - A template repo for
367-
making :ref:`Custom Javascript Components`.
368-
- https://github.com/idom-team/flake8-idom-hooks - Enforces the :ref:`Rules of Hooks`
369-
- https://github.com/idom-team/idom-jupyter - IDOM integration for Jupyter
370-
- https://github.com/idom-team/idom-dash - IDOM integration for Plotly Dash
371-
- https://github.com/idom-team/django-idom - IDOM integration for Django
365+
- `idom-react-component-cookiecutter
366+
<https://github.com/idom-team/idom-react-component-cookiecutter>`__ - Template repo
367+
for making :ref:`Custom Javascript Components`.
368+
- `flake8-idom-hooks <https://github.com/idom-team/flake8-idom-hooks>`__ - Enforces the
369+
:ref:`Rules of Hooks`
370+
- `idom-jupyter <https://github.com/idom-team/idom-jupyter>`__ - IDOM integration for
371+
Jupyter
372+
- `idom-dash <https://github.com/idom-team/idom-dash>`__ - IDOM integration for Plotly
373+
Dash
374+
- `django-idom <https://github.com/idom-team/django-idom>`__ - IDOM integration for
375+
Django
372376

373377
.. Links
374378
.. =====

docs/source/developing-idom/index.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ you can help move this project and community forward!
4949
See the long term goals of the IDOM team
5050

5151

52+
.. _everyone can contribute:
53+
5254
Everyone Can Contribute!
5355
------------------------
5456

@@ -61,6 +63,5 @@ who can:
6163
- Report bugs
6264
- Participate in general discussions
6365

64-
Still aren't sure what you have to offer? Just
65-
`ask us <https://github.com/idom-team/idom/discussions>`__ and we'll help you make your
66-
first contribution.
66+
Still aren't sure what you have to offer? Just :discussion-type:`ask us <question>` and
67+
we'll help you make your first contribution.

docs/source/getting-started/index.rst

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ Getting Started
2828
See the ways that IDOM can be run with servers or be embedded in existing
2929
applications.
3030

31-
The fastest way to get started with IDOM is to try it out in a Juptyer Notebook. If you
32-
want to use a Notebook to work through the examples shown in this documentation, you'll
33-
want to replace calls to ``idom.run(App)`` with a line at the end of each cell that
34-
constructs the ``App()`` in question. If that doesn't make sense, the introductory
31+
The fastest way to get started with IDOM is to try it out in a `Juptyer Notebook
32+
<https://mybinder.org/v2/gh/idom-team/idom-jupyter/main?urlpath=lab/tree/notebooks/introduction.ipynb>`__.
33+
If you want to use a Notebook to work through the examples shown in this documentation,
34+
you'll need to replace calls to ``idom.run(App)`` with a line at the end of each cell
35+
that constructs the ``App()`` in question. If that doesn't make sense, the introductory
3536
notebook linked below will demonstrate how to do this:
3637

3738
.. card::
@@ -71,8 +72,8 @@ If you get a ``RuntimeError`` similar to the following:
7172
7273
Then be sure you installed ``"idom[stable]"`` and not just ``idom``.
7374

74-
For anything else, report your issue in IDOM's
75-
`discussion forum <https://github.com/idom-team/idom/discussions/categories/help>`__.
75+
For anything else, report your issue in IDOM's :discussion-type:`discussion forum
76+
<problem>`.
7677

7778
.. card::
7879
:link: installing-idom

docs/source/getting-started/installing-idom.rst

+36-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ The easiest way to ``pip`` install idom is to do so using the ``stable`` option:
88
pip install "idom[stable]"
99
1010
This includes a set of default dependencies for one of the builtin web server
11-
implementation.
11+
implementation. If you want to install IDOM without these dependencies you may simply
12+
``pip install idom``.
1213

1314

1415
Installing Other Servers
1516
------------------------
1617

17-
If you want to install IDOM without these dependencies you may simply ``pip install
18-
idom`` or, alternatively, if you want a specific web server implementation you can
19-
select on of the other installation options below:
18+
IDOM includes built-in support for a variety web server implementations. To install the
19+
required dependencies for each you should substitute ``stable`` from the ``pip install``
20+
command above with one of the options below:
2021

2122
- ``fastapi`` - https://fastapi.tiangolo.com
2223
- ``flask`` - https://palletsprojects.com/p/flask/
@@ -29,16 +30,17 @@ If you need to, you can install more than one option by separating them with com
2930
3031
pip install idom[fastapi,flask,sanic,tornado]
3132
32-
Once this is complete you should be able to :ref:`run IDOM applications <Running IDOM>`.
33+
Once this is complete you should be able to :ref:`run IDOM <Running IDOM>` with your
34+
:ref:`chosen server implementation <choosing a server implementation>`.
3335

3436

3537
Installing In Other Frameworks
3638
------------------------------
3739

3840
While IDOM can run in a variety of contexts, sometimes web frameworks require extra work
39-
in orer to integrate with them. In these cases, the IDOM team distributes bindings for
40-
these frameworks as separate Python packages. For documentation on how to install and
41-
use these, follow the links below:
41+
in order to integrate with them. In these cases, the IDOM team distributes bindings for
42+
various frameworks as separate Python packages. For documentation on how to install and
43+
run IDOM in the supported frameworks, follow the links below:
4244

4345
.. raw:: html
4446

@@ -69,3 +71,29 @@ use these, follow the links below:
6971
:link: https://github.com/idom-team/idom-dash
7072
:img-background: _static/logo-plotly.svg
7173
:class-card: card-logo-image
74+
75+
76+
Installing for Development
77+
--------------------------
78+
79+
If you want to contribute to the development of IDOM or modify it, you'll want to
80+
install a development version of IDOM. This involves cloning the repository where IDOM's
81+
source is maintained, and setting up a :ref:`development environment`. From there you'll
82+
be able to modifying IDOM's source code and :ref:`run its tests <Running The Tests>` to
83+
ensure the modifications you've made are backwards compatible. If you want to add a new
84+
feature to IDOM you should write your own test that validates its behavior.
85+
86+
If you have questions about how to modify IDOM or help with its development, be sure to
87+
`start a discussion
88+
<https://github.com/idom-team/idom/discussions/new?category=question>`__. The IDOM team
89+
are always excited to :ref:`welcome <everyone can contribute>` new contributions and
90+
contributors of all kinds
91+
92+
.. card::
93+
:link: /developing-idom/index
94+
:link-type: doc
95+
96+
:octicon:`book` Read More
97+
^^^^^^^^^^^^^^^^^^^^^^^^^
98+
99+
Learn more about how to contribute to the development of IDOM.

docs/source/getting-started/running-idom.rst

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
.. card::
2+
:class-card: adminition hint
3+
4+
If IDOM is installed in another framework will require :ref:`different run
5+
instructions <Installing In Other Frameworks>`.
6+
7+
18
Running IDOM
29
============
310

docs/source/index.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
.. note::
1+
.. card::
22

33
This documentation is still under construction 🚧. We welcome your `feedback
44
<https://github.com/idom-team/idom/discussions>`__!
55

66

7-
IDOM
8-
====
7+
What is IDOM?
8+
=============
99

1010
.. toctree::
1111
:hidden:
@@ -119,10 +119,9 @@ Chapter 2 - :ref:`Creating Interfaces`
119119

120120
IDOM is a Python package for making user interfaces (UI). These interfaces are built
121121
from small elements of functionality like buttons text and images. IDOM allows you to
122-
combine these elements into reusable, nestable :ref:`"components" <your first
123-
components>`. In the sections that follow you'll learn how these UI elements are created
124-
and organized into components. Then, you'll use this knowledge to create interfaces from
125-
raw data:
122+
combine these elements into reusable :ref:`"components" <your first components>`. In the
123+
sections that follow you'll learn how these UI elements are created and organized into
124+
components. Then, you'll use this knowledge to create interfaces from raw data:
126125

127126
.. idom:: creating-interfaces/_examples/todo_list_with_keys
128127

docs/source/reference-material/faq.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
FAQ
22
===
33

4-
See our `Discussion Forum <https://github.com/idom-team/idom/discussions>`__ for more
5-
questions and answers.
4+
See our :discussion-type:`Discussion Forum <question>` for more questions and answers.
65

76

87
Do UI components run client-side?

noxfile.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212

1313
ROOT = Path(__file__).parent
14+
SRC = ROOT / "src"
1415
POSARGS_PATTERN = re.compile(r"^(\w+)\[(.+)\]$")
1516

1617

@@ -34,7 +35,7 @@ def format(session: Session) -> None:
3435
session.run("isort", ".")
3536

3637
# format client Javascript
37-
session.chdir(ROOT / "src" / "client")
38+
session.chdir(SRC / "client")
3839
session.run("npm", "run", "format", external=True)
3940

4041
# format docs Javascript
@@ -113,22 +114,24 @@ def docs_in_docker(session: Session) -> None:
113114
@nox.session
114115
def test(session: Session) -> None:
115116
"""Run the complete test suite"""
116-
session.notify("test_suite", posargs=session.posargs)
117+
session.notify("test_python", posargs=session.posargs)
117118
session.notify("test_types")
118119
session.notify("test_style")
119120
session.notify("test_docs")
121+
session.notify("test_javascript")
120122

121123

122124
@nox.session
123125
def test_short(session: Session) -> None:
124126
"""Run a shortened version of the test suite"""
125-
session.notify("test_suite", posargs=session.posargs)
127+
session.notify("test_python", posargs=session.posargs)
126128
session.notify("test_docs")
129+
session.notify("test_javascript")
127130

128131

129132
@nox.session
130133
@apply_standard_pip_upgrades
131-
def test_suite(session: Session) -> None:
134+
def test_python(session: Session) -> None:
132135
"""Run the Python-based test suite"""
133136
session.env["IDOM_DEBUG_MODE"] = "1"
134137
install_requirements_file(session, "test-env")
@@ -191,6 +194,15 @@ def test_docs(session: Session) -> None:
191194
session.run("sphinx-build", "-b", "doctest", "docs/source", "docs/build")
192195

193196

197+
@nox.session
198+
def test_javascript(session: Session) -> None:
199+
"""Run the Javascript-based test suite and ensure it bundles succesfully"""
200+
session.chdir(SRC / "client")
201+
session.run("npm", "install", external=True)
202+
session.run("npm", "run", "test", external=True)
203+
session.run("npm", "run", "build", external=True)
204+
205+
194206
@nox.session
195207
def tag(session: Session):
196208
"""Create a new git tag"""
@@ -255,7 +267,7 @@ def update_version(session: Session) -> None:
255267

256268
@nox.session
257269
def build_js(session: Session) -> None:
258-
session.chdir(ROOT / "src" / "client")
270+
session.chdir(SRC / "client")
259271
session.run("npm", "run", "build", external=True)
260272

261273

0 commit comments

Comments
 (0)