dotlocalslashbin 0.0.8__tar.gz → 0.0.10__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: dotlocalslashbin
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: Download and extract files to `~/.local/bin/`.
5
5
  Author-email: Keith Maxwell <keith.maxwell@gmail.com>
6
6
  Description-Content-Type: text/markdown
@@ -11,7 +11,10 @@ Requires-Dist: codespell ; extra == "test"
11
11
  Requires-Dist: flit ; extra == "test"
12
12
  Requires-Dist: mypy ; extra == "test"
13
13
  Requires-Dist: nox ; extra == "test"
14
+ Requires-Dist: pytest ; extra == "test"
15
+ Requires-Dist: reuse ; extra == "test"
14
16
  Requires-Dist: ruff ; extra == "test"
17
+ Requires-Dist: twine ; extra == "test"
15
18
  Requires-Dist: usort ; extra == "test"
16
19
  Project-URL: Home, https://github.com/maxwell-k/dotlocalslashbin/
17
20
  Provides-Extra: test
@@ -43,12 +46,27 @@ Optionally can:
43
46
  \* if the URL is an absolute path on the local file system; it is not downloaded
44
47
  to the cache.
45
48
 
49
+ [uv]: https://github.com/astral-sh/uv
46
50
  [TOML]: https://en.wikipedia.org/wiki/TOML
47
51
 
52
+ ## Installation
53
+
54
+ The recommended way to run `dotlocalslashbin` is with [uv].
55
+
56
+ Command to install the latest released `dotlocalslashbin` from PyPI:
57
+
58
+ uv tool install dotlocalslashbin
59
+
60
+ Command to run latest development version of `dotlocalslashbin` directly from
61
+ GitHub:
62
+
63
+ uv run https://raw.githubusercontent.com/maxwell-k/dotfiles/refs/heads/main/dotlocalslashbin.py --help
64
+
48
65
  ## Examples
49
66
 
50
67
  For example to download `yq` to the current working directory, first save the
51
- following as `yq.toml`, then run the command below:
68
+ following as `yq.toml`, then install with uv (above) and then run the command
69
+ below:
52
70
 
53
71
  ```
54
72
  [yq]
@@ -25,12 +25,27 @@ Optionally can:
25
25
  \* if the URL is an absolute path on the local file system; it is not downloaded
26
26
  to the cache.
27
27
 
28
+ [uv]: https://github.com/astral-sh/uv
28
29
  [TOML]: https://en.wikipedia.org/wiki/TOML
29
30
 
31
+ ## Installation
32
+
33
+ The recommended way to run `dotlocalslashbin` is with [uv].
34
+
35
+ Command to install the latest released `dotlocalslashbin` from PyPI:
36
+
37
+ uv tool install dotlocalslashbin
38
+
39
+ Command to run latest development version of `dotlocalslashbin` directly from
40
+ GitHub:
41
+
42
+ uv run https://raw.githubusercontent.com/maxwell-k/dotfiles/refs/heads/main/dotlocalslashbin.py --help
43
+
30
44
  ## Examples
31
45
 
32
46
  For example to download `yq` to the current working directory, first save the
33
- following as `yq.toml`, then run the command below:
47
+ following as `yq.toml`, then install with uv (above) and then run the command
48
+ below:
34
49
 
35
50
  ```
36
51
  [yq]
@@ -26,7 +26,10 @@ test = [
26
26
  "flit",
27
27
  "mypy",
28
28
  "nox",
29
+ "pytest",
30
+ "reuse",
29
31
  "ruff",
32
+ "twine",
30
33
  "usort",
31
34
  ]
32
35
 
@@ -38,13 +41,10 @@ target-version = "py312"
38
41
  [tool.ruff.lint]
39
42
  select = ["ALL"]
40
43
  ignore = [
41
- # "C901", # TODO
42
44
  "D203", # incompatible with D211
43
45
  "D213", # incompatible with D212
44
46
  "I", # prefer usort to ruff isort implementation
45
- # "PLR0912", # TODO
46
- # "PLR0913", # TODO
47
- # "PLR0915", # TODO
47
+ "PT", # prefer unittest style
48
48
  "S310", # the rule errors on the "use instead" code from `ruff rule S310`
49
49
  "S602", # assume arguments to subprocess.run are validated
50
50
  "S603", # assume trusted input to subprocess.run
@@ -2,6 +2,10 @@
2
2
  # src/dotlocalslashbin.py
3
3
  # Copyright 2022 Keith Maxwell
4
4
  # SPDX-License-Identifier: MPL-2.0
5
+ # /// script
6
+ # requires-python = ">=3.11"
7
+ # dependencies = []
8
+ # ///
5
9
  """Download and extract files to `~/.local/bin/`."""
6
10
  import tarfile
7
11
  from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
@@ -19,9 +23,9 @@ from urllib.request import urlopen
19
23
  from zipfile import ZipFile
20
24
 
21
25
 
22
- __version__ = "0.0.8"
26
+ __version__ = "0.0.10"
23
27
 
24
- DEFAULT_OUTPUT = Path("~/.local/bin/")
28
+ _OUTPUT = Path("~/.local/bin/")
25
29
  _SHA512_LENGTH = 128
26
30
 
27
31
 
@@ -84,7 +88,7 @@ def main() -> int:
84
88
  print(f"Error {e.code} downloading {e.url}")
85
89
  return 1
86
90
 
87
- arg0 = item.name if args.output == DEFAULT_OUTPUT else str(item.target)
91
+ arg0 = item.name if args.output == _OUTPUT else str(item.target.absolute())
88
92
  print(" ".join(("#" if item.version else "$", arg0, item.version or "")))
89
93
  if item.version:
90
94
  run([arg0, item.version], check=True)
@@ -135,7 +139,7 @@ def _parse_args() -> _CustomNamespace:
135
139
  help_ = "TOML specification"
136
140
  parser.add_argument("--input", default="bin.toml", help=help_, type=Path)
137
141
  help_ = "Target directory"
138
- parser.add_argument("--output", default=DEFAULT_OUTPUT, help=help_, type=Path)
142
+ parser.add_argument("--output", default=_OUTPUT, help=help_, type=Path)
139
143
  help_ = "Output directory"
140
144
  default = "~/.cache/dotlocalslashbin/"
141
145
  parser.add_argument("--downloaded", default=default, help=help_, type=Path)