diff --git a/pyproject.toml b/pyproject.toml index 30e7b64..4345c8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -333,10 +333,9 @@ multi_line_output = 3 use_parentheses = true # Comply with Google's Python Style Guide -# => All imports go on a single line except the ones from the typing module +# => All imports go on a single line # Source: https://google.github.io/styleguide/pyguide.html#313-imports-formatting force_single_line = true -single_line_exclusions = ["typing"] @@ -482,6 +481,8 @@ select = [ # ======================================= # eradicate => no commented-out code "ERA", + # flake8-import-conventions => Unified import aliases + "ICN", # isort => imports are sorted "I", # Pylint's refactoring rules => simpler and smaller functions @@ -531,13 +532,31 @@ parametrize-values-row-type = "tuple" parametrize-values-type = "list" +[tool.ruff.lint.flake8-import-conventions] + +# Import modules instead of objects from these modules +banned-from = [ + "collections.abc", + "nox.sessions", + "typing", +] + + +[tool.ruff.lint.flake8-import-conventions.extend-aliases] + +"collections.abc" = "cabc" +"sqlalchemy" = "sa" +"sqlalchemy.dialects.postgresql" = "psql" +"sqlalchemy.ext.hybrid" = "sa_hybrid" +"typing" = "t" + + [tool.ruff.lint.isort] # aligned with [tool.isort] above case-sensitive = false # Same as `isort` force-single-line = true lines-after-imports = 2 order-by-type = false -single-line-exclusions = ["typing"] [tool.ruff.lint.mccabe]