From ff5af700cd8f480b93008ae8fc4cddae86ee372a Mon Sep 17 00:00:00 2001 From: Denis NA Date: Thu, 25 Dec 2025 02:51:47 +0100 Subject: [PATCH 1/3] refactor: restructure commands in pyproject.toml for clarity and add descriptions; update artifact naming in CD workflow --- .github/workflows/cd.yml | 2 +- pyproject.toml | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 77445ac..610c158 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -69,7 +69,7 @@ jobs: - name: Upload package to artifact registry uses: actions/upload-artifact@v6 with: - name: uvtask + name: uvtask-${{ env.VERSION }} path: dist/ - name: Publish package diff --git a/pyproject.toml b/pyproject.toml index 2df4e8f..f598520 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,20 +125,23 @@ exclude = [ ] [tool.run-script] -install = "uv sync --frozen --no-dev" -upgrade-install = "uv sync --frozen --no-dev --upgrade --refresh" -dev-install = "uv sync --dev --all-extras" -upgrade-dev-install = "uv sync --dev --all-extras --upgrade --refresh" -code-formatter = "uv run ruff format uvtask tests" -"security-analysis:licenses" = "uv run pip-licenses" -"security-analysis:vulnerabilities" = "uv run bandit -r -c pyproject.toml uvtask tests" -"static-analysis:linter" = "uv run ruff check uvtask tests" -"static-analysis:types" = "uv run ty check uvtask tests" -unit-tests = "uv run pytest tests/unit" -integration-tests = "uv run pytest tests/integration" -functional-tests = "uv run pytest -n1 tests/functional" -coverage = "uv run pytest -n1 --cov --cov-report=html" -clean = """python3 -c " +install = { command = "uv sync --frozen --no-dev", description = "Install dependencies as specified in lockfile, excluding dev dependencies" } +upgrade-install = { command = "uv sync --frozen --no-dev --upgrade --refresh", description = "Upgrade and refresh installation of non-dev dependencies" } +dev-install = { command = "uv sync --dev --all-extras", description = "Install all dependencies including dev and extras" } +upgrade-dev-install = { command = "uv sync --dev --all-extras --upgrade --refresh", description = "Upgrade and refresh installation of all dependencies including dev and extras" } +code-formatter = { command = "ruff format uvtask tests", description = "Format code with ruff" } +"security-analysis" = { command = ["security-analysis:licenses", "security-analysis:vulnerabilities"], description = "Run all security analysis checks" } +"security-analysis:licenses" = { command = "pip-licenses", description = "Check third-party dependencies licenses using pip-licenses" } +"security-analysis:vulnerabilities" = { command = "bandit -r -c pyproject.toml uvtask tests", description = "Scan code for security vulnerabilities using bandit" } +"static-analysis" = { command = ["static-analysis:linter", "static-analysis:types"], description = "Run all static analysis checks" } +"static-analysis:linter" = { command = "ruff check uvtask tests", description = "Run linter checks using ruff" } +"static-analysis:types" = { command = "ty check uvtask tests", description = "Run type checks using ty" } +test = { command = ["unit-tests", "integration-tests", "functional-tests"], description = "Run all tests with pytest" } +unit-tests = { command = "pytest tests/unit", description = "Run unit tests with pytest" } +integration-tests = { command = "pytest tests/integration", description = "Run integration tests with pytest" } +functional-tests = { command = "pytest -n1 tests/functional", description = "Run functional tests with pytest" } +coverage = { command = "pytest -n1 --cov --cov-report=html", description = "Run tests with coverage report in HTML using pytest" } +clean = { command = """python3 -c " from glob import iglob from shutil import rmtree @@ -146,7 +149,7 @@ for pathname in ['./build', './*.egg-info', './dist', './var', '**/__pycache__'] for path in iglob(pathname, recursive=True): rmtree(path, ignore_errors=True) " -""" +""", description = "Clean build artifacts" } [project.scripts] uvtask = "uvtask.cli:main" From ab87e8ca83ecd1c89e972b715020a26d27c6f2ff Mon Sep 17 00:00:00 2001 From: Denis NA Date: Thu, 25 Dec 2025 02:54:47 +0100 Subject: [PATCH 2/3] chore: add future annotations import to multiple modules for improved type hinting --- uvtask/cli.py | 2 ++ uvtask/colors.py | 2 ++ uvtask/commands.py | 2 ++ uvtask/config.py | 2 ++ uvtask/executor.py | 2 ++ uvtask/formatters.py | 2 ++ uvtask/hooks.py | 2 ++ uvtask/parser.py | 2 ++ 8 files changed, 16 insertions(+) diff --git a/uvtask/cli.py b/uvtask/cli.py index fddbce3..b99197a 100644 --- a/uvtask/cli.py +++ b/uvtask/cli.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pathlib import Path from sys import exit, stderr diff --git a/uvtask/colors.py b/uvtask/colors.py index a82a7a2..012b4e2 100644 --- a/uvtask/colors.py +++ b/uvtask/colors.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from enum import StrEnum from os import getenv from sys import argv, stderr diff --git a/uvtask/commands.py b/uvtask/commands.py index e1de628..a81683d 100644 --- a/uvtask/commands.py +++ b/uvtask/commands.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from sys import exit, stderr from uvtask.colors import color_service, preference_manager diff --git a/uvtask/config.py b/uvtask/config.py index 064ed0a..04316b8 100644 --- a/uvtask/config.py +++ b/uvtask/config.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pathlib import Path from tomllib import loads diff --git a/uvtask/executor.py b/uvtask/executor.py index 3b71624..2413c38 100644 --- a/uvtask/executor.py +++ b/uvtask/executor.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import subprocess from subprocess import run from sys import stderr diff --git a/uvtask/formatters.py b/uvtask/formatters.py index 4faae16..e00f072 100644 --- a/uvtask/formatters.py +++ b/uvtask/formatters.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import argparse import re from collections.abc import Iterable diff --git a/uvtask/hooks.py b/uvtask/hooks.py index dd53891..679f9d8 100644 --- a/uvtask/hooks.py +++ b/uvtask/hooks.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from sys import argv, exit, stderr from uvtask.colors import color_service diff --git a/uvtask/parser.py b/uvtask/parser.py index 8cf9399..5b5e860 100644 --- a/uvtask/parser.py +++ b/uvtask/parser.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from sys import argv from uvtask.colors import preference_manager From 754d88126f350188fc61c1c7bccdc5c477775149 Mon Sep 17 00:00:00 2001 From: Denis NA Date: Thu, 25 Dec 2025 03:01:29 +0100 Subject: [PATCH 3/3] feat(*): improve cli, add hooks, add pipeline, improve docs --- README.md | 8 ++++---- pyproject.toml | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 198ab3e..b87328d 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,11 @@ Define your scripts in `pyproject.toml` under the `[tool.run-script]` section: ```toml [tool.run-script] install = "uv sync --dev --all-extras" -format = "ruff format ." -lint = { command = "ruff check .", description = "Check code quality" } -check = ["ty check .", "mypy ."] +format = "uv run ruff format ." +lint = { command = "uv run ruff check .", description = "Check code quality" } +check = ["uv run ty check .", "uv run mypy ."] pre-test = "echo 'Running tests...'" -test = "pytest" +test = "uv run pytest" post-test = "echo 'Tests completed!'" deploy = [ "echo 'Building...'", diff --git a/pyproject.toml b/pyproject.toml index f598520..dde41a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,18 +129,18 @@ install = { command = "uv sync --frozen --no-dev", description = "Install depend upgrade-install = { command = "uv sync --frozen --no-dev --upgrade --refresh", description = "Upgrade and refresh installation of non-dev dependencies" } dev-install = { command = "uv sync --dev --all-extras", description = "Install all dependencies including dev and extras" } upgrade-dev-install = { command = "uv sync --dev --all-extras --upgrade --refresh", description = "Upgrade and refresh installation of all dependencies including dev and extras" } -code-formatter = { command = "ruff format uvtask tests", description = "Format code with ruff" } +code-formatter = { command = "uv run ruff format uvtask tests", description = "Format code with ruff" } "security-analysis" = { command = ["security-analysis:licenses", "security-analysis:vulnerabilities"], description = "Run all security analysis checks" } -"security-analysis:licenses" = { command = "pip-licenses", description = "Check third-party dependencies licenses using pip-licenses" } -"security-analysis:vulnerabilities" = { command = "bandit -r -c pyproject.toml uvtask tests", description = "Scan code for security vulnerabilities using bandit" } +"security-analysis:licenses" = { command = "uv run pip-licenses", description = "Check third-party dependencies licenses using pip-licenses" } +"security-analysis:vulnerabilities" = { command = "uv run bandit -r -c pyproject.toml uvtask tests", description = "Scan code for security vulnerabilities using bandit" } "static-analysis" = { command = ["static-analysis:linter", "static-analysis:types"], description = "Run all static analysis checks" } -"static-analysis:linter" = { command = "ruff check uvtask tests", description = "Run linter checks using ruff" } -"static-analysis:types" = { command = "ty check uvtask tests", description = "Run type checks using ty" } +"static-analysis:linter" = { command = "uv run ruff check uvtask tests", description = "Run linter checks using ruff" } +"static-analysis:types" = { command = "uv run ty check uvtask tests", description = "Run type checks using ty" } test = { command = ["unit-tests", "integration-tests", "functional-tests"], description = "Run all tests with pytest" } -unit-tests = { command = "pytest tests/unit", description = "Run unit tests with pytest" } -integration-tests = { command = "pytest tests/integration", description = "Run integration tests with pytest" } -functional-tests = { command = "pytest -n1 tests/functional", description = "Run functional tests with pytest" } -coverage = { command = "pytest -n1 --cov --cov-report=html", description = "Run tests with coverage report in HTML using pytest" } +unit-tests = { command = "uv run pytest tests/unit", description = "Run unit tests with pytest" } +integration-tests = { command = "uv run pytest tests/integration", description = "Run integration tests with pytest" } +functional-tests = { command = "uv run pytest -n1 tests/functional", description = "Run functional tests with pytest" } +coverage = { command = "uv run pytest -n1 --cov --cov-report=html", description = "Run tests with coverage report in HTML using pytest" } clean = { command = """python3 -c " from glob import iglob from shutil import rmtree