multiCMD 1.66__tar.gz → 1.67__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.
Files changed (43) hide show
  1. {multicmd-1.66 → multicmd-1.67}/PKG-INFO +12 -4
  2. {multicmd-1.66 → multicmd-1.67}/README.md +9 -0
  3. {multicmd-1.66 → multicmd-1.67}/multiCMD.egg-info/PKG-INFO +12 -4
  4. {multicmd-1.66 → multicmd-1.67}/multiCMD.py +9 -11
  5. multicmd-1.67/setup.py +41 -0
  6. {multicmd-1.66 → multicmd-1.67}/tests/test_helpers.py +46 -0
  7. multicmd-1.66/setup.py +0 -31
  8. {multicmd-1.66 → multicmd-1.67}/LICENSE +0 -0
  9. {multicmd-1.66 → multicmd-1.67}/multiCMD.egg-info/SOURCES.txt +0 -0
  10. {multicmd-1.66 → multicmd-1.67}/multiCMD.egg-info/dependency_links.txt +0 -0
  11. {multicmd-1.66 → multicmd-1.67}/multiCMD.egg-info/entry_points.txt +0 -0
  12. {multicmd-1.66 → multicmd-1.67}/multiCMD.egg-info/top_level.txt +0 -0
  13. {multicmd-1.66 → multicmd-1.67}/scripts/multiCMD +0 -0
  14. {multicmd-1.66 → multicmd-1.67}/setup.cfg +0 -0
  15. {multicmd-1.66 → multicmd-1.67}/tests/test_api.py +0 -0
  16. {multicmd-1.66 → multicmd-1.67}/tests/test_async_executor.py +0 -0
  17. {multicmd-1.66 → multicmd-1.67}/tests/test_cli.py +0 -0
  18. {multicmd-1.66 → multicmd-1.67}/tests/test_cli_closed_stdout.py +0 -0
  19. {multicmd-1.66 → multicmd-1.67}/tests/test_cli_failed_stdout.py +0 -0
  20. {multicmd-1.66 → multicmd-1.67}/tests/test_cli_input.py +0 -0
  21. {multicmd-1.66 → multicmd-1.67}/tests/test_cli_summary.py +0 -0
  22. {multicmd-1.66 → multicmd-1.67}/tests/test_display.py +0 -0
  23. {multicmd-1.66 → multicmd-1.67}/tests/test_embed.py +0 -0
  24. {multicmd-1.66 → multicmd-1.67}/tests/test_env.py +0 -0
  25. {multicmd-1.66 → multicmd-1.67}/tests/test_expand_ranges.py +0 -0
  26. {multicmd-1.66 → multicmd-1.67}/tests/test_handover.py +0 -0
  27. {multicmd-1.66 → multicmd-1.67}/tests/test_interrupts.py +0 -0
  28. {multicmd-1.66 → multicmd-1.67}/tests/test_packaging.py +0 -0
  29. {multicmd-1.66 → multicmd-1.67}/tests/test_parsing.py +0 -0
  30. {multicmd-1.66 → multicmd-1.67}/tests/test_pass_fds.py +0 -0
  31. {multicmd-1.66 → multicmd-1.67}/tests/test_ping.py +0 -0
  32. {multicmd-1.66 → multicmd-1.67}/tests/test_pool.py +0 -0
  33. {multicmd-1.66 → multicmd-1.67}/tests/test_process_groups.py +0 -0
  34. {multicmd-1.66 → multicmd-1.67}/tests/test_pty.py +0 -0
  35. {multicmd-1.66 → multicmd-1.67}/tests/test_reader.py +0 -0
  36. {multicmd-1.66 → multicmd-1.67}/tests/test_reader_quit.py +0 -0
  37. {multicmd-1.66 → multicmd-1.67}/tests/test_regressions.py +0 -0
  38. {multicmd-1.66 → multicmd-1.67}/tests/test_run_command.py +0 -0
  39. {multicmd-1.66 → multicmd-1.67}/tests/test_run_commands.py +0 -0
  40. {multicmd-1.66 → multicmd-1.67}/tests/test_sudo.py +0 -0
  41. {multicmd-1.66 → multicmd-1.67}/tests/test_supervision.py +0 -0
  42. {multicmd-1.66 → multicmd-1.67}/tests/test_task.py +0 -0
  43. {multicmd-1.66 → multicmd-1.67}/tests/test_windows.py +0 -0
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiCMD
3
- Version: 1.66
3
+ Version: 1.67
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
7
7
  Author-email: pan@zopyr.us
