pystand 2.15__tar.gz → 2.16__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.
@@ -3,6 +3,7 @@ check:
3
3
  ruff check $(PYFILES)
4
4
  mypy $(PYFILES)
5
5
  pyright $(PYFILES)
6
+ md-link-checker
6
7
 
7
8
  build:
8
9
  rm -rf dist
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystand
3
- Version: 2.15
3
+ Version: 2.16
4
4
  Summary: Install Python versions from python-build-standalone project
5
5
  Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
6
6
  License-Expression: GPL-3.0-or-later
@@ -41,7 +41,7 @@ required
41
41
  for your machine architecture is normally auto-detected. By default, the
42
42
  _`install_only_stripped`_ build of the distribution is installed but you
43
43
  can choose to [install any other
44
- build/distribution](#installing-other-builds/distributions) instead, or
44
+ build/distribution](#installing-other-buildsdistributions) instead, or
45
45
  in parallel.
46
46
 
47
47
  Some simple usage examples are:
@@ -131,7 +131,7 @@ usage: pystand [-h] [-D DISTRIBUTION] [-P PREFIX_DIR] [-C CACHE_DIR]
131
131
  [-M CACHE_MINUTES] [--purge-days PURGE_DAYS]
132
132
  [--github-access-token GITHUB_ACCESS_TOKEN] [--no-strip]
133
133
  [-V]
134
- {install,update,upgrade,remove,uninstall,list,show,path} ...
134
+ {install,update,upgrade,remove,uninstall,list,show,path,cache} ...
135
135
 
136
136
  Command line tool to download, install, and update pre-built Python versions
137
137
  from the python-build-standalone project at https://github.com/astral-
@@ -141,8 +141,9 @@ options:
141
141
  -h, --help show this help message and exit
142
142
  -D, --distribution DISTRIBUTION
143
143
  python-build-standalone distribution. Default is
144
- "x86_64_v3-unknown-linux-gnu-install_only_stripped for
145
- this host
144
+ "x86_64_v3-unknown-linux-gnu-install_only_stripped"
145
+ for this host. Run "pystand show -a" to see all
146
+ distributions.
146
147
  -P, --prefix-dir PREFIX_DIR
147
148
  specify prefix dir for storing versions. Default is
148
149
  "$HOME/.local/share/pystand"
@@ -164,7 +165,7 @@ options:
164
165
  -V, --version just show pystand version
165
166
 
166
167
  Commands:
167
- {install,update,upgrade,remove,uninstall,list,show,path}
168
+ {install,update,upgrade,remove,uninstall,list,show,path,cache}
168
169
  install Install one or more versions from a python-build-
169
170
  standalone release.
170
171
  update (upgrade) Update one, more, or all versions to another release.
@@ -173,6 +174,7 @@ Commands:
173
174
  available.
174
175
  show Show versions available from a release.
175
176
  path Show path prefix to installed version base directory.
177
+ cache Show release cache sizes.
176
178
 
177
179
  Some commands offer aliases as shown in parentheses above. Note you can set
178
180
  default starting global options in $HOME/.config/pystand-flags.conf.
@@ -307,6 +309,23 @@ options:
307
309
  -c, --cache-path just show path to cache dir
308
310
  ```
309
311
 
312
+ ### Command `cache`
313
+
314
+ ```
315
+ usage: pystand cache [-h] [-T] [-H] [release ...]
316
+
317
+ Show release cache sizes.
318
+
319
+ positional arguments:
320
+ release show cache size for given release[s] only
321
+
322
+ options:
323
+ -h, --help show this help message and exit
324
+ -T, --no-total do not show total cache size
325
+ -H, --no-human-readable
326
+ show sizes in bytes, not human readable format
327
+ ```
328
+
310
329
  ## Installation and Upgrade
311
330
 
312
331
  Python 3.8 or later is required. Arch Linux users can install [`pystand`
@@ -24,7 +24,7 @@ required
24
24
  for your machine architecture is normally auto-detected. By default, the
25
25
  _`install_only_stripped`_ build of the distribution is installed but you
26
26
  can choose to [install any other
27
- build/distribution](#installing-other-builds/distributions) instead, or
27
+ build/distribution](#installing-other-buildsdistributions) instead, or
28
28
  in parallel.
29
29
 
30
30
  Some simple usage examples are:
@@ -114,7 +114,7 @@ usage: pystand [-h] [-D DISTRIBUTION] [-P PREFIX_DIR] [-C CACHE_DIR]
114
114
  [-M CACHE_MINUTES] [--purge-days PURGE_DAYS]
115
115
  [--github-access-token GITHUB_ACCESS_TOKEN] [--no-strip]
116
116
  [-V]
117
- {install,update,upgrade,remove,uninstall,list,show,path} ...
117
+ {install,update,upgrade,remove,uninstall,list,show,path,cache} ...
118
118
 
119
119
  Command line tool to download, install, and update pre-built Python versions
120
120
  from the python-build-standalone project at https://github.com/astral-
@@ -124,8 +124,9 @@ options:
124
124
  -h, --help show this help message and exit
125
125
  -D, --distribution DISTRIBUTION
126
126
  python-build-standalone distribution. Default is
127
- "x86_64_v3-unknown-linux-gnu-install_only_stripped for
128
- this host
127
+ "x86_64_v3-unknown-linux-gnu-install_only_stripped"
128
+ for this host. Run "pystand show -a" to see all
129
+ distributions.
129
130
  -P, --prefix-dir PREFIX_DIR
130
131
  specify prefix dir for storing versions. Default is
131
132
  "$HOME/.local/share/pystand"
@@ -147,7 +148,7 @@ options:
147
148
  -V, --version just show pystand version
148
149
 
149
150
  Commands:
150
- {install,update,upgrade,remove,uninstall,list,show,path}
151
+ {install,update,upgrade,remove,uninstall,list,show,path,cache}
151
152
  install Install one or more versions from a python-build-
152
153
  standalone release.
153
154
  update (upgrade) Update one, more, or all versions to another release.
@@ -156,6 +157,7 @@ Commands:
156
157
  available.
157
158
  show Show versions available from a release.
158
159
  path Show path prefix to installed version base directory.
160
+ cache Show release cache sizes.
159
161
 
160
162
  Some commands offer aliases as shown in parentheses above. Note you can set
161
163
  default starting global options in $HOME/.config/pystand-flags.conf.
@@ -290,6 +292,23 @@ options:
290
292
  -c, --cache-path just show path to cache dir
291
293
  ```
292
294
 
295
+ ### Command `cache`
296
+
297
+ ```
298
+ usage: pystand cache [-h] [-T] [-H] [release ...]
299
+
300
+ Show release cache sizes.
301
+
302
+ positional arguments:
303
+ release show cache size for given release[s] only
304
+
305
+ options:
306
+ -h, --help show this help message and exit
307
+ -T, --no-total do not show total cache size
308
+ -H, --no-human-readable
309
+ show sizes in bytes, not human readable format
310
+ ```
311
+
293
312
  ## Installation and Upgrade
294
313
 
295
314
  Python 3.8 or later is required. Arch Linux users can install [`pystand`
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pystand
3
- Version: 2.15
3
+ Version: 2.16
4
4
  Summary: Install Python versions from python-build-standalone project
5
5
  Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
6
6
  License-Expression: GPL-3.0-or-later
@@ -41,7 +41,7 @@ required
41
41
  for your machine architecture is normally auto-detected. By default, the
42
42
  _`install_only_stripped`_ build of the distribution is installed but you
43
43
  can choose to [install any other
44
- build/distribution](#installing-other-builds/distributions) instead, or
44
+ build/distribution](#installing-other-buildsdistributions) instead, or
45
45
  in parallel.
46
46
 
47
47
  Some simple usage examples are:
@@ -131,7 +131,7 @@ usage: pystand [-h] [-D DISTRIBUTION] [-P PREFIX_DIR] [-C CACHE_DIR]
131
131
  [-M CACHE_MINUTES] [--purge-days PURGE_DAYS]
132
132
  [--github-access-token GITHUB_ACCESS_TOKEN] [--no-strip]
133
133
  [-V]
134
- {install,update,upgrade,remove,uninstall,list,show,path} ...
134
+ {install,update,upgrade,remove,uninstall,list,show,path,cache} ...
135
135
 
136
136
  Command line tool to download, install, and update pre-built Python versions
137
137
  from the python-build-standalone project at https://github.com/astral-
@@ -141,8 +141,9 @@ options:
141
141
  -h, --help show this help message and exit
142
142
  -D, --distribution DISTRIBUTION
143
143
  python-build-standalone distribution. Default is
144
- "x86_64_v3-unknown-linux-gnu-install_only_stripped for
145
- this host
144
+ "x86_64_v3-unknown-linux-gnu-install_only_stripped"
145
+ for this host. Run "pystand show -a" to see all
146
+ distributions.
146
147
  -P, --prefix-dir PREFIX_DIR
147
148
  specify prefix dir for storing versions. Default is
148
149
  "$HOME/.local/share/pystand"
@@ -164,7 +165,7 @@ options:
164
165
  -V, --version just show pystand version
165
166
 
166
167
  Commands:
167
- {install,update,upgrade,remove,uninstall,list,show,path}
168
+ {install,update,upgrade,remove,uninstall,list,show,path,cache}
168
169
  install Install one or more versions from a python-build-
169
170
  standalone release.
170
171
  update (upgrade) Update one, more, or all versions to another release.
@@ -173,6 +174,7 @@ Commands:
173
174
  available.
174
175
  show Show versions available from a release.
175
176
  path Show path prefix to installed version base directory.
177
+ cache Show release cache sizes.
176
178
 
177
179
  Some commands offer aliases as shown in parentheses above. Note you can set
178
180
  default starting global options in $HOME/.config/pystand-flags.conf.
@@ -307,6 +309,23 @@ options:
307
309
  -c, --cache-path just show path to cache dir
308
310
  ```
309
311
 
312
+ ### Command `cache`
313
+
314
+ ```
315
+ usage: pystand cache [-h] [-T] [-H] [release ...]
316
+
317
+ Show release cache sizes.
318
+
319
+ positional arguments:
320
+ release show cache size for given release[s] only
321
+
322
+ options:
323
+ -h, --help show this help message and exit
324
+ -T, --no-total do not show total cache size
325
+ -H, --no-human-readable
326
+ show sizes in bytes, not human readable format
327
+ ```
328
+
310
329
  ## Installation and Upgrade
311
330
 
312
331
  Python 3.8 or later is required. Arch Linux users can install [`pystand`
@@ -610,6 +610,36 @@ def install(
610
610
  return error
611
611
 
612
612
 
613
+ def to_human(num, prec: int | None = None) -> str:
614
+ "Convert a number of bytes to a human-readable format"
615
+ units = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
616
+ for unit in units:
617
+ if abs(num) < 1024.0 or unit == units[-1]:
618
+ return f'{round(num, prec)}{unit}'
619
+ num /= 1024.0
620
+
621
+ return ''
622
+
623
+
624
+ def show_cache_size(path: Path, args: Namespace) -> None:
625
+ "Show the size of the cache directory"
626
+ total = 0
627
+ for spath in sorted(path.iterdir()):
628
+ size = (
629
+ sum(p.stat().st_size for p in spath.iterdir())
630
+ if spath.is_dir()
631
+ else spath.stat().st_size
632
+ )
633
+ total += size
634
+ size_str = f'{size}B' if args.no_human_readable else to_human(size)
635
+ name = str(spath) if spath.is_dir() else spath.name
636
+ print(f'{size_str}\t{name}')
637
+
638
+ if not args.no_total:
639
+ size_str = f'{total}B' if args.no_human_readable else to_human(total, 2)
640
+ print(f'{size_str}\tTOTAL')
641
+
642
+
613
643
  def main() -> str | None:
614
644
  "Main code"
615
645
  distro_default = DISTRIBUTIONS.get((platform.system(), platform.machine()))
@@ -631,7 +661,8 @@ def main() -> str | None:
631
661
  opt.add_argument(
632
662
  '-D',
633
663
  '--distribution',
634
- help=f'{REPO} distribution. Default is "{distro_help} for this host',
664
+ help=f'{REPO} distribution. Default is "{distro_help}" for this host. '
665
+ f'Run "{PROG} show -a" to see all distributions.',
635
666
  )
636
667
  opt.add_argument(
637
668
  '-P',
@@ -1143,5 +1174,33 @@ class path_:
1143
1174
  print(path)
1144
1175
 
1145
1176
 
1177
+ # COMMAND
1178
+ class cache_:
1179
+ "Show release cache sizes."
1180
+
1181
+ @staticmethod
1182
+ def init(parser: ArgumentParser) -> None:
1183
+ parser.add_argument(
1184
+ '-T', '--no-total', action='store_true', help='do not show total cache size'
1185
+ )
1186
+ parser.add_argument(
1187
+ '-H',
1188
+ '--no-human-readable',
1189
+ action='store_true',
1190
+ help='show sizes in bytes, not human readable format',
1191
+ )
1192
+ parser.add_argument(
1193
+ 'release', nargs='*', help='show cache size for given release[s] only'
1194
+ )
1195
+
1196
+ @staticmethod
1197
+ def run(args: Namespace) -> str | None:
1198
+ if args.release:
1199
+ for release in args.release:
1200
+ show_cache_size(args._downloads / release, args)
1201
+ else:
1202
+ show_cache_size(args._downloads, args)
1203
+
1204
+
1146
1205
  if __name__ == '__main__':
1147
1206
  sys.exit(main())
File without changes
File without changes
File without changes