Skip to content

Commit 51b5730

Browse files
committed
rename IDOM_WED_MODULES_DIR to IDOM_WEB_MODULES_DIR
1 parent 64b567d commit 51b5730

File tree

8 files changed

+31
-14
lines changed

8 files changed

+31
-14
lines changed

src/idom/config.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,28 @@
4343
# Because these web modules will be linked dynamically at runtime this can be temporary
4444
_DEFAULT_WEB_MODULES_DIR = TemporaryDirectory()
4545

46-
IDOM_WED_MODULES_DIR = _Option(
46+
47+
class _DeprecatedOption(_Option):
48+
@property
49+
def current(self):
50+
from warnings import warn
51+
52+
warn("IDOM_WEB_MODULES_DIR has been renamed to IDOM_WEB_MODULES_DIR")
53+
return super().current
54+
55+
56+
IDOM_WED_MODULES_DIR = _DeprecatedOption(
4757
"IDOM_WED_MODULES_DIR",
4858
default=Path(_DEFAULT_WEB_MODULES_DIR.name),
4959
validator=Path,
5060
)
61+
"""This has been renamed to :data:`IDOM_WEB_MODULES_DIR`"""
62+
63+
IDOM_WEB_MODULES_DIR = _Option(
64+
"IDOM_WEB_MODULES_DIR",
65+
default=Path(_DEFAULT_WEB_MODULES_DIR.name),
66+
validator=Path,
67+
)
5168
"""The location IDOM will use to store its client application
5269
5370
This directory **MUST** be treated as a black box. Downstream applications **MUST NOT**

src/idom/server/flask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from typing_extensions import TypedDict
2020

2121
import idom
22-
from idom.config import IDOM_DEBUG_MODE, IDOM_WED_MODULES_DIR
22+
from idom.config import IDOM_DEBUG_MODE, IDOM_WEB_MODULES_DIR
2323
from idom.core.dispatcher import dispatch_single_view
2424
from idom.core.layout import LayoutEvent, LayoutUpdate
2525
from idom.core.proto import ComponentConstructor, ComponentType
@@ -152,7 +152,7 @@ def send_client_dir(path: str) -> Any:
152152

153153
@blueprint.route("/modules/<path:path>")
154154
def send_modules_dir(path: str) -> Any:
155-
return send_from_directory(str(IDOM_WED_MODULES_DIR.current), path)
155+
return send_from_directory(str(IDOM_WEB_MODULES_DIR.current), path)
156156

157157
if config["redirect_root_to_index"]:
158158

src/idom/server/sanic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from sanic_cors import CORS
1414
from websockets import WebSocketCommonProtocol
1515

16-
from idom.config import IDOM_WED_MODULES_DIR
16+
from idom.config import IDOM_WEB_MODULES_DIR
1717
from idom.core.dispatcher import (
1818
RecvCoroutine,
1919
SendCoroutine,
@@ -186,7 +186,7 @@ def _setup_common_routes(blueprint: Blueprint, config: Config) -> None:
186186

187187
if config["serve_static_files"]:
188188
blueprint.static("/client", str(CLIENT_BUILD_DIR))
189-
blueprint.static("/modules", str(IDOM_WED_MODULES_DIR.current))
189+
blueprint.static("/modules", str(IDOM_WEB_MODULES_DIR.current))
190190

191191
if config["redirect_root_to_index"]:
192192

src/idom/server/starlette.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from uvicorn.supervisors.multiprocess import Multiprocess
2121
from uvicorn.supervisors.statreload import StatReload as ChangeReload
2222

23-
from idom.config import IDOM_DEBUG_MODE, IDOM_WED_MODULES_DIR
23+
from idom.config import IDOM_DEBUG_MODE, IDOM_WEB_MODULES_DIR
2424
from idom.core.dispatcher import (
2525
RecvCoroutine,
2626
SendCoroutine,
@@ -211,7 +211,7 @@ def _setup_common_routes(config: Config, app: Starlette) -> None:
211211
app.mount(
212212
f"{url_prefix}/modules",
213213
StaticFiles(
214-
directory=str(IDOM_WED_MODULES_DIR.current),
214+
directory=str(IDOM_WEB_MODULES_DIR.current),
215215
html=True,
216216
check_dir=False,
217217
),

src/idom/server/tornado.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from tornado.websocket import WebSocketHandler
1414
from typing_extensions import TypedDict
1515

16-
from idom.config import IDOM_WED_MODULES_DIR
16+
from idom.config import IDOM_WEB_MODULES_DIR
1717
from idom.core.dispatcher import VdomJsonPatch, dispatch_single_view
1818
from idom.core.layout import Layout, LayoutEvent
1919
from idom.core.proto import ComponentConstructor
@@ -133,7 +133,7 @@ def _setup_common_routes(config: Config) -> _RouteHandlerSpecs:
133133
(
134134
r"/modules/(.*)",
135135
StaticFileHandler,
136-
{"path": str(IDOM_WED_MODULES_DIR.current)},
136+
{"path": str(IDOM_WEB_MODULES_DIR.current)},
137137
)
138138
)
139139
if config["redirect_root_to_index"]:

src/idom/testing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from selenium.webdriver import Chrome
2929
from selenium.webdriver.remote.webdriver import WebDriver
3030

31-
from idom.config import IDOM_WED_MODULES_DIR
31+
from idom.config import IDOM_WEB_MODULES_DIR
3232
from idom.core.events import EventHandler, to_event_handler_function
3333
from idom.core.hooks import LifeCycleHook, current_hook
3434
from idom.server.prefab import hotswap_server
@@ -433,5 +433,5 @@ def use(
433433

434434

435435
def clear_idom_web_modules_dir() -> None:
436-
for path in IDOM_WED_MODULES_DIR.current.iterdir():
436+
for path in IDOM_WEB_MODULES_DIR.current.iterdir():
437437
shutil.rmtree(path) if path.is_dir() else path.unlink()

src/idom/web/module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from typing_extensions import Protocol
1414

15-
from idom.config import IDOM_DEBUG_MODE, IDOM_WED_MODULES_DIR
15+
from idom.config import IDOM_DEBUG_MODE, IDOM_WEB_MODULES_DIR
1616
from idom.core.proto import (
1717
EventHandlerMapping,
1818
ImportSourceDict,
@@ -391,6 +391,6 @@ def _make_export(
391391

392392

393393
def _web_module_path(name: str) -> Path:
394-
directory = IDOM_WED_MODULES_DIR.current
394+
directory = IDOM_WEB_MODULES_DIR.current
395395
path = directory.joinpath(*name.split("/"))
396396
return path.with_suffix(path.suffix)

tests/test_html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def HasScript():
117117
display(HasScript)
118118

119119
for i in range(1, 4):
120-
script_file = config.IDOM_WED_MODULES_DIR.current / file_name_template.format(
120+
script_file = config.IDOM_WEB_MODULES_DIR.current / file_name_template.format(
121121
src_id=i
122122
)
123123
script_file.write_text(

0 commit comments

Comments
 (0)