pystand 2.1__py3-none-any.whl → 2.3__py3-none-any.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pystand
3
- Version: 2.1
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] [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 version to return path for, or latest installed version
290
- if not specified
289
+ version version number to show path for
291
290
 
292
291
  options:
293
292
  -h, --help show this help message and exit
294
- -p, --python-path return full path to python executable
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
@@ -0,0 +1,6 @@
1
+ pystand.py,sha256=3T4RUzfjXZUeKkgOlObw7vD4_DwZXqveouQT61y1O30,33019
2
+ pystand-2.3.dist-info/METADATA,sha256=TsiLEZYSRV9HPdFQOyPYlqoNG-mQ9kvuU8hLJ1ZwhIM,18759
3
+ pystand-2.3.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
4
+ pystand-2.3.dist-info/entry_points.txt,sha256=DG4ps3I3nni1bubV1tXs6u8FARgkdbAYaEAzZD4RAo8,41
5
+ pystand-2.3.dist-info/top_level.txt,sha256=NoWUh19UQymAJLHTCdxMnVwV6Teftef5fzyF3OWLyNY,8
6
+ pystand-2.3.dist-info/RECORD,,
pystand.py CHANGED
@@ -361,7 +361,7 @@ def update_version_symlinks(args: Namespace) -> None:
361
361
  oldlinks = {}
362
362
  vers = []
363
363
  for path in base.iterdir():
364
- if not path.name.startswith('.'):
364
+ if path.name[0] != '.' and path.name[0].isdigit():
365
365
  if path.is_symlink():
366
366
  oldlinks[path.name] = os.readlink(str(path))
367
367
  else:
@@ -604,8 +604,8 @@ def main() -> str | None:
604
604
  'using -D/--distribution option.')
605
605
 
606
606
  # Keep some useful info in the namespace passed to the command
607
- prefix_dir = Path(args.prefix_dir).expanduser()
608
- cache_dir = Path(args.cache_dir).expanduser()
607
+ prefix_dir = Path(args.prefix_dir).expanduser().resolve()
608
+ cache_dir = Path(args.cache_dir).expanduser().resolve()
609
609
 
610
610
  args._distribution = distribution
611
611
  args._data = f'{PROG}.json'
@@ -871,33 +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='return full path to python executable')
875
- parser.add_argument('version', nargs='?',
876
- help='version to return path for, or latest '
877
- 'installed version if not specified')
874
+ help='add path to python executable')
875
+ parser.add_argument('-r', '--resolve', action='store_true',
876
+ help='fully resolve given version')
877
+ group = parser.add_mutually_exclusive_group()
878
+ group.add_argument('-c', '--cache-path', action='store_true',
879
+ help='just show path to cache dir')
880
+ group.add_argument('version', nargs='?',
881
+ help='version number to show path for')
878
882
 
879
883
  @staticmethod
880
884
  def run(args: Namespace) -> str | None:
881
- matcher = VersionMatcher([f.name for f in iter_versions(args)])
882
- version = matcher.match(args.version) or args.version
883
- if not version:
884
- return 'No Python version installed.'
885
-
886
- path = args._versions / version
887
- if not path.is_dir():
888
- return f'Version "{version}" is not installed.'
885
+ version = args.version
886
+ if args.cache_path or not version:
887
+ if args.python_path:
888
+ args.parser.error('Can not specify --python-path.')
889
889
 
890
- if args.python_path:
891
- subpath = path / 'bin' / 'python'
892
- if subpath.exists():
893
- print(subpath)
894
- else:
895
- subpath = path / 'python.exe'
896
- if subpath.exists():
897
- print(subpath)
898
- else:
899
- return f'Error: Can not find python executable in "{path}"'
890
+ print(args._downloads.parent if args.cache_path else args._versions)
900
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.'
895
+
896
+ if args.resolve:
897
+ path = path.resolve()
898
+
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}"'
907
+
901
908
  print(path)
902
909
 
903
910
  if __name__ == '__main__':
@@ -1,6 +0,0 @@
1
- pystand.py,sha256=x6qijPBLaKWX0BxlbQyKa3_N20dWnbSCGvBSfflEczU,32597
2
- pystand-2.1.dist-info/METADATA,sha256=d79DfUbvnmHlCFkUDHYSxJwQDGJTDFMT_nmNx1Wu7yI,17403
3
- pystand-2.1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
4
- pystand-2.1.dist-info/entry_points.txt,sha256=DG4ps3I3nni1bubV1tXs6u8FARgkdbAYaEAzZD4RAo8,41
5
- pystand-2.1.dist-info/top_level.txt,sha256=NoWUh19UQymAJLHTCdxMnVwV6Teftef5fzyF3OWLyNY,8
6
- pystand-2.1.dist-info/RECORD,,
File without changes