8
- License: GPLv3+
8
+ License-Expression: GPL-3.0-or-later
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
10
  Classifier: Operating System :: POSIX :: Linux
12
11
  Classifier: Operating System :: Microsoft :: Windows
13
12
  Requires-Python: >=3.6
@@ -19,8 +18,8 @@ Dynamic: classifier
19
18
  Dynamic: description
20
19
  Dynamic: description-content-type
21
20
  Dynamic: home-page
22
- Dynamic: license
23
21
  Dynamic: license-file
22
+ Dynamic: license-expression
24
23
  Dynamic: requires-python
25
24
  Dynamic: summary
26
25
 
@@ -559,6 +558,15 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
559
558
 
560
559
  `test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
561
560
 
561
+ ## Upgrading to 1.67 from 1.66
562
+
563
+ - Nothing needs doing. `mcmd` is unchanged.
564
+ - Fix, library: `format_bytes()` counts a size string in whole bytes: `'4.1G'` is 4100000000 (1.66: 4099999999, from a
565
+ float). hpcp's size options (`-L`, `-F`, `-dis`, `-ddr`) take these values with 1.67.
566
+ - Fix, library: `format_bytes()` shows a size of 1000 Y or more in Y, as `'1000.00 Y'` or `'1024.00 Yi'` (1.66: `KeyError`),
567
+ and `float('inf')` as `'inf Yi'` (1.66: it never returned).
568
+ - Packaging: built with setuptools 77 or later, the metadata names the license as `License-Expression: GPL-3.0-or-later`.
569
+
562
570
  ## Upgrading to 1.66 from 1.65
563
571
 
564
572
  - Nothing needs doing for `mcmd`, which is unchanged, nor for hpcp 9.92, which checks its sizes itself. hpcp up to 9.91
@@ -533,6 +533,15 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
533
533
 
534
534
  `test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
535
535
 
536
+ ## Upgrading to 1.67 from 1.66
537
+
538
+ - Nothing needs doing. `mcmd` is unchanged.
539
+ - Fix, library: `format_bytes()` counts a size string in whole bytes: `'4.1G'` is 4100000000 (1.66: 4099999999, from a
540
+ float). hpcp's size options (`-L`, `-F`, `-dis`, `-ddr`) take these values with 1.67.
541
+ - Fix, library: `format_bytes()` shows a size of 1000 Y or more in Y, as `'1000.00 Y'` or `'1024.00 Yi'` (1.66: `KeyError`),
542
+ and `float('inf')` as `'inf Yi'` (1.66: it never returned).
543
+ - Packaging: built with setuptools 77 or later, the metadata names the license as `License-Expression: GPL-3.0-or-later`.
544
+
536
545
  ## Upgrading to 1.66 from 1.65
537
546
 
538
547
  - Nothing needs doing for `mcmd`, which is unchanged, nor for hpcp 9.92, which checks its sizes itself. hpcp up to 9.91
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiCMD
3
- Version: 1.66
3
+ Version: 1.67
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
7
7
  Author-email: pan@zopyr.us
8
- License: GPLv3+
8
+ License-Expression: GPL-3.0-or-later
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
10
  Classifier: Operating System :: POSIX :: Linux
12
11
  Classifier: Operating System :: Microsoft :: Windows
13
12
  Requires-Python: >=3.6
@@ -19,8 +18,8 @@ Dynamic: classifier
19
18
  Dynamic: description
20
19
  Dynamic: description-content-type
21
20
  Dynamic: home-page
22
- Dynamic: license
23
21
  Dynamic: license-file
22
+ Dynamic: license-expression
24
23
  Dynamic: requires-python
