pystand 2.2__tar.gz → 2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pystand
3
- Version: 2.2
3
+ Version: 2.3
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: GPLv3
@@ -92,16 +92,16 @@ Here are some examples showing how to use an installed version ..
92
92
 
93
93
  ```sh
94
94
  # Use uv to create a virtual environment to be run with latest pystand
95
- # installed python:
96
- $ uv venv -p $(pystand path) myenv
95
+ # installed python 3.12:
96
+ $ uv venv -p $(pystand path 3.12) myenv
97
97
 
98
98
  # Create a regular virtual environment to be run with latest pystand
99
- # installed python:
100
- $ $(pystand path -p) -m venv myenv
99
+ # installed python 3.12:
100
+ $ $(pystand path -p 3.12) -m venv myenv
101
101
 
102
102
  # Use pipx to install a package to be run with pystand installed python
103
- # specific version:
104
- $ pipx install --python $(pystand path -p 3.11) cowsay
103
+ # specific version 3.11.1:
104
+ $ pipx install --python $(pystand path -p 3.11.1) cowsay
105
105
  ```
106
106
 
107
107
  See detailed usage information in the [Usage](#usage) section that
@@ -281,17 +281,18 @@ options:
281
281
  ### Command `path`
282
282
 
283
283
  ```
284
- usage: pystand path [-h] [-p] [-c | version]
284
+ usage: pystand path [-h] [-p] [-r] [-c | version]
285
285
 
286
286
  Show path prefix to installed version base directory.
287
287
 
288
288
  positional arguments:
289
- version print resolved path for specified version
289
+ version version number to show path for
290
290
 
291
291
  options:
292
- -h, --help show this help message and exit
293
- -p, --python-path show full path to python executable
294
- -c, --cache-prefix print path to cache dir
292
+ -h, --help show this help message and exit
293
+ -p, --python-path add path to python executable
294
+ -r, --resolve fully resolve given version
295
+ -c, --cache-path just show path to cache dir
295
296
  ```
296
297
 
297
298
  ## Installation and Upgrade
@@ -331,7 +332,7 @@ the versions for these are installed by default at
331
332
  `~/.local/share/pystand/<version>`.
332
333
 
333
334
  However, let's say you want to experiment with the new free-threaded
334
- 3.13 build. You can install this to a different directory, e.g.
335
+ 3.13 build, installed to a different directory. E.g.:
335
336
 
336
337
  ```sh
337
338
  $ mkdir ./3.13-freethreaded
@@ -345,24 +346,24 @@ $ pystand -P . list
345
346
  3.13.0 @ 20241016 distribution="x86_64_v4-unknown-linux-gnu-freethreaded+lto-full"
346
347
  ```
347
348
 
348
- Note you can set a different default distribution by
349
- specifying `--distribution` as a [default
350
- option](#command-default-options).
349
+ Note you can set a different default distribution by specifying
350
+ `--distribution` as a [default option](#command-default-options).
351
351
 
352
352
  ## Extrapolation of Python Versions
353
353
 
354
- `pystand` extrapolates any version text you specify on the command line
355
- to the latest available corresponding installed or release version. For
356
- example, if you specify `pystand install 3.12` then `pystand` will look
357
- in the release files to find the latest (i.e. highest) available version
358
- of `3.12`, e.g. `3.12.3` (at the time of writing), and will install
359
- that. Of course you can specify the exact version if you wish, e.g.
360
- `3.12.3` but generally you don't need to bother. This is true for any
361
- command that takes a version argument so be aware that this may be
362
- confusing if there are multiple same Python minor versions, e.g.
363
- `3.12.1` and `3.12.3`, installed from different releases. So in that
364
- case you should specify the exact version because e.g. `pystand remove
365
- 3.12` will remove `3.12.3` which may not be what you want.
354
+ For all commands except the `path` command, `pystand` extrapolates
355
+ version text you specify on the command line to the latest available
356
+ corresponding installed or release version. For example, if you specify
357
+ `pystand install 3.12` then `pystand` will look in the release files to
358
+ find the latest (i.e. highest) available version of `3.12`, e.g.
359
+ `3.12.3` (at the time of writing), and will install that. Of course you
360
+ can specify the exact version if you wish, e.g. `3.12.3` but generally
361
+ you don't need to bother. This is true for any command that takes a
362
+ version argument so be aware that this may be confusing if there are
363
+ multiple same Python minor versions, e.g. `3.12.1` and `3.12.3`,
364
+ installed from different releases. So in that case you should specify
365
+ the exact version because e.g. `pystand remove 3.12` will remove
366
+ `3.12.3` which may not be what you want.
366
367
 
367
368
  Note, consistent with this, you actually don't need to specify a
368
369
  minor version, e.g. `pystand install 3` would also install `3.12.3`
@@ -375,6 +376,37 @@ to `~/.local/share/pystand/versions/3.12.3` so that you can optionally
375
376
  hard code the symlink directory in places where it can not be set
376
377
  dynamically (i.e. where using `pystand path` is not an option).
377
378
 
379
+ You can exploit these symlinks when you create virtual environments
380
+ using the `pystand path` command (or just hard code the actual link/path
381
+ for your environment/platform). E.g. The following creates a virtual
382
+ environment which runs with whatever the currently latest installed
383
+ Python 3.12 version is:
384
+
385
+ ```sh
386
+ # Use uv to create a virtual environment to be run with a symlink to
387
+ # currently latest installed python 3.12:
388
+ $ uv venv -p $(pystand path 3.12)
389
+ ```
390
+
391
+ So if you then update to a new version of Python 3.12 using `pystand`,
392
+ e.g. from 3.12.3 to 3.12.4, the virtual environment will automatically
393
+ use the new Python version. However, if you for some reason want to
394
+ create the virtual environment with a specific version of Python that is
395
+ never changed, then just specify that exact version when you create the
396
+ virtual environment, e.g.:
397
+
398
+ ```sh
399
+ # Use uv to create a virtual environment to be run with specific pystand
400
+ # installed python 3.12.2:
401
+ $ uv venv -p $(pystand path 3.12.2)
402
+
403
+ # If you can't be bothered to look up the current latest version, then
404
+ # the following command will do the same thing as above because it
405
+ # resolves the symlink to the current latest 3.12 version at the time
406
+ # you run this command:
407
+ $ uv venv -p $(pystand path -r 3.12)
408
+ ```
409
+
378
410
  ## Command Default Options
379
411
 
380
412
  You can add default global options to a personal configuration file
@@ -75,16 +75,16 @@ Here are some examples showing how to use an installed version ..
75
75
 
76
76
  ```sh
77
77
  # Use uv to create a virtual environment to be run with latest pystand
78
- # installed python:
79
- $ uv venv -p $(pystand path) myenv
78
+ # installed python 3.12:
79
+ $ uv venv -p $(pystand path 3.12) myenv
80
80
 
81
81
  # Create a regular virtual environment to be run with latest pystand
82
- # installed python:
83
- $ $(pystand path -p) -m venv myenv
82
+ # installed python 3.12:
83
+ $ $(pystand path -p 3.12) -m venv myenv
84
84
 
85
85
  # Use pipx to install a package to be run with pystand installed python
86
- # specific version:
87
- $ pipx install --python $(pystand path -p 3.11) cowsay
86
+ # specific version 3.11.1:
87
+ $ pipx install --python $(pystand path -p 3.11.1) cowsay
88
88
  ```
89
89
 
90
90
  See detailed usage information in the [Usage](#usage) section that
@@ -264,17 +264,18 @@ options:
264
264
  ### Command `path`
265
265
 
266
266
  ```
267
- usage: pystand path [-h] [-p] [-c | version]
267
+ usage: pystand path [-h] [-p] [-r] [-c | version]
268
268
 
269
269
  Show path prefix to installed version base directory.
270
270
 
271
271
  positional arguments:
272
- version print resolved path for specified version
272
+ version version number to show path for
273
273
 
274
274
  options:
275
- -h, --help show this help message and exit
276
- -p, --python-path show full path to python executable
277
- -c, --cache-prefix print path to cache dir
275
+ -h, --help show this help message and exit
276
+ -p, --python-path add path to python executable
277
+ -r, --resolve fully resolve given version
278
+ -c, --cache-path just show path to cache dir
278
279
  ```
279
280
 
280
281
  ## Installation and Upgrade
@@ -314,7 +315,7 @@ the versions for these are installed by default at
314
315
  `~/.local/share/pystand/<version>`.
315
316
 
316
317
  However, let's say you want to experiment with the new free-threaded
317
- 3.13 build. You can install this to a different directory, e.g.
318
+ 3.13 build, installed to a different directory. E.g.:
318
319
 
319
320
  ```sh
320
321
  $ mkdir ./3.13-freethreaded
@@ -328,24 +329,24 @@ $ pystand -P . list
328
329
  3.13.0 @ 20241016 distribution="x86_64_v4-unknown-linux-gnu-freethreaded+lto-full"
329
330
  ```
330
331
 
331
- Note you can set a different default distribution by
332
- specifying `--distribution` as a [default
333
- option](#command-default-options).
332
+ Note you can set a different default distribution by specifying
333
+ `--distribution` as a [default option](#command-default-options).
334
334
 
335
335
  ## Extrapolation of Python Versions
336
336
 
337
- `pystand` extrapolates any version text you specify on the command line
338
- to the latest available corresponding installed or release version. For
339
- example, if you specify `pystand install 3.12` then `pystand` will look
340
- in the release files to find the latest (i.e. highest) available version
341
- of `3.12`, e.g. `3.12.3` (at the time of writing), and will install
342
- that. Of course you can specify the exact version if you wish, e.g.
343
- `3.12.3` but generally you don't need to bother. This is true for any
344
- command that takes a version argument so be aware that this may be
345
- confusing if there are multiple same Python minor versions, e.g.
346
- `3.12.1` and `3.12.3`, installed from different releases. So in that
347
- case you should specify the exact version because e.g. `pystand remove
348
- 3.12` will remove `3.12.3` which may not be what you want.
337
+ For all commands except the `path` command, `pystand` extrapolates
338
+ version text you specify on the command line to the latest available
339
+ corresponding installed or release version. For example, if you specify
340
+ `pystand install 3.12` then `pystand` will look in the release files to
341
+ find the latest (i.e. highest) available version of `3.12`, e.g.
342
+ `3.12.3` (at the time of writing), and will install that. Of course you
343
+ can specify the exact version if you wish, e.g. `3.12.3` but generally
344
+ you don't need to bother. This is true for any command that takes a
345
+ version argument so be aware that this may be confusing if there are
346
+ multiple same Python minor versions, e.g. `3.12.1` and `3.12.3`,
347
+ installed from different releases. So in that case you should specify
348
+ the exact version because e.g. `pystand remove 3.12` will remove
349
+ `3.12.3` which may not be what you want.
349
350
 
350
351
  Note, consistent with this, you actually don't need to specify a
351
352
  minor version, e.g. `pystand install 3` would also install `3.12.3`
@@ -358,6 +359,37 @@ to `~/.local/share/pystand/versions/3.12.3` so that you can optionally
358
359
  hard code the symlink directory in places where it can not be set
359
360
  dynamically (i.e. where using `pystand path` is not an option).
360
361
 
362
+ You can exploit these symlinks when you create virtual environments
363
+ using the `pystand path` command (or just hard code the actual link/path
364
+ for your environment/platform). E.g. The following creates a virtual
365
+ environment which runs with whatever the currently latest installed
366
+ Python 3.12 version is:
367
+
368
+ ```sh
369
+ # Use uv to create a virtual environment to be run with a symlink to
370
+ # currently latest installed python 3.12:
371
+ $ uv venv -p $(pystand path 3.12)
372
+ ```
373
+
374
+ So if you then update to a new version of Python 3.12 using `pystand`,
375
+ e.g. from 3.12.3 to 3.12.4, the virtual environment will automatically
376
+ use the new Python version. However, if you for some reason want to
377
+ create the virtual environment with a specific version of Python that is
378
+ never changed, then just specify that exact version when you create the
379
+ virtual environment, e.g.:
380
+
381
+ ```sh
382
+ # Use uv to create a virtual environment to be run with specific pystand
383
+ # installed python 3.12.2:
384
+ $ uv venv -p $(pystand path 3.12.2)
385
+
386
+ # If you can't be bothered to look up the current latest version, then
387
+ # the following command will do the same thing as above because it
388
+ # resolves the symlink to the current latest 3.12 version at the time
389
+ # you run this command:
390
+ $ uv venv -p $(pystand path -r 3.12)
391
+ ```
392
+
361
393
  ## Command Default Options
362
394
 
363
395
  You can add default global options to a personal configuration file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pystand
3
- Version: 2.2
3
+ Version: 2.3
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: GPLv3
@@ -92,16 +92,16 @@ Here are some examples showing how to use an installed version ..
92
92
 
93
93
  ```sh
94
94
  # Use uv to create a virtual environment to be run with latest pystand
95
- # installed python:
96
- $ uv venv -p $(pystand path) myenv
95
+ # installed python 3.12:
96
+ $ uv venv -p $(pystand path 3.12) myenv
97
97
 
98
98
  # Create a regular virtual environment to be run with latest pystand
99
- # installed python:
100
- $ $(pystand path -p) -m venv myenv
99
+ # installed python 3.12:
100
+ $ $(pystand path -p 3.12) -m venv myenv
101
101
 
102
102
  # Use pipx to install a package to be run with pystand installed python
103
- # specific version:
104
- $ pipx install --python $(pystand path -p 3.11) cowsay
103
+ # specific version 3.11.1:
104
+ $ pipx install --python $(pystand path -p 3.11.1) cowsay
105
105
  ```
106
106
 
107
107
  See detailed usage information in the [Usage](#usage) section that
@@ -281,17 +281,18 @@ options:
281
281
  ### Command `path`
282
282
 
283
283
  ```
284
- usage: pystand path [-h] [-p] [-c | version]
284
+ usage: pystand path [-h] [-p] [-r] [-c | version]
285
285
 
286
286
  Show path prefix to installed version base directory.
287
287
 
288
288
  positional arguments:
289
- version print resolved path for specified version
289
+ version version number to show path for
290
290
 
291
291
  options:
292
- -h, --help show this help message and exit
293
- -p, --python-path show full path to python executable
294
- -c, --cache-prefix print path to cache dir
292
+ -h, --help show this help message and exit
293
+ -p, --python-path add path to python executable
294
+ -r, --resolve fully resolve given version
295
+ -c, --cache-path just show path to cache dir
295
296
  ```
296
297
 
297
298
  ## Installation and Upgrade
@@ -331,7 +332,7 @@ the versions for these are installed by default at
331
332
  `~/.local/share/pystand/<version>`.
332
333
 
333
334
  However, let's say you want to experiment with the new free-threaded
334
- 3.13 build. You can install this to a different directory, e.g.
335
+ 3.13 build, installed to a different directory. E.g.:
335
336
 
336
337
  ```sh
337
338
  $ mkdir ./3.13-freethreaded
@@ -345,24 +346,24 @@ $ pystand -P . list
345
346
  3.13.0 @ 20241016 distribution="x86_64_v4-unknown-linux-gnu-freethreaded+lto-full"
346
347
  ```
347
348
 
348
- Note you can set a different default distribution by
349
- specifying `--distribution` as a [default
350
- option](#command-default-options).
349
+ Note you can set a different default distribution by specifying
350
+ `--distribution` as a [default option](#command-default-options).
351
351
 
352
352
  ## Extrapolation of Python Versions
353
353
 
354
- `pystand` extrapolates any version text you specify on the command line
355
- to the latest available corresponding installed or release version. For
356
- example, if you specify `pystand install 3.12` then `pystand` will look
357
- in the release files to find the latest (i.e. highest) available version
358
- of `3.12`, e.g. `3.12.3` (at the time of writing), and will install
359
- that. Of course you can specify the exact version if you wish, e.g.
360
- `3.12.3` but generally you don't need to bother. This is true for any
361
- command that takes a version argument so be aware that this may be
362
- confusing if there are multiple same Python minor versions, e.g.
363
- `3.12.1` and `3.12.3`, installed from different releases. So in that
364
- case you should specify the exact version because e.g. `pystand remove
365
- 3.12` will remove `3.12.3` which may not be what you want.
354
+ For all commands except the `path` command, `pystand` extrapolates
355
+ version text you specify on the command line to the latest available
356
+ corresponding installed or release version. For example, if you specify
357
+ `pystand install 3.12` then `pystand` will look in the release files to
358
+ find the latest (i.e. highest) available version of `3.12`, e.g.
359
+ `3.12.3` (at the time of writing), and will install that. Of course you
360
+ can specify the exact version if you wish, e.g. `3.12.3` but generally
361
+ you don't need to bother. This is true for any command that takes a
362
+ version argument so be aware that this may be confusing if there are
363
+ multiple same Python minor versions, e.g. `3.12.1` and `3.12.3`,
364
+ installed from different releases. So in that case you should specify
365
+ the exact version because e.g. `pystand remove 3.12` will remove
366
+ `3.12.3` which may not be what you want.
366
367
 
367
368
  Note, consistent with this, you actually don't need to specify a
368
369
  minor version, e.g. `pystand install 3` would also install `3.12.3`
@@ -375,6 +376,37 @@ to `~/.local/share/pystand/versions/3.12.3` so that you can optionally
375
376
  hard code the symlink directory in places where it can not be set
376
377
  dynamically (i.e. where using `pystand path` is not an option).
377
378
 
379
+ You can exploit these symlinks when you create virtual environments
380
+ using the `pystand path` command (or just hard code the actual link/path
381
+ for your environment/platform). E.g. The following creates a virtual
382
+ environment which runs with whatever the currently latest installed
383
+ Python 3.12 version is:
384
+
385
+ ```sh
386
+ # Use uv to create a virtual environment to be run with a symlink to
387
+ # currently latest installed python 3.12:
388
+ $ uv venv -p $(pystand path 3.12)
389
+ ```
390
+
391
+ So if you then update to a new version of Python 3.12 using `pystand`,
392
+ e.g. from 3.12.3 to 3.12.4, the virtual environment will automatically
393
+ use the new Python version. However, if you for some reason want to
394
+ create the virtual environment with a specific version of Python that is
395
+ never changed, then just specify that exact version when you create the
396
+ virtual environment, e.g.:
397
+
398
+ ```sh
399
+ # Use uv to create a virtual environment to be run with specific pystand
400
+ # installed python 3.12.2:
401
+ $ uv venv -p $(pystand path 3.12.2)
402
+
403
+ # If you can't be bothered to look up the current latest version, then
404
+ # the following command will do the same thing as above because it
405
+ # resolves the symlink to the current latest 3.12 version at the time
406
+ # you run this command:
407
+ $ uv venv -p $(pystand path -r 3.12)
408
+ ```
409
+
378
410
  ## Command Default Options
379
411
 
380
412
  You can add default global options to a personal configuration file
@@ -871,47 +871,40 @@ class _path(COMMAND):
871
871
  @staticmethod
872
872
  def init(parser: ArgumentParser) -> None:
873
873
  parser.add_argument('-p', '--python-path', action='store_true',
874
- help='show full path to python executable')
874
+ help='add path to python executable')
875
+ parser.add_argument('-r', '--resolve', action='store_true',
876
+ help='fully resolve given version')
875
877
  group = parser.add_mutually_exclusive_group()
876
- group.add_argument('-c', '--cache-prefix', action='store_true',
877
- help='print path to cache dir')
878
+ group.add_argument('-c', '--cache-path', action='store_true',
879
+ help='just show path to cache dir')
878
880
  group.add_argument('version', nargs='?',
879
- help='print resolved path for specified version')
881
+ help='version number to show path for')
880
882
 
881
883
  @staticmethod
882
884
  def run(args: Namespace) -> str | None:
883
- if args.cache_prefix:
885
+ version = args.version
886
+ if args.cache_path or not version:
884
887
  if args.python_path:
885
888
  args.parser.error('Can not specify --python-path.')
886
- print(args._downloads.parent)
887
- return
888
889
 
889
- if not args.version:
890
- if args.python_path:
891
- args.parser.error('Can not specify --python-path.')
892
- print(args._versions)
893
- return
890
+ print(args._downloads.parent if args.cache_path else args._versions)
891
+ else:
892
+ path = args._versions / version
893
+ if not path.is_symlink() or not path.exists():
894
+ return f'Version "{version}" is not installed.'
894
895
 
895
- matcher = VersionMatcher([f.name for f in iter_versions(args)])
896
- version = matcher.match(args.version)
897
- if not version:
898
- return 'No Python version installed.'
896
+ if args.resolve:
897
+ path = path.resolve()
899
898
 
900
- path = args._versions / version
901
- if not path.is_dir():
902
- return f'Version "{version}" is not installed.'
899
+ if args.python_path:
900
+ basepath = path
901
+ path = basepath / 'bin' / 'python'
902
+ if not path.exists():
903
+ path = basepath / 'python.exe'
904
+ if not path.exists():
905
+ return 'Error: Can not find python executable in '\
906
+ f'"{basepath}"'
903
907
 
904
- if args.python_path:
905
- subpath = path / 'bin' / 'python'
906
- if subpath.exists():
907
- print(subpath)
908
- else:
909
- subpath = path / 'python.exe'
910
- if subpath.exists():
911
- print(subpath)
912
- else:
913
- return f'Error: Can not find python executable in "{path}"'
914
- else:
915
908
  print(path)
916
909
 
917
910
  if __name__ == '__main__':
File without changes
File without changes
File without changes
File without changes
File without changes