Skip to content

Commit 1143f8a

Browse files
authored
refactor: restructure commands in pyproject.toml for clarity and add descriptions; update artifact naming in CD workflow (#5)
1 parent f1309c4 commit 1143f8a

11 files changed

Lines changed: 39 additions & 20 deletions

File tree

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: Upload package to artifact registry
7070
uses: actions/upload-artifact@v6
7171
with:
72-
name: uvtask
72+
name: uvtask-${{ env.VERSION }}
7373
path: dist/
7474

7575
- name: Publish package

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ Define your scripts in `pyproject.toml` under the `[tool.run-script]` section:
3737
```toml
3838
[tool.run-script]
3939
install = "uv sync --dev --all-extras"
40-
format = "ruff format ."
41-
lint = { command = "ruff check .", description = "Check code quality" }
42-
check = ["ty check .", "mypy ."]
40+
format = "uv run ruff format ."
41+
lint = { command = "uv run ruff check .", description = "Check code quality" }
42+
check = ["uv run ty check .", "uv run mypy ."]
4343
pre-test = "echo 'Running tests...'"
44-
test = "pytest"
44+
test = "uv run pytest"
4545
post-test = "echo 'Tests completed!'"
4646
deploy = [
4747
"echo 'Building...'",

pyproject.toml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,31 @@ exclude = [
125125
]
126126

127127
[tool.run-script]
128-
install = "uv sync --frozen --no-dev"
129-
upgrade-install = "uv sync --frozen --no-dev --upgrade --refresh"
130-
dev-install = "uv sync --dev --all-extras"
131-
upgrade-dev-install = "uv sync --dev --all-extras --upgrade --refresh"
132-
code-formatter = "uv run ruff format uvtask tests"
133-
"security-analysis:licenses" = "uv run pip-licenses"
134-
"security-analysis:vulnerabilities" = "uv run bandit -r -c pyproject.toml uvtask tests"
135-
"static-analysis:linter" = "uv run ruff check uvtask tests"
136-
"static-analysis:types" = "uv run ty check uvtask tests"
137-
unit-tests = "uv run pytest tests/unit"
138-
integration-tests = "uv run pytest tests/integration"
139-
functional-tests = "uv run pytest -n1 tests/functional"
140-
coverage = "uv run pytest -n1 --cov --cov-report=html"
141-
clean = """python3 -c "
128+
install = { command = "uv sync --frozen --no-dev", description = "Install dependencies as specified in lockfile, excluding dev dependencies" }
129+
upgrade-install = { command = "uv sync --frozen --no-dev --upgrade --refresh", description = "Upgrade and refresh installation of non-dev dependencies" }
130+
dev-install = { command = "uv sync --dev --all-extras", description = "Install all dependencies including dev and extras" }
131+
upgrade-dev-install = { command = "uv sync --dev --all-extras --upgrade --refresh", description = "Upgrade and refresh installation of all dependencies including dev and extras" }
132+
code-formatter = { command = "uv run ruff format uvtask tests", description = "Format code with ruff" }
133+
"security-analysis" = { command = ["security-analysis:licenses", "security-analysis:vulnerabilities"], description = "Run all security analysis checks" }
134+
"security-analysis:licenses" = { command = "uv run pip-licenses", description = "Check third-party dependencies licenses using pip-licenses" }
135+
"security-analysis:vulnerabilities" = { command = "uv run bandit -r -c pyproject.toml uvtask tests", description = "Scan code for security vulnerabilities using bandit" }
136+
"static-analysis" = { command = ["static-analysis:linter", "static-analysis:types"], description = "Run all static analysis checks" }
137+
"static-analysis:linter" = { command = "uv run ruff check uvtask tests", description = "Run linter checks using ruff" }
138+
"static-analysis:types" = { command = "uv run ty check uvtask tests", description = "Run type checks using ty" }
139+
test = { command = ["unit-tests", "integration-tests", "functional-tests"], description = "Run all tests with pytest" }
140+
unit-tests = { command = "uv run pytest tests/unit", description = "Run unit tests with pytest" }
141+
integration-tests = { command = "uv run pytest tests/integration", description = "Run integration tests with pytest" }
142+
functional-tests = { command = "uv run pytest -n1 tests/functional", description = "Run functional tests with pytest" }
143+
coverage = { command = "uv run pytest -n1 --cov --cov-report=html", description = "Run tests with coverage report in HTML using pytest" }
144+
clean = { command = """python3 -c "
142145
from glob import iglob
143146
from shutil import rmtree
144147
145148
for pathname in ['./build', './*.egg-info', './dist', './var', '**/__pycache__']:
146149
for path in iglob(pathname, recursive=True):
147150
rmtree(path, ignore_errors=True)
148151
"
149-
"""
152+
""", description = "Clean build artifacts" }
150153

151154
[project.scripts]
152155
uvtask = "uvtask.cli:main"

uvtask/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from pathlib import Path
24
from sys import exit, stderr
35

uvtask/colors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from enum import StrEnum
24
from os import getenv
35
from sys import argv, stderr

uvtask/commands.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from sys import exit, stderr
24

35
from uvtask.colors import color_service, preference_manager

uvtask/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from pathlib import Path
24
from tomllib import loads
35

uvtask/executor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import subprocess
24
from subprocess import run
35
from sys import stderr

uvtask/formatters.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import argparse
24
import re
35
from collections.abc import Iterable

uvtask/hooks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from sys import argv, exit, stderr
24

35
from uvtask.colors import color_service

0 commit comments

Comments
 (0)