diff --git a/README.md b/README.md index 9b4b2b6..2957161 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,14 @@ An extremely fast Python task runner. +> **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! + ## Highlights - ⚡ **Extremely fast** - Built for speed with zero installation overhead - 📝 **Simple configuration** - Define scripts in `pyproject.toml` - 🔗 **Pre/post hooks** - Automatically run hooks before and after commands -- 🎨 **Beautiful output** - Colorful, `uv`-inspired CLI +- 🎨 **Consistent UX** - Maintains visual and stylistic continuity with `uv`'s design language ## 🎯 Quick Start @@ -27,7 +29,7 @@ Or install it and use it directly: ```shell uv add --dev uvtask -uvtask [COMMAND] +uv run uvtask [COMMAND] ``` ## 📝 Configuration diff --git a/uvtask/config.py b/uvtask/config.py index 04316b8..d3c9a6d 100644 --- a/uvtask/config.py +++ b/uvtask/config.py @@ -1,5 +1,6 @@ from __future__ import annotations +from importlib.metadata import PackageNotFoundError, version from pathlib import Path from tomllib import loads @@ -102,6 +103,12 @@ def get_version(self) -> str: data = self._reader.read() return data.get("project", {}).get("version", "unknown") + def get_package_version(self) -> str: + try: + return version("uvtask") + except PackageNotFoundError: + return "unknown" + pyproject_reader = PyProjectReader(Path("pyproject.toml")) diff --git a/uvtask/parser.py b/uvtask/parser.py index 5b5e860..0d7f452 100644 --- a/uvtask/parser.py +++ b/uvtask/parser.py @@ -92,7 +92,7 @@ def build_main_parser(self) -> CustomArgumentParser: "-V", "--version", action="version", - version=f"%(prog)s {self._version_loader.get_version()}", + version=f"%(prog)s {self._version_loader.get_package_version()}", ) return parser