Skip to content

Commit 3dd23a3

Browse files
authored
docs: update README for clarity on project independence and enhance version retrieval in code (#7)
1 parent e6f11d6 commit 3dd23a3

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88

99
An extremely fast Python task runner.
1010

11+
> **Note:** This is an **independent, third-party project**, not an official Astral tool. It is highly inspired by and designed to work seamlessly with Astral's excellent tools (such as `uv`/`uvx`, `ruff`, and `ty`). We're grateful for the amazing work the Astral team does for the Python ecosystem!
12+
1113
## Highlights
1214

1315
-**Extremely fast** - Built for speed with zero installation overhead
1416
- 📝 **Simple configuration** - Define scripts in `pyproject.toml`
1517
- 🔗 **Pre/post hooks** - Automatically run hooks before and after commands
16-
- 🎨 **Beautiful output** - Colorful, `uv`-inspired CLI
18+
- 🎨 **Consistent UX** - Maintains visual and stylistic continuity with `uv`'s design language
1719

1820
## 🎯 Quick Start
1921

@@ -27,7 +29,7 @@ Or install it and use it directly:
2729

2830
```shell
2931
uv add --dev uvtask
30-
uvtask <OPTIONS> [COMMAND]
32+
uv run uvtask <OPTIONS> [COMMAND]
3133
```
3234

3335
## 📝 Configuration

uvtask/config.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from importlib.metadata import PackageNotFoundError, version
34
from pathlib import Path
45
from tomllib import loads
56

@@ -102,6 +103,12 @@ def get_version(self) -> str:
102103
data = self._reader.read()
103104
return data.get("project", {}).get("version", "unknown")
104105

106+
def get_package_version(self) -> str:
107+
try:
108+
return version("uvtask")
109+
except PackageNotFoundError:
110+
return "unknown"
111+
105112

106113
pyproject_reader = PyProjectReader(Path("pyproject.toml"))
107114

uvtask/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def build_main_parser(self) -> CustomArgumentParser:
9292
"-V",
9393
"--version",
9494
action="version",
95-
version=f"%(prog)s {self._version_loader.get_version()}",
95+
version=f"%(prog)s {self._version_loader.get_package_version()}",
9696
)
9797

9898
return parser

0 commit comments

Comments
 (0)