pystand 1.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.
pystand-1.0/.flake8 ADDED
@@ -0,0 +1,3 @@
1
+ [flake8]
2
+ ignore = E126,E127,E128,E302,E305,W503,C901
3
+ max-line-length = 80
pystand-1.0/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ build/
2
+ .env
3
+ dist/
4
+ __pycache__/
5
+ .idea/
6
+ .vscode/
7
+ *.egg-info/
8
+ *.pyc
9
+ *~
pystand-1.0/Makefile ADDED
@@ -0,0 +1,21 @@
1
+ NAME = $(shell basename $(CURDIR))
2
+ PYNAME = $(subst -,_,$(NAME))
3
+
4
+ check:
5
+ ruff check *.py
6
+ flake8 *.py
7
+ mypy *.py
8
+ vermin -vv --no-tips -i *.py
9
+
10
+ build:
11
+ rm -rf dist
12
+ python3 -m build
13
+
14
+ upload: build
15
+ twine3 upload dist/*
16
+
17
+ doc:
18
+ update-readme-usage
19
+
20
+ clean:
21
+ @rm -vrf *.egg-info .venv/ build/ dist/ __pycache__ */__pycache__
pystand-1.0/PKG-INFO ADDED
@@ -0,0 +1,361 @@
1
+ Metadata-Version: 2.1
2
+ Name: pystand
3
+ Version: 1.0
4
+ Summary: Install Python versions from python-build-standalone project
5
+ Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
6
+ License: GPLv3
7
+ Project-URL: Homepage, https://github.com/bulletmark/pystand
8
+ Keywords: python-build-standalone,pyenv,hatch,pdm
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: argcomplete
13
+ Requires-Dist: packaging
14
+ Requires-Dist: platformdirs
15
+ Requires-Dist: pygithub
16
+
17
+ ## PYSTAND - Install Python Versions From The Python-Build-Standalone Project
18
+ [![PyPi](https://img.shields.io/pypi/v/pystand)](https://pypi.org/project/pystand/)
19
+ [![AUR](https://img.shields.io/aur/version/pystand)](https://aur.archlinux.org/packages/pystand/)
20
+
21
+ [`pystand`][pystand] is a command line tool to facilitate the
22
+ installation and update of pre-built Python versions from the
23
+ [`python-build-standalone`][pbs] project. The following commands are
24
+ provided:
25
+
26
+ |Command |Description |
27
+ |---------|----------------------------------------------------------------------|
28
+ |`install`|Install one or more versions from a python-build-standalone release |
29
+ |`update` |Update one, more, or all versions to another release |
30
+ |`remove` |Remove/uninstall one, more, or all versions |
31
+ |`list` |List installed versions and show which have an update available |
32
+ |`show` |Show versions available from a release |
33
+ |`path` |Show path prefix to installed version base directory |
34
+
35
+ By default, Python versions are sourced from the latest
36
+ `python-build-standalone` [release][pbs-rel] available but you can
37
+ optionally specify any older release. The required
38
+ [distribution](https://gregoryszorc.com/docs/python-build-standalone/main/running.html)
39
+ for your machine architecture is normally auto-detected but can be
40
+ overridden if required.
41
+
42
+ Some simple usage examples are:
43
+
44
+ ```sh
45
+ $ pystand install 3.12
46
+ Version 3.12.3 @ 20240415 installed.
47
+
48
+ $ ls -l $(pystand path 3.12)/bin
49
+ total 4136
50
+ lrwxrwxrwx 1 user user 9 May 30 22:23 2to3 -> 2to3-3.12
51
+ -rwxrwxr-x 1 user user 128 Jan 1 10:00 2to3-3.12
52
+ lrwxrwxrwx 1 user user 8 May 30 22:23 idle3 -> idle3.12
53
+ -rwxrwxr-x 1 user user 126 Jan 1 10:00 idle3.12
54
+ -rwxrwxr-x 1 user user 256 Jan 1 10:00 pip
55
+ -rwxrwxr-x 1 user user 256 Jan 1 10:00 pip3
56
+ -rwxrwxr-x 1 user user 256 Jan 1 10:00 pip3.12
57
+ lrwxrwxrwx 1 user user 9 May 30 22:23 pydoc3 -> pydoc3.12
58
+ -rwxrwxr-x 1 user user 111 Jan 1 10:00 pydoc3.12
59
+ lrwxrwxrwx 1 user user 10 May 30 22:23 python -> python3.12
60
+ lrwxrwxrwx 1 user user 10 May 30 22:23 python3 -> python3.12
61
+ -rwxrwxr-x 1 user user 4206512 Jan 1 10:00 python3.12
62
+ -rwxrwxr-x 1 user user 3078 Jan 1 10:00 python3.12-config
63
+ lrwxrwxrwx 1 user user 17 May 30 22:23 python3-config -> python3.12-config
64
+
65
+ $ pystand install 3.10
66
+ Version 3.10.14 @ 20240415 installed.
67
+
68
+ $ pystand list
69
+ 3.10.14 @ 20240415 distribution="x86_64-unknown-linux-gnu"
70
+ 3.12.3 @ 20240415 distribution="x86_64-unknown-linux-gnu"
71
+
72
+ $ pystand show
73
+ 3.8.19 @ 20240415 distribution="x86_64-unknown-linux-gnu"
74
+ 3.9.19 @ 20240415 distribution="x86_64-unknown-linux-gnu"
75
+ 3.10.14 @ 20240415 distribution="x86_64-unknown-linux-gnu" (installed)
76
+ 3.11.9 @ 20240415 distribution="x86_64-unknown-linux-gnu"
77
+ 3.12.3 @ 20240415 distribution="x86_64-unknown-linux-gnu" (installed)
78
+
79
+ $ pystand remove 3.10
80
+ Version 3.10.14 @ 20240415 removed.
81
+
82
+ $ pystand list
83
+ 3.12.3 @ 20240415 distribution="x86_64-unknown-linux-gnu"
84
+ ```
85
+
86
+ Here are some examples showing how to use an installed version ..
87
+
88
+ ```sh
89
+ # Use uv to create a virtual environment to be run with pystand installed python:
90
+ $ uv venv -p $(pystand path 3.12) myenv
91
+
92
+ # Create a regular virtual environment to be run with pystand installed python:
93
+ $ $(pystand path -p 3.12) -m venv myenv
94
+
95
+ # Use pipx to install a package to be run with pystand installed python:
96
+ $ pipx install --python $(pystand path -p 3.12) cowsay
97
+ ```
98
+
99
+ See detailed usage information in the [Usage](#usage) section that
100
+ follows.
101
+
102
+ Note that unlike nearly all similar tools such as [`pyenv`][pyenv], [`pdm
103
+ python`][pdmpy], and [`hatch python`][hatchpy], `pystand` directly
104
+ checks the [`python-build-standalone`][pbs] github site to fetch for new
105
+ [releases][pbs-rel] but those other tools require a software update
106
+ before they can see new releases. This means that Python updates are
107
+ available more quickly from `pystand` than other tools.
108
+
109
+ This utility has been developed and tested on Linux but should also work
110
+ on macOS and Windows although has not been tried on those platforms. The
111
+ latest documentation and code is available at
112
+ https://github.com/bulletmark/pystand.
113
+
114
+ ## Usage
115
+
116
+ Type `pystand` or `pystand -h` to view the usage summary:
117
+
118
+ ```
119
+ usage: pystand [-h] [-D DISTRIBUTION] [-B BASE_DIR] [-C CACHE_MINUTES]
120
+ [--purge-days PURGE_DAYS] [-V]
121
+ {install,update,remove,list,show,path} ...
122
+
123
+ Command line tool to install pre-built Python versions from the python-build-
124
+ standalone project.
125
+
126
+ options:
127
+ -h, --help show this help message and exit
128
+ -D DISTRIBUTION, --distribution DISTRIBUTION
129
+ python-build-standalone "*-install_only" distribution,
130
+ e.g. "x86_64-unknown-linux-gnu". Default is auto-
131
+ detected (detected as "x86_64-unknown-linux-gnu" for
132
+ this current host).
133
+ -B BASE_DIR, --base-dir BASE_DIR
134
+ specify pystand base dir for storing versions and
135
+ metadata. Default is "$HOME/.local/share/pystand"
136
+ -C CACHE_MINUTES, --cache-minutes CACHE_MINUTES
137
+ cache latest release tag fetch for this many minutes,
138
+ before rechecking for latest. Default is 60 minutes
139
+ --purge-days PURGE_DAYS
140
+ cache release file lists for this number of days after
141
+ last version referencing it is removed. Default is 30
142
+ days
143
+ -V show pystand version
144
+
145
+ Commands:
146
+ {install,update,remove,list,show,path}
147
+ install Install one or more versions from a python-build-
148
+ standalone release.
149
+ update Update one, more, or all versions to another release.
150
+ remove Remove/uninstall one, more, or all versions.
151
+ list List installed versions and show which have an update
152
+ available.
153
+ show Show versions available from a release.
154
+ path Show path prefix to installed version base directory.
155
+
156
+ Note you can set default starting global options in
157
+ $HOME/.config/pystand-flags.conf.
158
+ ```
159
+
160
+ Type `pystand <command> -h` to see specific help/usage for any
161
+ individual command:
162
+
163
+ ### Command `install`
164
+
165
+ ```
166
+ usage: pystand install [-h] [-r RELEASE] [-f] version [version ...]
167
+
168
+ Install one or more versions from a python-build-standalone release.
169
+
170
+ positional arguments:
171
+ version version to install. E.g. 3.12 or 3.12.3
172
+
173
+ options:
174
+ -h, --help show this help message and exit
175
+ -r RELEASE, --release RELEASE
176
+ install from specified python-build-standalone release
177
+ (e.g. 20240415), default is latest release
178
+ -f, --force force install even if already installed
179
+ ```
180
+
181
+ ### Command `update`
182
+
183
+ ```
184
+ usage: pystand update [-h] [-r RELEASE] [-a] [--skip] [version ...]
185
+
186
+ Update one, more, or all versions to another release.
187
+
188
+ positional arguments:
189
+ version version to update (or to skip for --all --skip)
190
+
191
+ options:
192
+ -h, --help show this help message and exit
193
+ -r RELEASE, --release RELEASE
194
+ update to specified release (e.g. 20240415), default
195
+ is latest release
196
+ -a, --all update ALL versions
197
+ --skip skip the specified versions when updating all (only
198
+ can be specified with --all)
199
+ ```
200
+
201
+ ### Command `remove`
202
+
203
+ ```
204
+ usage: pystand remove [-h] [-a] [--skip] [-r RELEASE] [version ...]
205
+
206
+ Remove/uninstall one, more, or all versions.
207
+
208
+ positional arguments:
209
+ version version to remove (or to skip for --all --skip)
210
+
211
+ options:
212
+ -h, --help show this help message and exit
213
+ -a, --all remove ALL versions
214
+ --skip skip the specified versions when removing all (only
215
+ can be specified with --all)
216
+ -r RELEASE, --release RELEASE
217
+ only remove versions if from specified release (e.g.
218
+ 20240415)
219
+ ```
220
+
221
+ ### Command `list`
222
+
223
+ ```
224
+ usage: pystand list [-h] [-v] [-r RELEASE] [version ...]
225
+
226
+ List installed versions and show which have an update available.
227
+
228
+ positional arguments:
229
+ version only list specified version, else all
230
+
231
+ options:
232
+ -h, --help show this help message and exit
233
+ -v, --verbose explicitly report why a version is not eligible for
234
+ update
235
+ -r RELEASE, --release RELEASE
236
+ use specified release (e.g. 20240415) for verbose
237
+ compare, default is latest release
238
+ ```
239
+
240
+ ### Command `show`
241
+
242
+ ```
243
+ usage: pystand show [-h] [-d] [release]
244
+
245
+ Show versions available from a release.
246
+
247
+ positional arguments:
248
+ release python-build-standalone release to show (e.g.
249
+ 20240415), default is latest release
250
+
251
+ options:
252
+ -h, --help show this help message and exit
253
+ -d, --distributions also show all available distributions for each version
254
+ from the release
255
+ ```
256
+
257
+ ### Command `path`
258
+
259
+ ```
260
+ usage: pystand path [-h] [-p] version
261
+
262
+ Show path prefix to installed version base directory.
263
+
264
+ positional arguments:
265
+ version version to return path for
266
+
267
+ options:
268
+ -h, --help show this help message and exit
269
+ -p, --python-path return full path to python executable
270
+ ```
271
+
272
+ ## Installation and Upgrade
273
+
274
+ Python 3.8 or later is required. Arch Linux users can install [`pystand`
275
+ from the AUR](https://aur.archlinux.org/packages/pystand) and skip this
276
+ section.
277
+
278
+ The easiest way to install [`pystand`][pystand] is to use [`pipx`][pipx]
279
+ (or [`pipxu`][pipxu]).
280
+
281
+ ```sh
282
+ $ pipx install pystand
283
+ ```
284
+
285
+ To upgrade:
286
+
287
+ ```sh
288
+ $ pipx upgrade pystand
289
+ ```
290
+
291
+ To uninstall:
292
+
293
+ ```sh
294
+ $ pipx uninstall pystand
295
+ ```
296
+
297
+ ## Extrapolation of Python Versions
298
+
299
+ `pystand` extrapolates any version text you specify on the command line
300
+ to the latest available corresponding installed or release version. For
301
+ example, if you specify `pystand install 3.12` then `pystand` will look
302
+ in the release files to find the latest (i.e. highest) available
303
+ version of `3.12`, e.g. `3.12.3` (at the time of writing), and will install
304
+ that. Of course you can specify the exact version if you wish, e.g.
305
+ `3.12.3` but generally you don't need to bother. This is true for any
306
+ command that takes a version argument so be aware that this may be
307
+ confusing if there are multiple same Python minor versions, e.g.
308
+ `3.12.1` and `3.12.3`, installed from different releases. So in that
309
+ case you should specify the exact version because e.g. `pystand remove
310
+ 3.12` will remove `3.12.3` which may not be what you want.
311
+
312
+ Note, consistent with this, you actually don't need to specify a
313
+ minor version, e.g. `pystand install 3` would also install `3.12.3`
314
+ (assuming `3.12.3` is the latest available version for Python 3).
315
+
316
+ ## Command Default Options
317
+
318
+ You can add default global options to a personal configuration file
319
+ `~/.config/pystand-flags.conf`. If that file exists then each line of
320
+ options will be concatenated and automatically prepended to your
321
+ `pystand` command line arguments. Comments in the file (i.e. `#` and
322
+ anything after on a line) are ignored. Type `pystand` to see all
323
+ supported options.
324
+
325
+ The global options: `--distribution`, `--base-dir`, `--cache-minutes`,
326
+ `--purge-days` are the only sensible candidates to consider setting as
327
+ defaults.
328
+
329
+ ## Command Line Tab Completion
330
+
331
+ Command line shell [tab
332
+ completion](https://en.wikipedia.org/wiki/Command-line_completion) is
333
+ automatically enabled on `pystand` commands and options using
334
+ [`argcomplete`](https://github.com/kislyuk/argcomplete). You may need to
335
+ first (once-only) [activate argcomplete global
336
+ completion](https://github.com/kislyuk/argcomplete#global-completion).
337
+
338
+ ## License
339
+
340
+ Copyright (C) 2024 Mark Blakeney. This program is distributed under the
341
+ terms of the GNU General Public License. This program is free software:
342
+ you can redistribute it and/or modify it under the terms of the GNU
343
+ General Public License as published by the Free Software Foundation,
344
+ either version 3 of the License, or any later version. This program is
345
+ distributed in the hope that it will be useful, but WITHOUT ANY
346
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
347
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at
348
+ <http://www.gnu.org/licenses/> for more details.
349
+
350
+ [pystand]: https://github.com/bulletmark/pystand
351
+ [pbs]: https://github.com/indygreg/python-build-standalone
352
+ [pbs-rel]: https://github.com/indygreg/python-build-standalone/releases
353
+ [pipx]: https://github.com/pypa/pipx
354
+ [pipxu]: https://github.com/bulletmark/pipxu
355
+ [pyenv]: https://github.com/pyenv/pyenv
356
+ [pdm]: https://pdm-project.org/
357
+ [pdmpy]: https://pdm-project.org/en/latest/usage/project/#install-python-interpreters-with-pdm
358
+ [hatch]: https://hatch.pypa.io/
359
+ [hatchpy]: https://hatch.pypa.io/latest/tutorials/python/manage/
360
+
361
+ <!-- vim: se ai syn=markdown: -->