ephaptic 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ephaptic-0.2.0 → ephaptic-0.2.1}/PKG-INFO +4 -1
- {ephaptic-0.2.0 → ephaptic-0.2.1}/README.md +3 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/__init__.py +3 -1
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/ephaptic.py +14 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic.egg-info/PKG-INFO +4 -1
- {ephaptic-0.2.0 → ephaptic-0.2.1}/pyproject.toml +1 -1
- {ephaptic-0.2.0 → ephaptic-0.2.1}/LICENSE +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/adapters/__init__.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/adapters/fastapi_.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/adapters/quart_.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/cli/__init__.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/cli/__main__.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/client/__init__.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/client/client.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/localproxy.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/transports/__init__.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/transports/fastapi_ws.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic/transports/websocket.py +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic.egg-info/SOURCES.txt +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic.egg-info/dependency_links.txt +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic.egg-info/entry_points.txt +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic.egg-info/requires.txt +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/ephaptic.egg-info/top_level.txt +0 -0
- {ephaptic-0.2.0 → ephaptic-0.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ephaptic
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: The Python client/server package for ephaptic.
|
|
5
5
|
Author-email: uukelele <robustrobot11@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -132,6 +132,9 @@ async def add(num1: int, num2: int) -> int:
|
|
|
132
132
|
return num1 + num2
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
+
> [!TIP]
|
|
136
|
+
> If you're experiencing circular imports, feel free to instead import and use the `expose` function from the library instead of the instance. Please note that if you do this, you must define all exposed functions *before* creating the ephaptic instance - this is mainly for people importing RPC functions from another file. The same thing can be done with the global `identity_loader` decorator.
|
|
137
|
+
|
|
135
138
|
Yep, it's really that simple.
|
|
136
139
|
|
|
137
140
|
But what if your code throws an error? No sweat, it just throws up on the frontend, with the error name.
|
|
@@ -90,6 +90,9 @@ async def add(num1: int, num2: int) -> int:
|
|
|
90
90
|
return num1 + num2
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
> [!TIP]
|
|
94
|
+
> If you're experiencing circular imports, feel free to instead import and use the `expose` function from the library instead of the instance. Please note that if you do this, you must define all exposed functions *before* creating the ephaptic instance - this is mainly for people importing RPC functions from another file. The same thing can be done with the global `identity_loader` decorator.
|
|
95
|
+
|
|
93
96
|
Yep, it's really that simple.
|
|
94
97
|
|
|
95
98
|
But what if your code throws an error? No sweat, it just throws up on the frontend, with the error name.
|
|
@@ -67,6 +67,9 @@ class ConnectionManager:
|
|
|
67
67
|
|
|
68
68
|
manager = ConnectionManager()
|
|
69
69
|
|
|
70
|
+
_EXPOSED_FUNCTIONS = {}
|
|
71
|
+
_IDENTITY_LOADER: Optional[Callable] = None
|
|
72
|
+
|
|
70
73
|
class EphapticTarget:
|
|
71
74
|
def __init__(self, user_ids: list[str]):
|
|
72
75
|
self.user_ids = user_ids
|
|
@@ -76,6 +79,14 @@ class EphapticTarget:
|
|
|
76
79
|
await manager.broadcast(self.user_ids, name, list(args), dict(kwargs))
|
|
77
80
|
return emitter
|
|
78
81
|
|
|
82
|
+
def expose(func: Callable):
|
|
83
|
+
_EXPOSED_FUNCTIONS[func.__name__] = func
|
|
84
|
+
return func
|
|
85
|
+
|
|
86
|
+
def identity_loader(func: Callable):
|
|
87
|
+
_IDENTITY_LOADER = func
|
|
88
|
+
return func
|
|
89
|
+
|
|
79
90
|
class Ephaptic:
|
|
80
91
|
_exposed_functions: Dict[str, Callable] = {}
|
|
81
92
|
_identity_loader: Optional[Callable] = None
|
|
@@ -111,6 +122,9 @@ class Ephaptic:
|
|
|
111
122
|
case _:
|
|
112
123
|
raise TypeError(f"Unsupported app type: {module}")
|
|
113
124
|
|
|
125
|
+
cls._exposed_functions = _EXPOSED_FUNCTIONS.copy()
|
|
126
|
+
cls._identity_loader = _IDENTITY_LOADER
|
|
127
|
+
|
|
114
128
|
return instance
|
|
115
129
|
|
|
116
130
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ephaptic
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: The Python client/server package for ephaptic.
|
|
5
5
|
Author-email: uukelele <robustrobot11@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -132,6 +132,9 @@ async def add(num1: int, num2: int) -> int:
|
|
|
132
132
|
return num1 + num2
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
+
> [!TIP]
|
|
136
|
+
> If you're experiencing circular imports, feel free to instead import and use the `expose` function from the library instead of the instance. Please note that if you do this, you must define all exposed functions *before* creating the ephaptic instance - this is mainly for people importing RPC functions from another file. The same thing can be done with the global `identity_loader` decorator.
|
|
137
|
+
|
|
135
138
|
Yep, it's really that simple.
|
|
136
139
|
|
|
137
140
|
But what if your code throws an error? No sweat, it just throws up on the frontend, with the error name.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|