Skip to content

Commit c62cf00

Browse files
committed
s/temporalio.bridge.temporal_sdk_bridge/rg-replace temporal_sdk_bridge/
1 parent 14ff378 commit c62cf00

File tree

7 files changed

+27
-44
lines changed

7 files changed

+27
-44
lines changed

temporalio/bridge/Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name = "temporal-sdk-bridge"
33
version = "0.1.0"
44
edition = "2021"
55

6-
[package.metadata.maturin]
7-
module-name = "temporalio.bridge.temporal_sdk_bridge"
8-
9-
106
[lib]
117
name = "temporal_sdk_bridge"
128
crate-type = ["cdylib"]

temporalio/bridge/client.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from typing import Mapping, Optional, Tuple, Type, TypeVar
1111

1212
import google.protobuf.message
13+
import temporal_sdk_bridge
14+
from temporal_sdk_bridge import RPCError
1315

1416
import temporalio.bridge.runtime
15-
import temporalio.bridge.temporal_sdk_bridge
16-
from temporalio.bridge.temporal_sdk_bridge import RPCError
1717

1818

1919
@dataclass
@@ -94,15 +94,13 @@ async def connect(
9494
"""Establish connection with server."""
9595
return Client(
9696
runtime,
97-
await temporalio.bridge.temporal_sdk_bridge.connect_client(
98-
runtime._ref, config
99-
),
97+
await temporal_sdk_bridge.connect_client(runtime._ref, config),
10098
)
10199

102100
def __init__(
103101
self,
104102
runtime: temporalio.bridge.runtime.Runtime,
105-
ref: temporalio.bridge.temporal_sdk_bridge.ClientRef,
103+
ref: temporal_sdk_bridge.ClientRef,
106104
):
107105
"""Initialize client with underlying SDK Core reference."""
108106
self._runtime = runtime

temporalio/bridge/metric.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
from typing import Mapping, Optional, Union
99

10+
import temporal_sdk_bridge
11+
1012
import temporalio.bridge.runtime
11-
import temporalio.bridge.temporal_sdk_bridge
1213

1314

1415
class MetricMeter:
@@ -17,14 +18,12 @@ class MetricMeter:
1718
@staticmethod
1819
def create(runtime: temporalio.bridge.runtime.Runtime) -> Optional[MetricMeter]:
1920
"""Create optional metric meter."""
20-
ref = temporalio.bridge.temporal_sdk_bridge.new_metric_meter(runtime._ref)
21+
ref = temporal_sdk_bridge.new_metric_meter(runtime._ref)
2122
if not ref:
2223
return None
2324
return MetricMeter(ref)
2425

25-
def __init__(
26-
self, ref: temporalio.bridge.temporal_sdk_bridge.MetricMeterRef
27-
) -> None:
26+
def __init__(self, ref: temporal_sdk_bridge.MetricMeterRef) -> None:
2827
"""Initialize metric meter."""
2928
self._ref = ref
3029
self._default_attributes = MetricAttributes(self, ref.default_attributes)
@@ -161,7 +160,7 @@ class MetricAttributes:
161160
def __init__(
162161
self,
163162
meter: MetricMeter,
164-
ref: temporalio.bridge.temporal_sdk_bridge.MetricAttributesRef,
163+
ref: temporal_sdk_bridge.MetricAttributesRef,
165164
) -> None:
166165
"""Initialize attributes."""
167166
self._meter = meter

temporalio/bridge/runtime.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,21 @@
88
from dataclasses import dataclass
99
from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Type
1010

11+
import temporal_sdk_bridge
1112
from typing_extensions import Protocol
1213

13-
import temporalio.bridge.temporal_sdk_bridge
14-
1514

1615
class Runtime:
1716
"""Runtime for SDK Core."""
1817

1918
@staticmethod
2019
def _raise_in_thread(thread_id: int, exc_type: Type[BaseException]) -> bool:
2120
"""Internal helper for raising an exception in thread."""
22-
return temporalio.bridge.temporal_sdk_bridge.raise_in_thread(
23-
thread_id, exc_type
24-
)
21+
return temporal_sdk_bridge.raise_in_thread(thread_id, exc_type)
2522

2623
def __init__(self, *, telemetry: TelemetryConfig) -> None:
2724
"""Create SDK Core runtime."""
28-
self._ref = temporalio.bridge.temporal_sdk_bridge.init_runtime(telemetry)
25+
self._ref = temporal_sdk_bridge.init_runtime(telemetry)
2926

3027
def retrieve_buffered_metrics(self, durations_as_seconds: bool) -> Sequence[Any]:
3128
"""Get buffered metrics."""

temporalio/bridge/testing.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
from dataclasses import dataclass
99
from typing import Optional, Sequence
1010

11+
import temporal_sdk_bridge
12+
1113
import temporalio.bridge.runtime
12-
import temporalio.bridge.temporal_sdk_bridge
1314

1415

1516
@dataclass
@@ -53,9 +54,7 @@ async def start_dev_server(
5354
) -> EphemeralServer:
5455
"""Start a dev server instance."""
5556
return EphemeralServer(
56-
await temporalio.bridge.temporal_sdk_bridge.start_dev_server(
57-
runtime._ref, config
58-
)
57+
await temporal_sdk_bridge.start_dev_server(runtime._ref, config)
5958
)
6059

6160
@staticmethod
@@ -64,12 +63,10 @@ async def start_test_server(
6463
) -> EphemeralServer:
6564
"""Start a test server instance."""
6665
return EphemeralServer(
67-
await temporalio.bridge.temporal_sdk_bridge.start_test_server(
68-
runtime._ref, config
69-
)
66+
await temporal_sdk_bridge.start_test_server(runtime._ref, config)
7067
)
7168

72-
def __init__(self, ref: temporalio.bridge.temporal_sdk_bridge.EphemeralServerRef):
69+
def __init__(self, ref: temporal_sdk_bridge.EphemeralServerRef):
7370
"""Initialize an ephemeral server."""
7471
self._ref = ref
7572

temporalio/bridge/worker.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
)
2020

