diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f2968c..35cb451 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,38 +3,31 @@ # Setup: pre-commit install # Run manually: pre-commit run --all-files +default_language_version: + python: python3 + repos: - # Generic file hygiene checks + # Python-focused safety checks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - id: check-yaml - - id: check-added-large-files + - id: check-ast + files: ^.*\.py$ + - id: debug-statements + files: ^.*\.py$ + - id: check-docstring-first + files: ^.*\.py$ + - id: check-builtin-literals + files: ^.*\.py$ - # Python formatting (Black) - apply to all Python files - - repo: https://github.com/psf/black - rev: 24.4.2 + # Modern Python linting + import sorting + formatting + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.13 hooks: - - id: black - language_version: python3 - args: ["--line-length=100"] - - # Python import sorting (isort) - apply to all Python files - - repo: https://github.com/pycqa/isort - rev: 5.13.2 - hooks: - - id: isort - args: ["--profile", "black", "--line-length=100"] - - # Python linting (flake8) - strict settings for code quality - - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - # Strict but reasonable settings - args: [ - "--max-line-length=100", - "--extend-ignore=E203,W503" - ] + - id: ruff-check + args: ["--fix"] + files: ^.*\.py$ + - id: ruff-format + args: ["--check"] + files: ^.*\.py$ diff --git a/README.md b/README.md index b048689..d77e60b 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ I welcome contributions! To contribute to pyMC_repeater: ### Development Setup ```bash -# Install in development mode with dev tools (black, pytest, isort, mypy, etc) +# Install in development mode with dev tools (ruff, pytest, mypy, etc) pip install -e ".[dev]" # Setup pre-commit hooks for code quality @@ -413,9 +413,8 @@ pre-commit run --all-files **Note:** Hardware support (LoRa radio drivers) is included in the base installation automatically via `pymc_core[hardware]`. Pre-commit hooks will automatically: -- Format code with Black -- Sort imports with isort -- Lint with flake8 +- Lint and auto-fix Python issues with Ruff +- Validate formatting with Ruff formatter - Fix trailing whitespace and other file issues ## Support diff --git a/debian/control b/debian/control index acaafd9..ce2a53a 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,7 @@ Build-Depends: debhelper-compat (= 13), git Standards-Version: 4.6.2 Homepage: https://github.com/rightup/pyMC_Repeater -X-Python3-Version: >= 3.8 +X-Python3-Version: >= 3.9 Package: pymc-repeater Architecture: all diff --git a/pyproject.toml b/pyproject.toml index 137a957..9a503a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,14 +11,13 @@ authors = [ description = "PyMC Repeater Daemon" readme = "README.md" license = {text = "MIT"} -requires-python = ">=3.8" +requires-python = ">=3.9" classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -55,8 +54,7 @@ rrd = [ dev = [ "pytest>=7.4.0", "pytest-asyncio>=0.21.0", - "black>=23.0.0", - "isort>=5.12.0", + "ruff>=0.11.13", "mypy>=1.7.0", ] @@ -78,13 +76,12 @@ repeater = [ "presets/*.yaml", ] -[tool.black] +[tool.ruff] line-length = 100 -target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] +target-version = "py39" -[tool.isort] -profile = "black" -line_length = 100 +[tool.ruff.lint] +extend-ignore = ["E701"] [tool.setuptools_scm] version_scheme = "guess-next-dev"