diff --git a/deps/lock/aarch64-apple-darwin/.requirements_dev.in.sha256 b/deps/lock/aarch64-apple-darwin/.requirements_dev.in.sha256 index 4c574d8..26cc7a6 100644 --- a/deps/lock/aarch64-apple-darwin/.requirements_dev.in.sha256 +++ b/deps/lock/aarch64-apple-darwin/.requirements_dev.in.sha256 @@ -1 +1 @@ -5bb70432f4c0ad95df62595bdcfdce40f288df99f6a2712fddcb8603b91cc5c7 requirements_dev.in +d60f7e1bbc797733bbb995197ff47b52a1806cdbdc9468bd54f7edd90d95d4f8 requirements_dev.in diff --git a/deps/lock/aarch64-apple-darwin/requirements_dev.txt b/deps/lock/aarch64-apple-darwin/requirements_dev.txt index ef09b2c..48a5505 100644 --- a/deps/lock/aarch64-apple-darwin/requirements_dev.txt +++ b/deps/lock/aarch64-apple-darwin/requirements_dev.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile requirements_dev.in -o /home/runner/work/python-import.nvim/python-import.nvim/deps/lock/aarch64-apple-darwin/requirements_dev.txt --python-platform aarch64-apple-darwin --python-version 3.9 +# uv pip compile requirements_dev.in -o /Users/kiyoon/project/python-import.nvim/deps/lock/aarch64-apple-darwin/requirements_dev.txt --python-platform aarch64-apple-darwin --python-version 3.9 click==8.1.7 # via typer coverage==7.5.3 @@ -26,7 +26,7 @@ pytest-cov==5.0.0 # via -r requirements_dev.in rich==13.7.1 # via typer -ruff==0.4.7 +ruff==0.6.7 # via -r requirements_dev.in shellingham==1.5.4 # via typer diff --git a/deps/lock/x86_64-apple-darwin/.requirements_dev.in.sha256 b/deps/lock/x86_64-apple-darwin/.requirements_dev.in.sha256 index 4c574d8..26cc7a6 100644 --- a/deps/lock/x86_64-apple-darwin/.requirements_dev.in.sha256 +++ b/deps/lock/x86_64-apple-darwin/.requirements_dev.in.sha256 @@ -1 +1 @@ -5bb70432f4c0ad95df62595bdcfdce40f288df99f6a2712fddcb8603b91cc5c7 requirements_dev.in +d60f7e1bbc797733bbb995197ff47b52a1806cdbdc9468bd54f7edd90d95d4f8 requirements_dev.in diff --git a/deps/lock/x86_64-apple-darwin/requirements_dev.txt b/deps/lock/x86_64-apple-darwin/requirements_dev.txt index e567c22..cafd000 100644 --- a/deps/lock/x86_64-apple-darwin/requirements_dev.txt +++ b/deps/lock/x86_64-apple-darwin/requirements_dev.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile requirements_dev.in -o /home/runner/work/python-import.nvim/python-import.nvim/deps/lock/x86_64-apple-darwin/requirements_dev.txt --python-platform x86_64-apple-darwin --python-version 3.9 +# uv pip compile requirements_dev.in -o /Users/kiyoon/project/python-import.nvim/deps/lock/x86_64-apple-darwin/requirements_dev.txt --python-platform x86_64-apple-darwin --python-version 3.9 click==8.1.7 # via typer coverage==7.5.3 @@ -26,7 +26,7 @@ pytest-cov==5.0.0 # via -r requirements_dev.in rich==13.7.1 # via typer -ruff==0.4.7 +ruff==0.6.7 # via -r requirements_dev.in shellingham==1.5.4 # via typer diff --git a/deps/lock/x86_64-manylinux_2_28/.requirements_dev.in.sha256 b/deps/lock/x86_64-manylinux_2_28/.requirements_dev.in.sha256 index 4c574d8..26cc7a6 100644 --- a/deps/lock/x86_64-manylinux_2_28/.requirements_dev.in.sha256 +++ b/deps/lock/x86_64-manylinux_2_28/.requirements_dev.in.sha256 @@ -1 +1 @@ -5bb70432f4c0ad95df62595bdcfdce40f288df99f6a2712fddcb8603b91cc5c7 requirements_dev.in +d60f7e1bbc797733bbb995197ff47b52a1806cdbdc9468bd54f7edd90d95d4f8 requirements_dev.in diff --git a/deps/lock/x86_64-manylinux_2_28/requirements_dev.txt b/deps/lock/x86_64-manylinux_2_28/requirements_dev.txt index 9028605..38b5c4b 100644 --- a/deps/lock/x86_64-manylinux_2_28/requirements_dev.txt +++ b/deps/lock/x86_64-manylinux_2_28/requirements_dev.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile requirements_dev.in -o /home/runner/work/python-import.nvim/python-import.nvim/deps/lock/x86_64-manylinux_2_28/requirements_dev.txt --python-platform x86_64-manylinux_2_28 --python-version 3.9 +# uv pip compile requirements_dev.in -o /Users/kiyoon/project/python-import.nvim/deps/lock/x86_64-manylinux_2_28/requirements_dev.txt --python-platform x86_64-manylinux_2_28 --python-version 3.9 click==8.1.7 # via typer coverage==7.5.3 @@ -26,7 +26,7 @@ pytest-cov==5.0.0 # via -r requirements_dev.in rich==13.7.1 # via typer -ruff==0.4.7 +ruff==0.6.7 # via -r requirements_dev.in shellingham==1.5.4 # via typer diff --git a/deps/lock/x86_64-pc-windows-msvc/.requirements_dev.in.sha256 b/deps/lock/x86_64-pc-windows-msvc/.requirements_dev.in.sha256 index 4c574d8..26cc7a6 100644 --- a/deps/lock/x86_64-pc-windows-msvc/.requirements_dev.in.sha256 +++ b/deps/lock/x86_64-pc-windows-msvc/.requirements_dev.in.sha256 @@ -1 +1 @@ -5bb70432f4c0ad95df62595bdcfdce40f288df99f6a2712fddcb8603b91cc5c7 requirements_dev.in +d60f7e1bbc797733bbb995197ff47b52a1806cdbdc9468bd54f7edd90d95d4f8 requirements_dev.in diff --git a/deps/lock/x86_64-pc-windows-msvc/requirements_dev.txt b/deps/lock/x86_64-pc-windows-msvc/requirements_dev.txt index dc49a1e..731f89a 100644 --- a/deps/lock/x86_64-pc-windows-msvc/requirements_dev.txt +++ b/deps/lock/x86_64-pc-windows-msvc/requirements_dev.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile requirements_dev.in -o /home/runner/work/python-import.nvim/python-import.nvim/deps/lock/x86_64-pc-windows-msvc/requirements_dev.txt --python-platform x86_64-pc-windows-msvc --python-version 3.9 +# uv pip compile requirements_dev.in -o /Users/kiyoon/project/python-import.nvim/deps/lock/x86_64-pc-windows-msvc/requirements_dev.txt --python-platform x86_64-pc-windows-msvc --python-version 3.9 click==8.1.7 # via typer colorama==0.4.6 @@ -30,7 +30,7 @@ pytest-cov==5.0.0 # via -r requirements_dev.in rich==13.7.1 # via typer -ruff==0.4.7 +ruff==0.6.7 # via -r requirements_dev.in shellingham==1.5.4 # via typer diff --git a/pyproject.toml b/pyproject.toml index f833985..fea4c59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ log_cli_level = "INFO" [tool.ruff] src = ["src"] # for ruff isort +namespace-packages = ["tools", "scripts"] # for INP rule, suppress on these directories extend-exclude = [ "src/python_import/_version.py", # CHANGE "tests/sample_projects/project1/*", @@ -77,6 +78,7 @@ select = [ "RET503", # return "PTH", # path "NPY", # numpy + "PD", # pandas "PYI", # type stubs for pyright/pylance "PT", # pytest "PIE", # @@ -86,6 +88,21 @@ select = [ "DTZ", # datetime "YTT", "ASYNC", + "FBT", # boolean trap + "A", # Shadowing python builtins + "EXE", # executable (shebang) + "FA", # future annotations + "ISC", # Implicit string concatenation + "ICN", # Import convention + "INP", # Implicit namespace package (no __init__.py) + "Q", # Quotes + "RSE", # raise + "SLOT", # __slots__ + "PL", # Pylint + "TRY", # try + "FAST", # FastAPI + "AIR", # airflow + "DOC", # docstring # Not important "T10", # debug statements @@ -101,12 +118,14 @@ ignore = [ "D212", # Multi-line docstring summary should start at the first line "D417", # require documentation for every function parameter. "D401", # require an imperative mood for all docstrings. + "DOC201", # missing Return field in docstring "PTH123", # Path.open should be used instead of built-in open "PT006", # Pytest parameterize style "N812", # Lowercase `functional` imported as non-lowercase `F` (import torch.nn.functional as F) "NPY002", # legacy numpy random "UP017", # datetime.timezone.utc -> datetime.UTC "SIM108", # use ternary operator instead of if-else + "TRY003", # long message in except ] [tool.ruff.lint.pydocstyle] @@ -132,6 +151,11 @@ required-imports = [ # NOTE: Ruff code TID is currently disabled, so this settings doesn't do anything. banned-module-level-imports = ["torch", "tensorflow"] +[tool.ruff.lint.pylint] +max-args = 10 +max-bool-expr = 10 +max-statements = 100 + [tool.pyright] include = ["src"] diff --git a/src/python_import/cli/main.py b/src/python_import/cli/main.py index be78e0b..ff7e9e5 100644 --- a/src/python_import/cli/main.py +++ b/src/python_import/cli/main.py @@ -20,15 +20,16 @@ ) -def version_callback(value: bool): +def version_callback(*, value: bool): if value: print(f"python-import v{python_import.__version__}") - raise typer.Exit() + raise typer.Exit @app.callback() def common( ctx: typer.Context, + *, version: bool = typer.Option( None, "-v", "--version", callback=version_callback, help="Show version" ), @@ -79,6 +80,7 @@ def count( ], cwd=project_root, capture_output=True, + check=False, ) # print(rg_outputs) diff --git a/src/python_import/utils.py b/src/python_import/utils.py index 4b08f4a..e4fc372 100644 --- a/src/python_import/utils.py +++ b/src/python_import/utils.py @@ -15,6 +15,7 @@ def relative_import_to_absolute_import( project_root: str | PathLike, python_file_path: str | PathLike, from_import_name: str, + *, check_dir_exists: bool = True, ): """ @@ -275,6 +276,7 @@ def get_all_imports_in_file_as_absolute_with_word( ], cwd=project_root, capture_output=True, + check=False, ) # print(rg_outputs) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29