Skip to content

Commit f96538c

Browse files
authored
rename proto modules to types (#701)
* rename proto modules to types * sphinx ignore __all__ * changelog entry * fix doc issue not sure why this was not caught earlier
1 parent d73b79f commit f96538c

28 files changed

+111
-64
lines changed

docs/examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Callable, Iterator
77

88
import idom
9-
from idom import ComponentType
9+
from idom.types import ComponentType
1010

1111

1212
HERE = Path(__file__)

docs/source/_custom_js/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/source/_exts/autogen_api_docs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
AUTODOC_TEMPLATE_WITH_MEMBERS = """\
2323
.. automodule:: {module}
2424
:members:
25+
:ignore-module-all:
2526
"""
2627

2728
AUTODOC_TEMPLATE_WITHOUT_MEMBERS = """\
2829
.. automodule:: {module}
30+
:ignore-module-all:
2931
"""
3032

3133
TITLE = """\

docs/source/about/changelog.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ Changelog
1010

1111
All notable changes to this project will be recorded in this document. The style of
1212
which is based on `Keep a Changelog <https://keepachangelog.com/>`__. The versioning
13-
scheme for the project adheres to `Semantic Versioning <https://semver.org/>`__.
13+
scheme for the project adheres to `Semantic Versioning <https://semver.org/>`__. For
14+
more info, see the :ref:`Contributor Guide <Create a Changelog Entry>`.
1415

1516

1617
Unreleased
1718
----------
1819

19-
Nothing yet...
20+
Changed:
21+
22+
- The name of ``proto`` modules to ``types`` and added a top level ``idom.types`` module
23+
- :pull:`701`
2024

2125

2226
0.37.1

docs/source/about/contributor-guide.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ about how to get started. To make a change to IDOM you'll do the following:
6969
Create a Changelog Entry
7070
........................
7171

72-
As part of your pull request, you'll want to edit the :ref:`Changelog` by adding an
73-
entry describing what you've changed or improved. You should write an entry in the style
74-
of `Keep a Changelog <https://keepachangelog.com/>`__ that falls under one of the
75-
following categories, and add it to the :ref:`Unreleased` section of the changelog:
72+
As part of your pull request, you'll want to edit the `Changelog
73+
<https://github.com/idom-team/idom/blob/main/docs/source/about/changelog.rst>`__ by
74+
adding an entry describing what you've changed or improved. You should write an entry in
75+
the style of `Keep a Changelog <https://keepachangelog.com/>`__ that falls under one of
76+
the following categories, and add it to the :ref:`Unreleased` section of the changelog:
7677

7778
- **Added** - for new features.
7879
- **Changed** - for changes in existing functionality.

src/idom/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from . import config, html, log, web
1+
from . import config, html, log, types, web
22
from .core import hooks
3-
from .core.component import Component, component
3+
from .core.component import component
44
from .core.dispatcher import Stop
5-
from .core.events import EventHandler, event
5+
from .core.events import event
66
from .core.hooks import (
77
create_context,
88
use_callback,
@@ -14,7 +14,6 @@
1414
use_state,
1515
)
1616
from .core.layout import Layout
17-
from .core.proto import ComponentType, VdomDict
1817
from .core.vdom import vdom
1918
from .sample import run_sample_app
2019
from .server.prefab import run
@@ -27,12 +26,9 @@
2726

2827
__all__ = [
2928
"component",
30-
"Component",
31-
"ComponentType",
3229
"config",
3330
"create_context",
3431
"event",
35-
"EventHandler",
3632
"hooks",
3733
"hotswap",
3834
"html_to_vdom",
@@ -44,6 +40,7 @@
4440
"run_sample_app",
4541
"run",
4642
"Stop",
43+
"types",
4744
"use_callback",
4845
"use_context",
4946
"use_effect",
@@ -52,6 +49,5 @@
5249
"use_ref",
5350
"use_state",
5451
"vdom",
55-
"VdomDict",
5652
"web",
5753
]

src/idom/core/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from functools import wraps
55
from typing import Any, Callable, Dict, Optional, Tuple, Union
66

7-
from .proto import ComponentType, VdomDict
7+
from .types import ComponentType, VdomDict
88

99

1010
def component(

src/idom/core/dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from ._fixed_jsonpatch import apply_patch, make_patch # type: ignore
2626
from .layout import LayoutEvent, LayoutUpdate
27-
from .proto import LayoutType, VdomJson
27+
from .types import LayoutType, VdomJson
2828

2929

3030
logger = getLogger(__name__)

src/idom/core/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from anyio import create_task_group
77
from typing_extensions import Literal
88

9-
from idom.core.proto import EventHandlerFunc, EventHandlerType
9+
from idom.core.types import EventHandlerFunc, EventHandlerType
1010

1111

1212
@overload

src/idom/core/hooks.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from idom.utils import Ref
2828

2929
from ._thread_local import ThreadLocal
30-
from .proto import Key, VdomDict
30+
from .types import Key, VdomDict
3131
from .vdom import vdom
3232

3333

@@ -561,15 +561,19 @@ class LifeCycleHook:
561561
562562
.. testcode::
563563
564-
from idom.core.hooks import LifeCycleHook, DID_RENDER_EFFECT
564+
from idom.core.hooks import (
565+
current_hook,
566+
LifeCycleHook,
567+
COMPONENT_DID_RENDER_EFFECT,
568+
)
565569
566570
567571
# this function will come from a layout implementation
568572
schedule_render = lambda: ...
569573
570574
# --- start life cycle ---
571575
572-
hook = hooks.LifeCycle(schedule_render)
576+
hook = LifeCycleHook(schedule_render)
573577
574578
# --- start render cycle ---
575579
@@ -582,11 +586,11 @@ class LifeCycleHook:
582586
...
583587
584588
# the component may access the current hook
585-
assert hooks.current_hook() is hook
589+
assert current_hook() is hook
586590
587591
# and save state or add effects
588592
current_hook().use_state(lambda: ...)
589-
current_hook().use_effect(DID_RENDER_EFFECT, lambda: ...)
593+
current_hook().add_effect(COMPONENT_DID_RENDER_EFFECT, lambda: ...)
590594
finally:
591595
hook.unset_current()
592596

0 commit comments

Comments
 (0)