diff --git a/.pre-commit-config.yml b/.pre-commit-config.yml new file mode 100644 index 0000000..88a234f --- /dev/null +++ b/.pre-commit-config.yml @@ -0,0 +1,10 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.8 + hooks: + - id: ruff + name: ruff linting + args: ["--config=pyproject.toml"] + - id : ruff-format + name: ruff formatting + args: ["--config=pyproject.toml"] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 16a5dd9..f050da0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,33 @@ [build-system] requires = ["setuptools >= 40.6.0", "wheel", "setuptools_scm[toml]>=3.4"] build-backend = "setuptools.build_meta" + +[project.optional-dependencies] +dev = ['pre-commit~=3.8.0', + ] + +[tool.ruff] +exclude = ["docs", "dev"] +# Like black +line-length = 88 +indent-width = 4 + +[tool.ruff.lint] +ignore = ["E741"] +extend-ignore = ["E203","E712"] + +[tool.ruff.lint.per-file-ignores] +"examples/*" = ["E402"] + +[tool.ruff.format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" \ No newline at end of file