speedtest-ssh 2.8.1__tar.gz → 2.10.0__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.
- {speedtest_ssh-2.8.1/speedtest_ssh.egg-info → speedtest_ssh-2.10.0}/PKG-INFO +2 -1
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/pyproject.toml +1 -0
- speedtest_ssh-2.10.0/speedtest_ssh/_version.py +1 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/speedtest_ssh.py +38 -38
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0/speedtest_ssh.egg-info}/PKG-INFO +2 -1
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh.egg-info/requires.txt +1 -0
- speedtest_ssh-2.8.1/speedtest_ssh/_version.py +0 -1
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/LICENSE +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/README.md +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/setup.cfg +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/__init__.py +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/config.py +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/data_transfer.py +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/ping.py +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/py.typed +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/sftp_wrapper.py +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh/util.py +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh.egg-info/SOURCES.txt +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh.egg-info/dependency_links.txt +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh.egg-info/entry_points.txt +0 -0
- {speedtest_ssh-2.8.1 → speedtest_ssh-2.10.0}/speedtest_ssh.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: speedtest_ssh
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.0
|
|
4
4
|
Summary: A tool meant to check inter-device speeds via ssh
|
|
5
5
|
License: GPL
|
|
6
6
|
Project-URL: Homepage, https://github.com/zwimer/speedtest_ssh
|
|
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
9
9
|
Requires-Python: >=3.12
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
+
Requires-Dist: argcomplete
|
|
12
13
|
Requires-Dist: paramiko
|
|
13
14
|
Requires-Dist: tqdm
|
|
14
15
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__: str = "2.10.0"
|
|
@@ -5,9 +5,10 @@ from pathlib import Path
|
|
|
5
5
|
import argparse
|
|
6
6
|
import math
|
|
7
7
|
import time
|
|
8
|
-
import sys
|
|
9
8
|
import os
|
|
10
9
|
|
|
10
|
+
import argcomplete
|
|
11
|
+
|
|
11
12
|
from .config import Config
|
|
12
13
|
from .data_transfer import DataTransfer, SFTP, Rsync
|
|
13
14
|
from .ping import ping as ping_test
|
|
@@ -16,6 +17,7 @@ from ._version import __version__
|
|
|
16
17
|
|
|
17
18
|
base_size = 2 * (1024**2)
|
|
18
19
|
_password_env_name = "SPEEDTEST_SSH_PASSWORD" # nosec B105
|
|
20
|
+
_LOG_VERBOSITY: dict[int, int] = {0: WARNING, 1: INFO, 2: DEBUG}
|
|
19
21
|
_LOG = "speedtest_ssh"
|
|
20
22
|
|
|
21
23
|
|
|
@@ -63,7 +65,7 @@ def _print_results(ping_delay: float | None, up_ns: int, down_ns: int, size: int
|
|
|
63
65
|
print(f"{prefix}Upload Speed: {fmt(up_ns)}\nDownload Speed: {fmt(down_ns)}")
|
|
64
66
|
|
|
65
67
|
|
|
66
|
-
def speedtest_ssh(
|
|
68
|
+
def speedtest_ssh(seconds: int, ping: bool, mode: str, conf: Config) -> None:
|
|
67
69
|
"""
|
|
68
70
|
Run speedtest_ssh
|
|
69
71
|
"""
|
|
@@ -78,7 +80,7 @@ def speedtest_ssh(num_seconds: int, ping: bool, mode: str, conf: Config) -> None
|
|
|
78
80
|
print("Testing...")
|
|
79
81
|
nano_sec: int = 0
|
|
80
82
|
size: int = base_size
|
|
81
|
-
remaining: int = int(1e9) *
|
|
83
|
+
remaining: int = int(1e9) * seconds
|
|
82
84
|
while int(1.5 * nano_sec) < remaining - 1: # Try to get close to seconds
|
|
83
85
|
size *= 2 ** (0 if not nano_sec else max(1, int(math.log(remaining / nano_sec, 2))))
|
|
84
86
|
# ^ Faster than just *=2
|
|
@@ -89,51 +91,49 @@ def speedtest_ssh(num_seconds: int, ping: bool, mode: str, conf: Config) -> None
|
|
|
89
91
|
_print_results(ping_delay, up_t, down_t, size)
|
|
90
92
|
|
|
91
93
|
|
|
92
|
-
def
|
|
94
|
+
def cli() -> None:
|
|
93
95
|
"""
|
|
94
|
-
speedtest_ssh
|
|
96
|
+
speedtest_ssh main
|
|
95
97
|
"""
|
|
96
|
-
|
|
97
|
-
parser =
|
|
98
|
-
parser.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
parser = argparse.ArgumentParser()
|
|
99
|
+
parser.add_argument("-V", "--version", action="version", version=f"{parser.prog} {__version__}")
|
|
100
|
+
remote = parser.add_argument_group("SSH Options")
|
|
101
|
+
remote.add_argument("host", help="The host to speedtest the conection to")
|
|
102
|
+
remote.add_argument("-u", "--user", help="The user used for ssh")
|
|
103
|
+
remote.add_argument("-p", "--port", type=int, help="The port used for ssh")
|
|
104
|
+
remote.add_argument(
|
|
105
|
+
"-E",
|
|
106
|
+
"--password-env",
|
|
107
|
+
action="store_true",
|
|
108
|
+
help=f"Read password from {_password_env_name} environment variable",
|
|
106
109
|
)
|
|
107
|
-
parser.add_argument("-p", "--port", type=int, help="The port used for ssh")
|
|
108
110
|
parser.add_argument(
|
|
109
|
-
"
|
|
111
|
+
"-v",
|
|
112
|
+
"--verbose",
|
|
113
|
+
action="count",
|
|
114
|
+
default=0,
|
|
115
|
+
help="Increase Log verbosity, pass more than once to increase verbosity",
|
|
110
116
|
)
|
|
111
|
-
parser.
|
|
117
|
+
modes = parser.add_argument_group("SpeedTest Options")
|
|
118
|
+
modes.add_argument("-P", "--ping", action="store_true", help="Ping test the host as well")
|
|
119
|
+
modes.add_argument(
|
|
120
|
+
"-s", "--seconds", type=int, default=20, help="An approximate number of seconds the speed tests should take"
|
|
121
|
+
)
|
|
122
|
+
modes.add_argument(
|
|
112
123
|
"-m", "--mode", choices=["rsync", "sftp"], default="sftp", help="The speedtest method. Defaults to rsync"
|
|
113
124
|
)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
argcomplete.autocomplete(parser) # Tab completion
|
|
126
|
+
ns = vars(parser.parse_args())
|
|
127
|
+
# Configure logging
|
|
128
|
+
lvl = ns.pop("verbose")
|
|
129
|
+
lvl = _LOG_VERBOSITY[max(i for i in _LOG_VERBOSITY if i <= lvl)]
|
|
130
|
+
basicConfig(level=lvl, format="%(levelname)-8s %(message)s")
|
|
131
|
+
getLogger("main").debug("Log level set to %d", lvl)
|
|
132
|
+
# Call speedtest
|
|
122
133
|
ns["password"] = None
|
|
123
134
|
if ns.pop("password_env"):
|
|
124
135
|
ns["password"] = os.environ.get(_password_env_name, None)
|
|
125
136
|
if ns["password"] is None:
|
|
126
137
|
raise RuntimeError(f"{_password_env_name} is not set")
|
|
127
138
|
conf = Config(**{i.name: ns.pop(i.name) for i in fields(Config)}) # type: ignore
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def cli() -> None:
|
|
132
|
-
"""
|
|
133
|
-
speedtest_ssh CLI
|
|
134
|
-
"""
|
|
135
|
-
main(sys.argv)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if __name__ == "__main__":
|
|
139
|
-
cli()
|
|
139
|
+
speedtest_ssh(**ns, conf=conf) # type: ignore
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: speedtest_ssh
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.0
|
|
4
4
|
Summary: A tool meant to check inter-device speeds via ssh
|
|
5
5
|
License: GPL
|
|
6
6
|
Project-URL: Homepage, https://github.com/zwimer/speedtest_ssh
|
|
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
9
9
|
Requires-Python: >=3.12
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
+
Requires-Dist: argcomplete
|
|
12
13
|
Requires-Dist: paramiko
|
|
13
14
|
Requires-Dist: tqdm
|
|
14
15
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__: str = "2.8.1"
|
|
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
|