2121
import google.protobuf.internal.containers
22+
import temporal_sdk_bridge
23+
from temporal_sdk_bridge import (
24+
CustomSlotSupplier as BridgeCustomSlotSupplier,
25+
)
26+
from temporal_sdk_bridge import PollShutdownError
2227
from typing_extensions import TypeAlias
2328

2429
import temporalio.api.common.v1
@@ -29,13 +34,8 @@
2934
import temporalio.bridge.proto.workflow_activation
3035
import temporalio.bridge.proto.workflow_completion
3136
import temporalio.bridge.runtime
32-
import temporalio.bridge.temporal_sdk_bridge
3337
import temporalio.converter
3438
import temporalio.exceptions
35-
from temporalio.bridge.temporal_sdk_bridge import (
36-
CustomSlotSupplier as BridgeCustomSlotSupplier,
37-
)
38-
from temporalio.bridge.temporal_sdk_bridge import PollShutdownError
3939

4040

4141
@dataclass
@@ -111,26 +111,22 @@ class Worker:
111111
def create(client: temporalio.bridge.client.Client, config: WorkerConfig) -> Worker:
112112
"""Create a bridge worker from a bridge client."""
113113
return Worker(
114-
temporalio.bridge.temporal_sdk_bridge.new_worker(
115-
client._runtime._ref, client._ref, config
116-
)
114+
temporal_sdk_bridge.new_worker(client._runtime._ref, client._ref, config)
117115
)
118116

119117
@staticmethod
120118
def for_replay(
121119
runtime: temporalio.bridge.runtime.Runtime,
122120
config: WorkerConfig,
123-
) -> Tuple[Worker, temporalio.bridge.temporal_sdk_bridge.HistoryPusher]:
121+
) -> Tuple[Worker, temporal_sdk_bridge.HistoryPusher]:
124122
"""Create a bridge replay worker."""
125123
[
126124
replay_worker,
127125
pusher,
128-
] = temporalio.bridge.temporal_sdk_bridge.new_replay_worker(
129-
runtime._ref, config
130-
)
126+
] = temporal_sdk_bridge.new_replay_worker(runtime._ref, config)
131127
return Worker(replay_worker), pusher
132128

133-
def __init__(self, ref: temporalio.bridge.temporal_sdk_bridge.WorkerRef) -> None:
129+
def __init__(self, ref: temporal_sdk_bridge.WorkerRef) -> None:
134130
"""Create SDK core worker from a bridge worker."""
135131
self._ref = ref
136132

temporalio/worker/workflow_sandbox/_restrictions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def with_child_unrestricted(self, *child_path: str) -> SandboxMatcher:
459459
# Must pass through the entire bridge in even the most minimum causes
460460
# because PyO3 does not allow re-init since 0.17. See
461461
# https://github.com/PyO3/pyo3/pull/2523.
462-
"temporalio.bridge.temporal_sdk_bridge",
462+
"temporal_sdk_bridge",
463463
}
464464

465465
SandboxRestrictions.passthrough_modules_with_temporal = (

0 commit comments

Comments
 (0)