Modernize project with uv, pytest, ruff, and git hooks #21

Merged
genewildish merged 5 commits from enhance_portability into main 2026-03-15 23:21:36 +00:00
Contributor

Summary

This PR modernizes the project's Python tooling with uv for package management, adds a comprehensive pytest test suite, configures ruff for linting/formatting, and sets up git hooks with hk.

  • Replaced legacy requirements.txt with uv-based Python packaging (pyproject.toml)
  • Added 73 tests covering engine/config.py, filter.py, terminal.py, sources.py, mic.py, and ntfy modules with 100% coverage on tested modules
  • Configured ruff for linting and formatting with auto-fix support for common issues (SIM105, N806, B007, SIM108)
  • Added hk git hooks (pre-commit, pre-push) integrated with mise for tool versioning

Key Changes

  • Created pyproject.toml with uv-compatible dependencies and pytest/coverage configuration
  • Created mise.toml with dev tasks (test, lint, run, sync, ci) and tool definitions
  • Simplified mainline.py by removing venv bootstrap code
  • Fixed pre-existing lint errors across engine/ modules
  • Added .python-version pinning Python 3.12

Getting Started

Install mise, then run mise install to set up Python 3.12, hk, and pkl. Initialize the uv virtual environment with uv venv && uv sync. Install git hooks with hk install --mise. Run tests with mise run test, lint with mise run lint, or start the app with mise run run.

## Summary This PR modernizes the project's Python tooling with uv for package management, adds a comprehensive pytest test suite, configures ruff for linting/formatting, and sets up git hooks with hk. - Replaced legacy requirements.txt with uv-based Python packaging (pyproject.toml) - Added 73 tests covering engine/config.py, filter.py, terminal.py, sources.py, mic.py, and ntfy modules with 100% coverage on tested modules - Configured ruff for linting and formatting with auto-fix support for common issues (SIM105, N806, B007, SIM108) - Added hk git hooks (pre-commit, pre-push) integrated with mise for tool versioning ## Key Changes - Created pyproject.toml with uv-compatible dependencies and pytest/coverage configuration - Created mise.toml with dev tasks (test, lint, run, sync, ci) and tool definitions - Simplified mainline.py by removing venv bootstrap code - Fixed pre-existing lint errors across engine/ modules - Added .python-version pinning Python 3.12 ## Getting Started Install mise, then run `mise install` to set up Python 3.12, hk, and pkl. Initialize the uv virtual environment with `uv venv && uv sync`. Install git hooks with `hk install --mise`. Run tests with `mise run test`, lint with `mise run lint`, or start the app with `mise run run`.
david added 4 commits 2026-03-15 21:58:18 +00:00
- Add pyproject.toml with modern Python packaging (PEP 517/518)
- Add uv-based dependency management replacing inline venv bootstrap
- Add requirements.txt and requirements-dev.txt for compatibility
- Add mise.toml with dev tasks (test, lint, run, sync, ci)
- Add .python-version pinned to Python 3.12
- Add comprehensive pytest test suite (73 tests) for:
  - engine/config, filter, terminal, sources, mic, ntfy modules
- Configure pytest with coverage reporting (16% total, 100% on tested modules)
- Configure ruff for linting with Python 3.10+ target
- Remove redundant venv bootstrap code from mainline.py
- Update .gitignore for uv/venv artifacts

Run 'uv sync' to install dependencies, 'uv run pytest' to test.
- Fix import sorting (isort) across all engine modules
- Fix SIM105 try-except-pass patterns (contextlib.suppress)
- Fix nested with statements in tests
- Fix unused loop variables

Run 'uv run pytest' to verify tests still pass.
- Fix pre-existing lint errors in engine/ modules using ruff --unsafe-fixes
- Add hk.pkl with pre-commit and pre-push hooks using ruff builtin
- Configure hooks to use 'uv run' prefix for tool execution
- Update mise.toml to include hk and pkl tools
- All 73 tests pass
- Fix pre-existing lint errors in engine/ modules using ruff --unsafe-fixes
- Add hk.pkl with pre-commit and pre-push hooks using ruff builtin
- Configure hooks to use 'uv run' prefix for tool execution
- Update mise.toml to include hk and pkl tools
- Use 'hk install --mise' for proper mise integration
- All 73 tests pass
david force-pushed enhance_portability from d4ea28add2 to ab6bbac02b 2026-03-15 22:12:25 +00:00 Compare
david force-pushed enhance_portability from ab6bbac02b to 9ae4dc2b07 2026-03-15 22:17:03 +00:00 Compare
genewildish merged commit f6f177590b into main 2026-03-15 23:21:36 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: genewildish/Mainline#21