5bb-task 3.42.1__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.
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: 5bb-task
3
+ Version: 3.42.1
4
+ Summary: Task – a task runner / simpler Make alternative, packaged for easy installation via pip/uv
5
+ Project-URL: Homepage, https://github.com/5-bare-bones/toolbox__monorepo
6
+ Project-URL: Source, https://github.com/go-task/task
7
+ License: MIT
8
+ Keywords: automation,cli,make,task,taskfile
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Build Tools
16
+ Classifier: Topic :: Utilities
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+
20
+ # 5bb-task
21
+
22
+ > **task** – a task runner / simpler Make alternative from [Taskfile.dev](https://taskfile.dev), distributed via PyPI/uv.
23
+
24
+ This package downloads and installs the [`task`](https://github.com/go-task/task) binary for your platform on first use. No compilation required.
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ uv tool install 5bb-task
30
+ # or
31
+ pip install 5bb-task
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```bash
37
+ task --list # list all available tasks
38
+ task build # run the 'build' task
39
+ task test # run the 'test' task
40
+ ```
41
+
42
+ The binary is downloaded from the official GitHub releases on first run and cached in `~/.cache/5bb-task/`.
43
+
44
+ ## Configuration
45
+
46
+ Set `BB_CACHE_DIR` to override the cache location:
47
+
48
+ ```bash
49
+ BB_CACHE_DIR=/opt/tools task build
50
+ ```
51
+
52
+ ## License
53
+
54
+ MIT – see the [LICENSE](../../LICENSE) file for details.
@@ -0,0 +1,5 @@
1
+ bb_task/__init__.py,sha256=g8SsVXhcYBWqO65k2hNcq_myAXfHngxrYdHNTo06Ims,3815
2
+ 5bb_task-3.42.1.dist-info/METADATA,sha256=o0XoLGeqqdWmP9oF9-qXcFLngQqVH-INXzsDvBWI_H8,1574
3
+ 5bb_task-3.42.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
4
+ 5bb_task-3.42.1.dist-info/entry_points.txt,sha256=vunWO3m01d-YtoDrPXe98JOOqwO1ix7qjbt1VheCKPI,37
5
+ 5bb_task-3.42.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ task = bb_task:run
bb_task/__init__.py ADDED
@@ -0,0 +1,129 @@
1
+ """
2
+ bb_task – thin Python wrapper around ``task``, the task runner from
3
+ Taskfile.dev (a simpler Make alternative written in Go).
4
+
5
+ On first use the appropriate pre-built binary is downloaded from the
6
+ official GitHub release page and cached in ``~/.cache/5bb-task/``.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import platform
13
+ import stat
14
+ import subprocess
15
+ import sys
16
+ import tarfile
17
+ import urllib.request
18
+ from pathlib import Path
19
+
20
+ __version__ = "3.49.1"
21
+ _TASK_VERSION = __version__
22
+
23
+ # ---------------------------------------------------------------------------
24
+ # Platform detection helpers
25
+ # ---------------------------------------------------------------------------
26
+
27
+ def _arch() -> str:
28
+ machine = platform.machine().lower()
29
+ if machine in ("x86_64", "amd64"):
30
+ return "amd64"
31
+ if machine in ("i386", "i686"):
32
+ return "386"
33
+ if machine in ("aarch64", "arm64"):
34
+ return "arm64"
35
+ if machine.startswith("arm"):
36
+ return "arm"
37
+ return machine
38
+
39
+
40
+ def _os_name() -> str:
41
+ system = platform.system().lower()
42
+ if system == "darwin":
43
+ return "darwin"
44
+ if system == "windows":
45
+ return "windows"
46
+ return "linux"
47
+
48
+
49
+ def _binary_name() -> str:
50
+ return "task.exe" if platform.system().lower() == "windows" else "task"
51
+
52
+
53
+ def _asset_name() -> str:
54
+ ext = "zip" if platform.system().lower() == "windows" else "tar.gz"
55
+ return f"task_{_os_name()}_{_arch()}.{ext}"
56
+
57
+
58
+ def _download_url() -> str:
59
+ return (
60
+ f"https://github.com/go-task/task/releases/download"
61
+ f"/v{_TASK_VERSION}/{_asset_name()}"
62
+ )
63
+
64
+
65
+ # ---------------------------------------------------------------------------
66
+ # Binary management
67
+ # ---------------------------------------------------------------------------
68
+
69
+ def _cache_dir() -> Path:
70
+ return Path(os.environ.get("BB_CACHE_DIR", Path.home() / ".cache")) / "5bb-task"
71
+
72
+
73
+ def _binary_path() -> Path:
74
+ return _cache_dir() / _binary_name()
75
+
76
+
77
+ def ensure_binary() -> Path:
78
+ """Return the path to the task binary, downloading it if necessary."""
79
+ binary = _binary_path()
80
+ if binary.exists():
81
+ return binary
82
+
83
+ binary.parent.mkdir(parents=True, exist_ok=True)
84
+ url = _download_url()
85
+ asset_name = _asset_name()
86
+ tmp_archive = binary.parent / asset_name
87
+
88
+ print(f"[5bb-task] Downloading task v{_TASK_VERSION} …", file=sys.stderr)
89
+ try:
90
+ urllib.request.urlretrieve(url, tmp_archive) # noqa: S310
91
+ except Exception as exc: # pragma: no cover
92
+ raise SystemExit(
93
+ f"[5bb-task] Failed to download {url}: {exc}"
94
+ ) from exc
95
+
96
+ if asset_name.endswith(".tar.gz"):
97
+ with tarfile.open(tmp_archive, "r:gz") as tar:
98
+ for member in tar.getmembers():
99
+ if member.name == _binary_name() or member.name.endswith(
100
+ f"/{_binary_name()}"
101
+ ):
102
+ member.name = _binary_name()
103
+ tar.extract(member, binary.parent) # noqa: S202
104
+ break
105
+ else:
106
+ # Windows .zip
107
+ import zipfile
108
+
109
+ with zipfile.ZipFile(tmp_archive, "r") as zf:
110
+ zf.extract(_binary_name(), binary.parent)
111
+
112
+ tmp_archive.unlink(missing_ok=True)
113
+
114
+ # Ensure the binary is executable.
115
+ binary.chmod(binary.stat().st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
116
+ return binary
117
+
118
+
119
+ # ---------------------------------------------------------------------------
120
+ # Entry point
121
+ # ---------------------------------------------------------------------------
122
+
123
+ def run() -> None:
124
+ """CLI entry point – delegates all arguments to the task binary."""
125
+ binary = ensure_binary()
126
+ args = [str(binary)] + sys.argv[1:]
127
+ if platform.system().lower() == "windows":
128
+ sys.exit(subprocess.call(args))
129
+ os.execv(str(binary), args)