Skip to content

Commit 7bdcdfe

Browse files
authored
remove deprecated code (#887)
* remove deprecated code * minor changelog fixes * test setter * fix types
1 parent 6dfa5b5 commit 7bdcdfe

File tree

7 files changed

+32
-64
lines changed

7 files changed

+32
-64
lines changed

Diff for: docs/source/about/changelog.rst

+12
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Unreleased
2828
- :pull:`876` - ``idom.widgets.hotswap``. The function has no clear uses outside of some
2929
internal applications. For this reason it has been deprecated.
3030

31+
**Removed**
32+
33+
- :pull:`886` - Ability to access element value from events via `event['value']` key.
34+
Instead element value should be accessed via `event['target']['value']`. Originally
35+
deprecated in :ref:`v0.34.0`.
36+
- :pull:`886` - old misspelled option ``idom.config.IDOM_WED_MODULES_DIR``. Originally
37+
deprecated in :ref:`v0.36.1`.
38+
3139

3240
v0.43.0
3341
-------
@@ -65,10 +73,14 @@ v0.42.0
6573
- :pull:`832` - Fix ``html_to_vdom`` improperly removing ``<html>``, ``<head>``, and ``<body>`` nodes.
6674

6775
**Removed**
76+
6877
- :pull:`832` - Removed ``idom.html.body`` as it is currently unusable due to technological limitations, and thus not needed.
6978
- :pull:`840` - remove ``IDOM_FEATURE_INDEX_AS_DEFAULT_KEY`` option
7079
- :pull:`835` - ``serve_static_files`` option from backend configuration
7180

81+
**Deprecated**
82+
83+
- :commit:`8f3785b` - Deprecated ``module_from_template``
7284

7385
v0.41.0
7486
-------

Diff for: noxfile.py

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def test_python_types(session: Session) -> None:
204204
install_requirements_file(session, "check-types")
205205
install_requirements_file(session, "pkg-deps")
206206
install_requirements_file(session, "pkg-extras")
207+
session.run("mypy", "--version")
207208
session.run("mypy", "--show-error-codes", "--strict", "src/idom")
208209

209210

Diff for: src/idom/_option.py

+7-16
Original file line numberDiff line numberDiff line change
@@ -120,27 +120,18 @@ def __repr__(self) -> str:
120120

121121

122122
class DeprecatedOption(Option[_O]): # pragma: no cover
123-
def __init__(self, new_opt: Option[_O], name: str) -> None:
124-
# copy over attrs
125-
attrs = new_opt.__dict__.copy()
126-
attrs.pop("_current", None)
127-
self.__dict__.update(new_opt.__dict__)
128-
# then set the ones needed here
129-
self._name = name
130-
self._new_opt = new_opt
123+
def __init__(self, message: str, *args: Any, **kwargs: Any) -> None:
124+
self._deprecation_message = message
125+
super().__init__(*args, **kwargs)
131126

132-
@property # type: ignore
133-
def _current(self) -> _O:
127+
@Option.current.getter # type: ignore
128+
def current(self) -> _O:
134129
warn(
135-
f"{self.name!r} has been renamed to {self._new_opt.name!r}",
130+
self._deprecation_message,
136131
DeprecationWarning,
137132
stacklevel=_frame_depth_in_module() + 1,
138133
)
139-
return self._new_opt.current
140-
141-
@_current.setter
142-
def _current(self, new: _O) -> None:
143-
self._new_opt.current = new
134+
return super().current
144135

145136

146137
def _frame_depth_in_module() -> int:

Diff for: src/idom/config.py

-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pathlib import Path
77
from tempfile import TemporaryDirectory
88

9-
from ._option import DeprecatedOption as _DeprecatedOption
109
from ._option import Option as _Option
1110

1211

@@ -54,12 +53,6 @@
5453
set of publically available APIs for working with the client.
5554
"""
5655

57-
IDOM_WED_MODULES_DIR: _Option[Path] = _DeprecatedOption(
58-
new_opt=IDOM_WEB_MODULES_DIR,
59-
name="IDOM_WED_MODULES_DIR",
60-
)
61-
"""This has been renamed to :data:`IDOM_WEB_MODULES_DIR`"""
62-
6356
IDOM_TESTING_DEFAULT_TIMEOUT = _Option(
6457
"IDOM_TESTING_DEFAULT_TIMEOUT",
6558
5.0,

Diff for: src/idom/core/_event_proxy.py

-38
This file was deleted.

Diff for: src/idom/core/layout.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from idom.config import IDOM_CHECK_VDOM_SPEC, IDOM_DEBUG_MODE
2727
from idom.utils import Ref
2828

29-
from ._event_proxy import _wrap_in_warning_event_proxies
3029
from .hooks import LifeCycleHook
3130
from .types import (
3231
ComponentType,
@@ -99,7 +98,7 @@ async def deliver(self, event: LayoutEventMessage) -> None:
9998

10099
if handler is not None:
101100
try:
102-
await handler.function(_wrap_in_warning_event_proxies(event["data"]))
101+
await handler.function(event["data"])
103102
except Exception:
104103
logger.exception(f"Failed to execute event handler {handler}")
105104
else:

Diff for: tests/test__option.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from idom._option import Option
6+
from idom._option import DeprecatedOption, Option
77

88

99
def test_option_repr():
@@ -99,3 +99,13 @@ def test_option_subscribe():
9999

100100
opt.unset()
101101
assert calls == ["default", "new-1", "new-2", "default"]
102+
103+
104+
def test_deprecated_option():
105+
opt = DeprecatedOption("is deprecated!", "A_FAKE_OPTION", None)
106+
107+
with pytest.warns(DeprecationWarning, match="is deprecated!"):
108+
opt.current
109+
110+
with pytest.warns(DeprecationWarning, match="is deprecated!"):
111+
opt.current = "something"

0 commit comments

Comments
 (0)