Skip to content

Replace black/isort/flake8 with ruff, migrate to uv/pyproject.toml#402

Open
halfguru wants to merge 1 commit intodvd-dev:mainfrom
halfguru:chore/ruff-uv-migration
Open

Replace black/isort/flake8 with ruff, migrate to uv/pyproject.toml#402
halfguru wants to merge 1 commit intodvd-dev:mainfrom
halfguru:chore/ruff-uv-migration

Conversation

@halfguru
Copy link
Copy Markdown

@halfguru halfguru commented Apr 7, 2026

Motivation

Why ruff?

  • Replaces 3 tools (black, isort, flake8) + their plugins with a single, fast Rust-based tool
  • 10-100x faster than the Python-based tools it replaces
  • Actively maintained with a large community and growing ecosystem

Why uv?

  • Replaces Poetry + poetry.lock with a modern, fast Python package manager
  • pyproject.toml is the modern standard (PEP 621), consolidates config into one file
  • Deterministic installs with uv.lock

Companion PR for the HA integration: dvd-dev/hilo#927

Summary

  • Replace black, isort, and flake8 with ruff (formatter + linter) via ruff-pre-commit in .pre-commit-config.yaml
  • Migrate pyproject.toml from Poetry to PEP 621 metadata, replace poetry.lock with uv.lock
  • Raise minimum Python version to 3.11
  • Drop Node.js/npm/prettier entirely
  • Update devcontainer, dependabot, and CI to use uv for dependency management
  • Add pytest job to CI alongside pre-commit
  • Add mock-based unit tests for core modules (64 tests covering DeviceAttribute, DeviceReading, HiloDevice, utilities, state management)

Removed files

  • .flake8: migrated to pyproject.toml
  • .prettierignore: no longer needed without prettier
  • .yamllint: dead config, not used by any pre-commit hook
  • .nvmrc: no longer needed without Node.js
  • package.json, package-lock.json: no longer needed without Node.js
  • poetry.lock: replaced by uv.lock
  • requirements.txt, test-requirements.txt: replaced by [project.dependencies] in pyproject.toml
  • .github/workflows/constraints.txt: no longer needed

- Replace black, isort, flake8 with ruff (formatter + linter)
- Replace Poetry with uv for dependency management
- Drop Node.js/npm/prettier entirely
- Raise minimum Python version to 3.11
- Add pytest to CI alongside pre-commit
- Add mock-based unit tests for core modules (64 tests)
- Remove dead config: .flake8, .yamllint, .prettierignore, .nvmrc
- Update devcontainer, dependabot, and CI workflow
@halfguru halfguru changed the title Migrate toolchain from Poetry/black/isort/flake8 to ruff + uv Replace black/isort/flake8 with ruff, migrate to uv/pyproject.toml Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant