From 3dbe55a6dee5dfd8886ed880193db7c532ca61b0 Mon Sep 17 00:00:00 2001 From: Markus Binsteiner Date: Wed, 18 Dec 2024 11:08:27 +0100 Subject: [PATCH] chore: cleanup --- .../pyproject.toml | 80 +++++++++---------- src/kiara_plugin/develop/pkg_build/models.py | 2 +- .../develop/pkg_build/rattler/models.py | 2 +- src/kiara_plugin/develop/utils/pkg_utils.py | 4 +- 4 files changed, 41 insertions(+), 47 deletions(-) diff --git a/kiara_plugin.{{ cookiecutter.project_slug }}/pyproject.toml b/kiara_plugin.{{ cookiecutter.project_slug }}/pyproject.toml index e2e79ad..4d43b0f 100644 --- a/kiara_plugin.{{ cookiecutter.project_slug }}/pyproject.toml +++ b/kiara_plugin.{{ cookiecutter.project_slug }}/pyproject.toml @@ -144,32 +144,9 @@ line-length = 88 src = ["src", "tests"] -select = [ - "E", - "F", - "RUF", - "I001", - "YTT", - "S", - "C4", - "T10", - "ISC", - "ICN", - "T20", - "Q", - "TID", - "PD", - "PLC", - "PLE", - "PLR", - "PLW", - "PIE", -] -ignore = ["E501", "S101", "SIM118", "SIM108", "PLR2004", "PLR0913", "S110", "PLR0912", "PLR0915", "PIE810"] - fix = true -fixable = ["E", "F", "RUF100", "I001", "Q"] +# Exclude a variety of commonly ignored directories. exclude = [ ".bzr", ".direnv", @@ -190,35 +167,52 @@ exclude = [ "dist", "node_modules", "venv", + "docs", + ".venv" ] -per-file-ignores = { } - -# Allow unused variables when underscore-prefixed. -dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" # Assume Python 3.10. target-version = "py310" -[tool.ruff.mccabe] -# Unlike Flake8, default to a complexity level of 10. -max-complexity = 10 +[tool.ruff.lint] +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +fixable = ["E", "F", "RUF100", "I001", "Q", "D"] -[tool.ruff.isort] -known-first-party = ["kiara", "kiara_plugin"] +select = [ + "E", + "F", + "RUF", + "I001", + "YTT", + "S", + "C4", + "T10", + "ISC", + "ICN", + "T20", + "Q", + "TID", + "PD", + "PLC", + "PLE", + "PLR", + "PLW", + "PIE", +] -[tool.ruff.pydocstyle] -convention = "google" +ignore = ["E501", "S101", "SIM118", "SIM108", "PLR2004", "PLR0913", "S110", "PIE810", "PLR0911", "PLR0915", "PLR0912", "D", "D401", "PLW0603", "PLR5501", "PLW2901", "S603", "S608", "ISC001", "PLC0206", "RUF022"] +per-file-ignores = { } -[tool.pyright] -include = ["src"] -exclude = ["**/__pycache__"] -ignore = [] +[tool.ruff.lint.isort] +known-first-party = ["kiara", "kiara_plugin"] -reportMissingImports = true -reportMissingTypeStubs = false -executionEnvironments = [ -] +[tool.ruff.lint.mccabe] +# Unlike Flake8, default to a complexity level of 10. +max-complexity = 10 + +[tool.ruff.lint.pydocstyle] +convention = "google" [tool.mypy] python_version = "3.9" diff --git a/src/kiara_plugin/develop/pkg_build/models.py b/src/kiara_plugin/develop/pkg_build/models.py index e7db2ae..2d555e4 100644 --- a/src/kiara_plugin/develop/pkg_build/models.py +++ b/src/kiara_plugin/develop/pkg_build/models.py @@ -124,7 +124,7 @@ class PkgSpec(BaseModel): description="The package entry point(s).", default_factory=dict ) - _environment: Environment = PrivateAttr(None) + _environment: Environment = PrivateAttr(None) # type: ignore @model_validator(mode="before") @classmethod diff --git a/src/kiara_plugin/develop/pkg_build/rattler/models.py b/src/kiara_plugin/develop/pkg_build/rattler/models.py index c4af00d..ec194b1 100644 --- a/src/kiara_plugin/develop/pkg_build/rattler/models.py +++ b/src/kiara_plugin/develop/pkg_build/rattler/models.py @@ -94,7 +94,7 @@ class PkgSpec(BaseModel): description="The package entry point(s).", default_factory=dict ) - _environment: Environment = PrivateAttr(None) + _environment: Environment = PrivateAttr(None) # type: ignore @model_validator(mode="before") @classmethod diff --git a/src/kiara_plugin/develop/utils/pkg_utils.py b/src/kiara_plugin/develop/utils/pkg_utils.py index 5e97be0..5f3cb90 100644 --- a/src/kiara_plugin/develop/utils/pkg_utils.py +++ b/src/kiara_plugin/develop/utils/pkg_utils.py @@ -229,14 +229,14 @@ def extract_reqs_from_metadata( assert pkg not in filtered_reqs.keys() filtered_reqs[pkg] = {"version": ver, "condition": cond} - for extra_pkg, extras in extras_reqs.items(): + for extra_pkg, _extras in extras_reqs.items(): # version = filtered_reqs[extra_pkg]["version"] # TODO: figure out the right version if there's a condition version = None req_metadata = get_pkg_metadata_from_pypi( pkg_name=extra_pkg, version=version ) - new_reqs = extract_reqs_from_metadata(req_metadata, extras=extras) + new_reqs = extract_reqs_from_metadata(req_metadata, extras=_extras) for k, v in new_reqs.items(): if k in filtered_reqs.keys(): continue