Skip to content

Commit 53bde0f

Browse files
Remove typing_extensions dependency (#133)
1 parent 0fb333d commit 53bde0f

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ license = "MIT"
1212
license-files = ["LICENSE"]
1313
authors = [{ name = "Restate Developers", email = "dev@restate.dev" }]
1414
readme = "README.md"
15-
dependencies = ["typing-extensions>=4.14.0"]
15+
dependencies = []
1616

1717
[project.urls]
1818
Homepage = "https://restate.dev"

python/restate/context.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import typing
2222
from datetime import timedelta
2323

24-
import typing_extensions
2524
from restate.serde import DefaultSerde, Serde
2625

2726
T = TypeVar('T')
@@ -246,7 +245,6 @@ def time(self) -> RestateDurableFuture[float]:
246245
"""
247246

248247
@overload
249-
@typing_extensions.deprecated("`run` is deprecated, use `run_typed` instead for better type safety")
250248
@abc.abstractmethod
251249
def run(self,
252250
name: str,
@@ -260,6 +258,8 @@ def run(self,
260258
"""
261259
Runs the given action with the given name.
262260
261+
DEPRECATED: Use ctx.run_typed instead.
262+
263263
Args:
264264
name: The name of the action.
265265
action: The action to run.
@@ -276,7 +276,6 @@ def run(self,
276276
"""
277277

278278
@overload
279-
@typing_extensions.deprecated("`run` is deprecated, use `run_typed` instead for better type safety")
280279
@abc.abstractmethod
281280
def run(self,
282281
name: str,
@@ -290,6 +289,8 @@ def run(self,
290289
"""
291290
Runs the given coroutine action with the given name.
292291
292+
DEPRECATED: Use ctx.run_typed instead.
293+
293294
Args:
294295
name: The name of the action.
295296
action: The action to run.
@@ -305,7 +306,6 @@ def run(self,
305306
306307
"""
307308

308-
@typing_extensions.deprecated("`run` is deprecated, use `run_typed` instead for better type safety")
309309
@abc.abstractmethod
310310
def run(self,
311311
name: str,
@@ -319,6 +319,8 @@ def run(self,
319319
"""
320320
Runs the given action with the given name.
321321
322+
DEPRECATED: Use ctx.run_typed instead.
323+
322324
Args:
323325
name: The name of the action.
324326
action: The action to run.

python/restate/server_context.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from restate.server_types import ReceiveChannel, Send
3636
from restate.vm import Failure, Invocation, NotReady, VMWrapper, RunRetryConfig, Suspended # pylint: disable=line-too-long
3737
from restate.vm import DoProgressAnyCompleted, DoProgressCancelSignalReceived, DoProgressReadFromInput, DoProgressExecuteRun, DoWaitPendingRun
38-
import typing_extensions
3938

4039

4140
T = TypeVar('T')
@@ -576,7 +575,6 @@ async def create_run_coroutine(self,
576575
self.vm.propose_run_completion_transient(handle, failure=failure, attempt_duration_ms=1, config=config)
577576
# pylint: disable=W0236
578577
# pylint: disable=R0914
579-
@typing_extensions.deprecated("`run` is deprecated, use `run_typed` instead for better type safety")
580578
def run(self,
581579
name: str,
582580
action: RunAction[T],

python/restate/server_types.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,13 @@
1717
import asyncio
1818
from typing import (Awaitable, Callable, Dict, Iterable, List,
1919
Tuple, Union, TypedDict, Literal, Optional, Any)
20-
import sys
21-
if sys.version_info >= (3, 11):
22-
from typing import NotRequired
23-
else:
24-
from typing_extensions import NotRequired
2520

2621
class ASGIVersions(TypedDict):
2722
"""ASGI Versions"""
2823
spec_version: str
2924
version: Union[Literal["2.0"], Literal["3.0"]]
3025

31-
class Scope(TypedDict):
26+
class Scope(TypedDict, total=False):
3227
"""ASGI Scope"""
3328
type: Literal["http"]
3429
asgi: ASGIVersions
@@ -42,7 +37,6 @@ class Scope(TypedDict):
4237
headers: Iterable[Tuple[bytes, bytes]]
4338
client: Optional[Tuple[str, int]]
4439
server: Optional[Tuple[str, Optional[int]]]
45-
state: NotRequired[Dict[str, Any]]
4640
extensions: Optional[Dict[str, Dict[object, object]]]
4741

4842
class RestateEvent(TypedDict):

0 commit comments

Comments
 (0)