From af1cace25d6bdb66c42911a3252d17164ab6ffd2 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Tue, 11 Aug 2026 21:18:32 -0700 Subject: [PATCH 1/2] update pre-commit config --- .pre-commit-config.yaml | 29 +++++++++++++++-- pyproject.toml | 12 ++++--- src/biocsetup/create_repository.py | 12 ++++--- .../precommit/pre-commit-config.yaml | 31 ++++++++++++++++--- 4 files changed, 67 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61fbd30..863ce2d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,14 +17,37 @@ repos: - id: mixed-line-ending args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows +# - repo: https://github.com/PyCQA/docformatter +# rev: master +# hooks: +# - id: docformatter +# additional_dependencies: [tomli] +# args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120] +# # --config, ./pyproject.toml + +# - repo: https://github.com/psf/black +# rev: 24.8.0 +# hooks: +# - id: black +# language_version: python3 + - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.6 + rev: v0.16.2 hooks: - - id: ruff - args: [--fix, --exit-non-zero-on-fix] + # Run the linter. + - id: ruff-check + args: [--fix, --exit-zero] + # Run the formatter. - id: ruff-format +## If like to embrace black styles even in the docs: +# - repo: https://github.com/asottile/blacken-docs +# rev: v1.13.0 +# hooks: +# - id: blacken-docs +# additional_dependencies: [black] + ## Check for misspells in documentation files: # - repo: https://github.com/codespell-project/codespell # rev: v2.2.5 diff --git a/pyproject.toml b/pyproject.toml index 086f90c..2d3e09b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,15 +11,17 @@ version_scheme = "no-guess-dev" [tool.ruff] line-length = 120 src = ["src"] -exclude = ["tests"] -lint.extend-ignore = ["F821"] +exclude = ["tests", "docs"] + +[tool.ruff.lint] +extend-ignore = ["F821"] [tool.ruff.lint.pydocstyle] convention = "google" +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["E402", "F401"] + [tool.ruff.format] docstring-code-format = true docstring-code-line-length = 20 - -[tool.ruff.lint.per-file-ignores] -"__init__.py" = ["E402", "F401"] diff --git a/src/biocsetup/create_repository.py b/src/biocsetup/create_repository.py index 620c315..35f6e92 100644 --- a/src/biocsetup/create_repository.py +++ b/src/biocsetup/create_repository.py @@ -154,18 +154,20 @@ def create_repository( [tool.ruff] line-length = 120 src = ["src"] -exclude = ["tests"] -lint.extend-ignore = ["F821"] +exclude = ["tests", "docs"] + +[tool.ruff.lint] +extend-ignore = ["F821"] [tool.ruff.lint.pydocstyle] convention = "google" +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["E402", "F401"] + [tool.ruff.format] docstring-code-format = true docstring-code-line-length = 20 - -[tool.ruff.lint.per-file-ignores] -"__init__.py" = ["E402", "F401"] """ with open(pyprj_path, "w") as f: diff --git a/src/biocsetup/templates/precommit/pre-commit-config.yaml b/src/biocsetup/templates/precommit/pre-commit-config.yaml index a832683..863ce2d 100644 --- a/src/biocsetup/templates/precommit/pre-commit-config.yaml +++ b/src/biocsetup/templates/precommit/pre-commit-config.yaml @@ -2,7 +2,7 @@ exclude: '^docs/conf.py' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: check-added-large-files @@ -17,14 +17,37 @@ repos: - id: mixed-line-ending args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows +# - repo: https://github.com/PyCQA/docformatter +# rev: master +# hooks: +# - id: docformatter +# additional_dependencies: [tomli] +# args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120] +# # --config, ./pyproject.toml + +# - repo: https://github.com/psf/black +# rev: 24.8.0 +# hooks: +# - id: black +# language_version: python3 + - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.8.2 + rev: v0.16.2 hooks: - - id: ruff - args: [--fix, --exit-non-zero-on-fix] + # Run the linter. + - id: ruff-check + args: [--fix, --exit-zero] + # Run the formatter. - id: ruff-format +## If like to embrace black styles even in the docs: +# - repo: https://github.com/asottile/blacken-docs +# rev: v1.13.0 +# hooks: +# - id: blacken-docs +# additional_dependencies: [black] + ## Check for misspells in documentation files: # - repo: https://github.com/codespell-project/codespell # rev: v2.2.5 From 5d0b7b08b81dab4c2782cbd54134b4ae809e24d6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 04:19:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.py | 2 +- src/biocsetup/create_repository.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 1171e77..1c360af 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ if __name__ == "__main__": try: setup(use_scm_version={"version_scheme": "no-guess-dev"}) - except: # noqa + except: print( "\n\nAn error occurred while building the project, " "please ensure you have the most updated version of setuptools, " diff --git a/src/biocsetup/create_repository.py b/src/biocsetup/create_repository.py index 35f6e92..b030ef1 100644 --- a/src/biocsetup/create_repository.py +++ b/src/biocsetup/create_repository.py @@ -1,6 +1,5 @@ import shutil from pathlib import Path -from typing import Optional from pyscaffold import api, file_system, shell from pyscaffoldext.markdown.extension import Markdown @@ -12,7 +11,7 @@ def create_repository( project_path: str, - description: Optional[str] = "Add a short description here!", + description: str | None = "Add a short description here!", license: str = "MIT", rst: bool = False, ) -> None: