From 41ec5be7a1a41ef00300285756a24ed0e4e910ca Mon Sep 17 00:00:00 2001 From: Michael Franklin Date: Thu, 4 Jan 2024 12:29:16 +1100 Subject: [PATCH 1/4] Bump pre-commit versions + add isort --- .pre-commit-config.yaml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e315785..dec0ff1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.5.0 hooks: - id: check-yaml exclude: '\.*conda/.*' @@ -16,24 +16,38 @@ repos: - id: check-added-large-files - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.31.1 + rev: v0.38.0 hooks: - id: markdownlint - args: ["--config", ".markdownlint.json"] + + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort (python) - repo: https://github.com/ambv/black - rev: "22.3.0" + rev: 23.12.1 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.1.0 + rev: v0.1.11 hooks: - id: ruff - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v0.960" + rev: v1.8.0 hooks: - id: mypy + args: + [ + --pretty, + --show-error-codes, + --no-strict-optional, + --ignore-missing-imports, + --install-types, + --non-interactive, + ] additional_dependencies: [types-PyYAML==6.0.4, types-toml] From 675466c9a13a8310f26303541d2a0aa21ae6d27d Mon Sep 17 00:00:00 2001 From: Michael Franklin Date: Thu, 4 Jan 2024 13:09:05 +1100 Subject: [PATCH 2/4] Bump python to 3.11 as that's the isort profile --- .pre-commit-config.yaml | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dec0ff1..683fdb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: python3.10 + python: python3.11 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 diff --git a/pyproject.toml b/pyproject.toml index ecf1ada..18795cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ skip-string-normalization = true [tool.isort] py_version = 311 +profile = "black" [tool.ruff] line-length = 88 From 4b135d6b4bd9d8b979df5861ae00ee24a9f8e467 Mon Sep 17 00:00:00 2001 From: Michael Franklin Date: Thu, 4 Jan 2024 13:12:09 +1100 Subject: [PATCH 3/4] Revert python 3.11 in pre-commit due to bug --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 683fdb5..dec0ff1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: python3.11 + python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 From e45dde9386ca53e82444d5de9367fc101901c448 Mon Sep 17 00:00:00 2001 From: John Marshall Date: Wed, 10 Jan 2024 10:26:19 +1300 Subject: [PATCH 4/4] Customise isort sections Add custom sections for hail and CPG-local imports. Same line length as for other linters, and add a template for listing submodules etc that should not be linted or edited. --- pyproject.toml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 18795cc..200819c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,25 @@ skip-string-normalization = true [tool.isort] py_version = 311 profile = "black" +line_length = 88 +sections = ["FUTURE", "STDLIB", "THIRDPARTY", "HAIL", "CPG", "FIRSTPARTY", "LOCALFOLDER"] +known_hail = [ + "hail", + "hailtop", +] +# Adjust these for each repository, e.g., removing those that should be +# local rather than CPG. Also fill in extend_skip below if there are any +# subdirectories that should be ignored. +known_cpg = [ + "analysis_runner", + "cpg_infra", + "cpg_utils", + "cpg_workflows", + "gnomad", + "hail_scripts", + "metamist", +] +# extend_skip = ["list", "submodules", "etc", here"] [tool.ruff] line-length = 88