25
24
  Dynamic: summary
26
25
 
@@ -559,6 +558,15 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
559
558
 
560
559
  `test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
561
560
 
561
+ ## Upgrading to 1.67 from 1.66
562
+
563
+ - Nothing needs doing. `mcmd` is unchanged.
564
+ - Fix, library: `format_bytes()` counts a size string in whole bytes: `'4.1G'` is 4100000000 (1.66: 4099999999, from a
565
+ float). hpcp's size options (`-L`, `-F`, `-dis`, `-ddr`) take these values with 1.67.
566
+ - Fix, library: `format_bytes()` shows a size of 1000 Y or more in Y, as `'1000.00 Y'` or `'1024.00 Yi'` (1.66: `KeyError`),
567
+ and `float('inf')` as `'inf Yi'` (1.66: it never returned).
568
+ - Packaging: built with setuptools 77 or later, the metadata names the license as `License-Expression: GPL-3.0-or-later`.
569
+
562
570
  ## Upgrading to 1.66 from 1.65
563
571
 
564
572
  - Nothing needs doing for `mcmd`, which is unchanged, nor for hpcp 9.92, which checks its sizes itself. hpcp up to 9.91
@@ -29,7 +29,7 @@ import traceback
29
29
  from pprint import pformat
30
30
 
31
31
  #%% global vars
32
- version = '1.66'
32
+ version = '1.67'
33
33
  __version__ = version
34
34
  COMMIT_DATE = '2026-11-14'
35
35
  # fire-and-forget threads (run_commands with wait_for_return=False) that join_threads() waits on. multiCMD takes no
@@ -3690,7 +3690,6 @@ def format_bytes(size, use_1024_bytes=None, to_int=False, to_str=False, str_form
3690
3690
  }
3691
3691
  if match:
3692
3692
  number, _, unit = match.groups()
3693
- number = float(number)
3694
3693
  unit = unit.lower().rstrip("b")
3695
3694
  if unit.endswith("i"):
3696
3695
  use_1024_bytes = True
@@ -3707,14 +3706,12 @@ def format_bytes(size, use_1024_bytes=None, to_int=False, to_str=False, str_form
3707
3706
  power = 2**10
3708
3707
  else:
3709
3708
  power = 10**3
3709
+ # in whole numbers, not a float: '4.1G' is 4100000000 bytes ( 1.66: 4099999999 ); a part of a byte is cut off, as before
3710
+ whole, _, fraction = number.partition(".")
3711
+ size_in_bytes = int(whole + fraction) * power**unit_labels[unit] // 10**len(fraction)
3710
3712
  if to_str:
3711
- return format_bytes(
3712
- size=int(number * (power**unit_labels[unit])),
3713
- use_1024_bytes=use_1024_bytes,
3714
- to_str=True,
3715
- str_format=str_format,
3716
- )
3717
- return int(number * (power**unit_labels[unit]))
3713
+ return format_bytes(size=size_in_bytes, use_1024_bytes=use_1024_bytes, to_str=True, str_format=str_format)
3714
+ return size_in_bytes
3718
3715
  else:
3719
3716
  try:
3720
3717
  return int(size)
@@ -3741,7 +3738,8 @@ def format_bytes(size, use_1024_bytes=None, to_int=False, to_str=False, str_form
3741
3738
  7: "Zi",
3742
3739
  8: "Yi",
3743
3740
  }
3744
- while size >= power:
3741
+ # Y is the last unit: a larger size stays in Y ( 1.66 stepped past it to a KeyError, and float('inf') never stopped )
3742
+ while size >= power and n < len(power_labels) - 1:
3745
3743
  size /= power
3746
3744
  n += 1
3747
3745
  return f"{size:{str_format}} {' '}{power_labels[n]}".replace(" ", " ")
@@ -3759,7 +3757,7 @@ def format_bytes(size, use_1024_bytes=None, to_int=False, to_str=False, str_form
3759
3757
  7: "Z",
3760
3758
  8: "Y",
3761
3759
  }
3762
- while size >= power:
3760
+ while size >= power and n < len(power_labels) - 1:
3763
3761
  size /= power
3764
3762
  n += 1
3765
3763
  return f"{size:{str_format}} {' '}{power_labels[n]}".replace(" ", " ")
multicmd-1.67/setup.py ADDED
@@ -0,0 +1,41 @@
1
+ import setuptools
2
+ from setuptools import setup
3
+ from multiCMD import __version__
4
+
5
+ classifiers = [
6
+ 'Programming Language :: Python :: 3',
7
+ 'Operating System :: POSIX :: Linux',
8
+ 'Operating System :: Microsoft :: Windows',
9
+ ]
10
+ # setuptools 77+ (PEP 639) takes an SPDX license expression and warns about license classifiers (an error next to an
11
+ # expression); older ones (the newest for Python 3.8 and earlier, so all a Python 3.6 install has) know only the
12
+ # free-text license and the classifier. Their sdist and wheel take LICENSE by its name (setuptools 56+, wheel 0.32+).
13
+ if int(setuptools.__version__.split('.')[0]) >= 77:
14
+ license_metadata = {'license_expression': 'GPL-3.0-or-later', 'license_files': ['LICENSE']}
15
+ else:
16
+ license_metadata = {'license': 'GPL-3.0-or-later'}
17
+ classifiers.append('License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)')
18
+
19
+ setup(
20
+ name='multiCMD',
21
+ version=__version__,
22
+ description='Run commands simultaneously',
23
+ long_description=open('README.md', encoding='utf-8').read(),
24
+ long_description_content_type='text/markdown',
25
+ author='Yufei Pan',
26
+ author_email='pan@zopyr.us',
27
+ url='https://github.com/yufei-pan/multiCMD',
28
+ py_modules=['multiCMD'],
29
+ # The mixed-case command is a script file and not an entry point: pip 9 (stock on EL7 and EL8) reads entry_points.txt with a
30
+ # parser that folds case, so two commands that differ only in case make it fail to upgrade or uninstall the package.
31
+ scripts=['scripts/multiCMD'],
32
+ entry_points={
33
+ 'console_scripts': [
34
+ 'mcmd=multiCMD:main',
35
+ 'multicmd=multiCMD:main',
36
+ ],
37
+ },
38
+ classifiers=classifiers,
39
+ python_requires='>=3.6',
40
+ **license_metadata
41
+ )
@@ -110,6 +110,52 @@ def test_format_bytes_reads_every_unit_it_knows(capsys, size, kwargs, expected):
110
110
  assert capsys.readouterr() == ("", "")
111
111
 
112
112
 
113
+ # 1.67: a size is counted in whole numbers, and a part of a byte cut off ( 1.66 multiplied a float: '4.1G' was 4099999999 )
114
+ @pytest.mark.parametrize("size, expected", [
115
+ ("4.1G", 4100000000), ("2.01 K", 2010), ("32.3K", 32300), ("4.1 TB", 4100000000000), ("4.1P", 4100000000000000),
116
+ ("0.1 GiB", 107374182), ("1.5 KiB", 1536), ("12345678901234567891", 12345678901234567891), ("999 Y", 999 * 10 ** 24)], ids=str)
117
+ def test_format_bytes_counts_a_size_in_whole_bytes(size, expected):
118
+ got = format_bytes(size, to_int=True)
119
+ assert got == expected and isinstance(got, int)
120
+
121
+
122
+ def test_format_bytes_counts_every_size_of_two_decimals_exactly():
123
+ # ( 1.66 gave one byte less for 601 of these 50,000 )
124
+ wrong = []
125
+ for unit, power in (("K", 1000), ("G", 1000 ** 3), ("T", 1000 ** 4), ("Ki", 1024), ("Gi", 1024 ** 3)):
126
+ for hundredths in range(10000):
127
+ size = "%d.%02d%s" % (hundredths // 100, hundredths % 100, unit)
128
+ if format_bytes(size, to_int=True) != hundredths * power // 100:
129
+ wrong.append(size)
130
+ assert not wrong, (len(wrong), wrong[:10])
131
+
132
+
133
+ # 1.67: Y is the last unit, and a larger size stays in it ( 1.66 raised KeyError: 9 from 1000 Y, or 1024 Yi, up )
134
+ @pytest.mark.parametrize("size, kwargs, expected", [
135
+ (999 * 10 ** 24, {"use_1024_bytes": False}, "999.00 Y"), (10 ** 27, {"use_1024_bytes": False}, "1000.00 Y"),
136
+ (1023 * 2 ** 80, {}, "1023.00 Yi"), (2 ** 90, {}, "1024.00 Yi"), (2 ** 90, {"use_1024_bytes": True, "to_str": True}, "1024.00 Yi"),
137
+ ("1000 Y", {"to_str": True}, "1000.00 Y"), ("1024 Yi", {"to_str": True}, "1024.00 Yi")], ids=str)
138
+ def test_format_bytes_at_the_end_of_the_last_unit(size, kwargs, expected):
139
+ assert format_bytes(size, **kwargs) == expected
140
+
141
+
142
+ @pytest.mark.parametrize("size, kwargs, unit, number", [
143
+ (10 ** 40, {"use_1024_bytes": False}, "Y", 1e16), (1e30, {"use_1024_bytes": False}, "Y", 1e6), (2 ** 200, {}, "Yi", 2.0 ** 120),
144
+ ("5000000 YB", {"to_str": True}, "Y", 5e6), ("1048576 YiB", {"to_str": True}, "Yi", 2.0 ** 20)], ids=str)
145
+ def test_format_bytes_shows_a_size_far_past_the_last_unit_in_it(size, kwargs, unit, number):
146
+ # ( eight divisions in floats: 10 ** 40 shows as 9999999999999998.00 Y )
147
+ got_number, got_unit = format_bytes(size, **kwargs).split(" ")
148
+ assert got_unit == unit and float(got_number) == pytest.approx(number)
149
+
150
+
151
+ def test_format_bytes_shows_an_endless_size_in_the_last_unit():
152
+ # ( 1.66's unit loop never ended: inf divided by 1024 is inf; in a child, so a loop that does not end fails, not hangs )
153
+ shown = subprocess.run([sys.executable, "-c", "import multiCMD; print(multiCMD.format_bytes(float('inf')))"],
154
+ cwd=str(Path(multiCMD.__file__).resolve().parent), stdout=subprocess.PIPE, stderr=subprocess.PIPE,
155
+ universal_newlines=True, timeout=60)
156
+ assert (shown.returncode, shown.stdout, shown.stderr) == (0, "inf Yi\n", "")
157
+
158
+
113
159
  def test_int_to_color_deterministic_and_in_range():
114
160
  assert int_to_color(0x123456) == (36, 103, 171)
115
161
  assert int_to_color(0) == (160, 160, 160)
multicmd-1.66/setup.py DELETED
@@ -1,31 +0,0 @@
1
- from setuptools import setup
2
- from multiCMD import __version__
3
-
4
- setup(
5
- name='multiCMD',
6
- version=__version__,
7
- description='Run commands simultaneously',
8
- long_description=open('README.md', encoding='utf-8').read(),
9
- long_description_content_type='text/markdown',
10
- author='Yufei Pan',
11
- author_email='pan@zopyr.us',
12
- url='https://github.com/yufei-pan/multiCMD',
13
- py_modules=['multiCMD'],
14
- # The mixed-case command is a script file and not an entry point: pip 9 (stock on EL7 and EL8) reads entry_points.txt with a
15
- # parser that folds case, so two commands that differ only in case make it fail to upgrade or uninstall the package.
16
- scripts=['scripts/multiCMD'],
17
- entry_points={
18
- 'console_scripts': [
19
- 'mcmd=multiCMD:main',
20
- 'multicmd=multiCMD:main',
21
- ],
22
- },
23
- classifiers=[
24
- 'Programming Language :: Python :: 3',
25
- 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
26
- 'Operating System :: POSIX :: Linux',
27
- 'Operating System :: Microsoft :: Windows',
28
- ],
29
- python_requires='>=3.6',
30
- license='GPLv3+',
31
- )
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
File without changes
File without changes