From f6fb285a9faf00810582b08a8c67f1a17e704fbc Mon Sep 17 00:00:00 2001 From: Sam Tygier Date: Mon, 6 Jan 2025 17:18:17 +0000 Subject: [PATCH 1/4] Add missing __init__.py in palette_changer/test --- mantidimaging/gui/widgets/palette_changer/test/__init__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 mantidimaging/gui/widgets/palette_changer/test/__init__.py diff --git a/mantidimaging/gui/widgets/palette_changer/test/__init__.py b/mantidimaging/gui/widgets/palette_changer/test/__init__.py new file mode 100644 index 00000000000..3bf970a700e --- /dev/null +++ b/mantidimaging/gui/widgets/palette_changer/test/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2021 ISIS Rutherford Appleton Laboratory UKRI +# SPDX - License - Identifier: GPL-3.0-or-later +from __future__ import annotations From a69c3aec89ac3eb6ff47624bd802beff7e1a0d28 Mon Sep 17 00:00:00 2001 From: Sam Tygier Date: Mon, 6 Jan 2025 15:55:03 +0000 Subject: [PATCH 2/4] Update ruff to 3.7 to allow negated per-file-ignores configuration --- environment-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment-dev.yml b/environment-dev.yml index f48da26dd12..5757bfb7676 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -29,7 +29,7 @@ dependencies: - pyinstaller==6.9.* - pyright==1.1.* - make==4.3 - - ruff=0.3.3 + - ruff=0.3.7 - pre-commit==3.5.* - sphinx==7.2.* - pydata-sphinx-theme==0.15.* From bbd5552853b6a883b2139240ff2814d05aec6881 Mon Sep 17 00:00:00 2001 From: Sam Tygier Date: Mon, 6 Jan 2025 15:56:12 +0000 Subject: [PATCH 3/4] Add the ruff INP001 rule This check that every directory with a python file has a __init__.py Ignore directories outside the mantidimaging package, as these have some standalone files --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1aadfe935ea..700500a24e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,10 +3,13 @@ line-length = 120 target-version = "py310" [tool.ruff.lint] -select = ["F", "E", "W", "UP", "B", "C4", "FA", "NPY"] +select = ["F", "E", "W", "UP", "B", "C4", "FA", "NPY", "INP"] fixable = ["UP"] ignore = ["UP014"] +[tool.ruff.lint.per-file-ignores] +"!mantidimaging/**.py" = ["INP"] + [tool.pyright] typeCheckingMode = "basic" reportMissingImports = false From 029d209fd111cb9c43a9290b7357763d5e52fe04 Mon Sep 17 00:00:00 2001 From: Sam Tygier Date: Mon, 6 Jan 2025 17:42:44 +0000 Subject: [PATCH 4/4] Release notes --- docs/release_notes/next/dev-2444-ruff-implicit-namespace-package | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/release_notes/next/dev-2444-ruff-implicit-namespace-package diff --git a/docs/release_notes/next/dev-2444-ruff-implicit-namespace-package b/docs/release_notes/next/dev-2444-ruff-implicit-namespace-package new file mode 100644 index 00000000000..092b2e162b3 --- /dev/null +++ b/docs/release_notes/next/dev-2444-ruff-implicit-namespace-package @@ -0,0 +1 @@ +#2444: Ruff rule to check for missing __init__.py files