You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: modularize CLI architecture and add hooks support
This commit represents a major architectural refactoring of uvtask,
transforming the monolithic CLI implementation into a modular, testable
architecture while adding new features and infrastructure improvements.
- **Modularize CLI**: Split `cli.py` (847 lines) into focused modules:
- `colors.py`: Color management and terminal output formatting
- `commands.py`: Command execution and script loading
- `config.py`: Configuration parsing and pyproject.toml handling
- `executor.py`: Command execution with quiet/verbose support
- `formatters.py`: Custom argparse formatters and help text processing
- `hooks.py`: Pre/post hook discovery and validation
- `parser.py`: Argument parsing and CLI builder
- **Improved separation of concerns**: Each module has a single, well-defined
responsibility, making the codebase more maintainable and testable
- **Hooks support**: Added pre/post hook functionality supporting both
Composer-style (`pre-{command}`, `post-{command}`) and NPM-style
(`pre{command}`, `post{command}`) naming conventions
- Automatic hook discovery and execution
- Style consistency validation (prevents mixing styles)
- `--no-hooks` and `--ignore-scripts` flags to skip hooks
- **CI/CD pipelines**: Added GitHub Actions workflows
- `ci.yml`: Continuous integration with linting, type checking, and tests
- `cd.yml`: Continuous deployment with automated versioning and publishing
- **Comprehensive unit tests**: Added test coverage for all new modules:
- `test_cli.py`: CLI integration tests
- `test_commands.py`: Command execution tests
- `test_config.py`: Configuration parsing tests
- `test_executor.py`: Command executor tests
- `test_formatters.py`: Help formatter tests
- `test_hooks.py`: Hook discovery and validation tests
- `test_parser.py`: Argument parser tests
- **Updated README**: Enhanced documentation with hooks examples and
improved quick start guide
- Updated `ty` package from 0.0.6 to 0.0.7
This refactoring maintains backward compatibility while significantly
improving code quality, testability, and maintainability.
**uvtask** is a modern, fast, and flexible Python task runner and test automation tool designed to simplify development workflows. It supports running, organizing, and managing tasks or tests in Python projects with an emphasis on ease of use and speed. ⚡
9
+
An extremely fast Python task runner.
10
+
11
+
## Highlights
12
+
13
+
- ⚡ **Extremely fast** - Built for speed with zero installation overhead
14
+
- 📝 **Simple configuration** - Define scripts in `pyproject.toml`
15
+
- 🔗 **Pre/post hooks** - Automatically run hooks before and after commands
Copy file name to clipboardExpand all lines: pyproject.toml
+33-37Lines changed: 33 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,10 @@
1
1
[build-system]
2
-
build-backend = "setuptools.build_meta"
3
-
requires = ["setuptools"]
2
+
requires = ["uv_build"]
3
+
build-backend = "uv_build"
4
+
5
+
[tool.uv.build-backend]
6
+
module-name = "uvtask"
7
+
module-root = ""
4
8
5
9
[project]
6
10
authors = [
@@ -27,8 +31,8 @@ classifiers = [
27
31
"Programming Language :: Python :: 3.14",
28
32
]
29
33
dependencies = []
30
-
description = "uvtask is a modern, fast, and flexible Python task runner and test automation tool designed to simplify development workflows. It supports running, organizing, and managing tasks or tests in Python projects with an emphasis on ease of use and speed."
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 = "ruff format uvtask tests", description = "Format code with ruff" }
0 commit comments