portforward 0.6.2__cp311-cp311-macosx_11_0_arm64.whl → 0.7.1__cp311-cp311-macosx_11_0_arm64.whl
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.
Potentially problematic release.
This version of portforward might be problematic. Click here for more details.
- portforward/__init__.py +10 -10
- portforward/_portforward.cpython-311-darwin.so +0 -0
- {portforward-0.6.2.dist-info → portforward-0.7.1.dist-info}/METADATA +2 -2
- portforward-0.7.1.dist-info/RECORD +9 -0
- portforward-0.6.2.dist-info/RECORD +0 -9
- {portforward-0.6.2.dist-info → portforward-0.7.1.dist-info}/WHEEL +0 -0
- {portforward-0.6.2.dist-info → portforward-0.7.1.dist-info}/license_files/AUTHORS.rst +0 -0
- {portforward-0.6.2.dist-info → portforward-0.7.1.dist-info}/license_files/LICENSE +0 -0
portforward/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Easy Kubernetes Port-Forward For Python
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
__version__ = "0.
|
|
5
|
+
__version__ = "0.7.1"
|
|
6
6
|
|
|
7
7
|
import asyncio
|
|
8
8
|
import contextlib
|
|
@@ -57,7 +57,7 @@ def forward(
|
|
|
57
57
|
|
|
58
58
|
:param namespace: Target namespace
|
|
59
59
|
:param pod_or_service: Name of target Pod or service
|
|
60
|
-
:param from_port: Local port
|
|
60
|
+
:param from_port: Local port, or 0 to use any free port
|
|
61
61
|
:param to_port: Port inside the pod
|
|
62
62
|
:param config_path: Path for loading kube config
|
|
63
63
|
:param waiting: Delay in seconds
|
|
@@ -129,6 +129,11 @@ class PortForwarder:
|
|
|
129
129
|
def is_stopped(self):
|
|
130
130
|
return self._async_forwarder.is_stopped
|
|
131
131
|
|
|
132
|
+
@property
|
|
133
|
+
def from_port(self):
|
|
134
|
+
"""The local port that was actually used for the portforward."""
|
|
135
|
+
return self._async_forwarder.from_port
|
|
136
|
+
|
|
132
137
|
|
|
133
138
|
class AsyncPortForwarder:
|
|
134
139
|
"""Use the same args as the `portforward.forward` method."""
|
|
@@ -158,11 +163,12 @@ class AsyncPortForwarder:
|
|
|
158
163
|
bind_ip = _validate_ip_address(bind_ip)
|
|
159
164
|
|
|
160
165
|
self.actual_pod_name: str = ""
|
|
166
|
+
self.from_port: int = 0
|
|
161
167
|
self._is_stopped: bool = False
|
|
162
168
|
self.bind_address: str = f"{bind_ip}:{from_port}"
|
|
163
169
|
|
|
164
170
|
async def forward(self):
|
|
165
|
-
self.actual_pod_name = await _portforward.forward(
|
|
171
|
+
(self.actual_pod_name, self.from_port) = await _portforward.forward(
|
|
166
172
|
self.namespace,
|
|
167
173
|
self.pod_or_service,
|
|
168
174
|
self.bind_address,
|
|
@@ -193,14 +199,11 @@ def _validate_str(arg_name, arg) -> str:
|
|
|
193
199
|
if len(arg) == 0:
|
|
194
200
|
raise ValueError(f"{arg_name} cannot be an empty str")
|
|
195
201
|
|
|
196
|
-
if "/" in arg:
|
|
197
|
-
raise ValueError(f"{arg_name} contains illegal character '/'")
|
|
198
|
-
|
|
199
202
|
return arg
|
|
200
203
|
|
|
201
204
|
|
|
202
205
|
def _validate_port(arg_name, arg) -> int:
|
|
203
|
-
in_range = arg and 0
|
|
206
|
+
in_range = arg is not None and 0 <= arg < 65536
|
|
204
207
|
if arg is None or not isinstance(arg, int) or not in_range:
|
|
205
208
|
raise ValueError(f"{arg_name}={arg} is not a valid port")
|
|
206
209
|
|
|
@@ -247,7 +250,4 @@ def _kube_context(context):
|
|
|
247
250
|
if not isinstance(context, str):
|
|
248
251
|
raise ValueError(f"kube_context={context} is not a valid str")
|
|
249
252
|
|
|
250
|
-
if "/" in context:
|
|
251
|
-
raise ValueError("kube_context contains illegal character '/'")
|
|
252
|
-
|
|
253
253
|
return context
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: portforward
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -64,11 +64,11 @@ Wheels are available for:
|
|
|
64
64
|
|
|
65
65
|
with Python versions:
|
|
66
66
|
|
|
67
|
-
* 3.8
|
|
68
67
|
* 3.9
|
|
69
68
|
* 3.10
|
|
70
69
|
* 3.11
|
|
71
70
|
* 3.12
|
|
71
|
+
* 3.13
|
|
72
72
|
|
|
73
73
|
**Requirements for installation from source**
|
|
74
74
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
portforward-0.7.1.dist-info/METADATA,sha256=KZ4FcPovhDaV4zP8KIqEgbkiP2XS0bR8FazwrquzGYc,3734
|
|
2
|
+
portforward-0.7.1.dist-info/WHEEL,sha256=8hoTVLxyLdG351Jq1HozDQCHHiKu32mfNA2_wpcO9P4,106
|
|
3
|
+
portforward-0.7.1.dist-info/license_files/LICENSE,sha256=n2aq0UH0YZkyF_5hougjNi5gzXIUapEEqEUn6FwAcFE,1075
|
|
4
|
+
portforward-0.7.1.dist-info/license_files/AUTHORS.rst,sha256=YQwE3_FUEuGVHbxYUa4NQMlG28QBGwcCYEoa2MP9Xgk,163
|
|
5
|
+
portforward/__init__.py,sha256=6j9B55t1hQy_eRL9oM4TRvfvXOsc9Ifwxg92zbrjMaM,6872
|
|
6
|
+
portforward/_portforward.pyi,sha256=KZSR_2INAUDtpwbVFA9e6cLs3KBwgMw-hgtirmMRZgY,336
|
|
7
|
+
portforward/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
portforward/_portforward.cpython-311-darwin.so,sha256=JVpGUZZKKmLkKLzmZMs0eaQzYfdCHc8GGrs81HgwAaE,9517624
|
|
9
|
+
portforward-0.7.1.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
portforward-0.6.2.dist-info/METADATA,sha256=0AZ3nsSc26Xsqm1TK9fBJUoaUZ8XJDEfPt4Wtcbn1tM,3733
|
|
2
|
-
portforward-0.6.2.dist-info/WHEEL,sha256=8hoTVLxyLdG351Jq1HozDQCHHiKu32mfNA2_wpcO9P4,106
|
|
3
|
-
portforward-0.6.2.dist-info/license_files/LICENSE,sha256=n2aq0UH0YZkyF_5hougjNi5gzXIUapEEqEUn6FwAcFE,1075
|
|
4
|
-
portforward-0.6.2.dist-info/license_files/AUTHORS.rst,sha256=YQwE3_FUEuGVHbxYUa4NQMlG28QBGwcCYEoa2MP9Xgk,163
|
|
5
|
-
portforward/__init__.py,sha256=dIOPdTMLHUgZ2VeG-UQoGUIp515tikAGmSIFKQZkxXU,6809
|
|
6
|
-
portforward/_portforward.pyi,sha256=KZSR_2INAUDtpwbVFA9e6cLs3KBwgMw-hgtirmMRZgY,336
|
|
7
|
-
portforward/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
portforward/_portforward.cpython-311-darwin.so,sha256=8iXmpFbJJs8lqSM_YZYmlpS3nErJsDh-DEliugYIhVU,9663960
|
|
9
|
-
portforward-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|