diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..a3e2149 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +1f423a22d8b27926da7d7b7393c833da0f3714a4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0097bb5..e4f17bb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,13 +23,9 @@ repos: files: \.(html|md|yml|yaml|toml) args: [--prose-wrap=preserve] - - repo: https://github.com/psf/black - rev: 3702ba224ecffbcec30af640c149f231d90aebdb # frozen: 24.4.2 - hooks: - - id: black - - repo: https://github.com/astral-sh/ruff-pre-commit rev: 1dc9eb131c2ea4816c708e4d85820d2cc8542683 # frozen: v0.5.0 hooks: - id: ruff - args: [--fix, --exit-non-zero-on-fix] + args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"] + - id: ruff-format diff --git a/lazy_loader/__init__.py b/lazy_loader/__init__.py index c61ea99..ff3f5ce 100644 --- a/lazy_loader/__init__.py +++ b/lazy_loader/__init__.py @@ -38,9 +38,7 @@ def attach(package_name, submodules=None, submod_attrs=None): The typical way to call this function, replacing the above imports, is:: __getattr__, __dir__, __all__ = lazy.attach( - __name__, - ['mysubmodule', 'anothersubmodule'], - {'foo': ['someattr']} + __name__, ["mysubmodule", "anothersubmodule"], {"foo": ["someattr"]} ) Parameters @@ -162,7 +160,7 @@ def myfunc(): fullname : str The full name of the module or submodule to import. For example:: - sp = lazy.load('scipy') # import scipy as sp + sp = lazy.load("scipy") # import scipy as sp require : str A dependency requirement as defined in PEP-508. For example:: diff --git a/lazy_loader/tests/fake_pkg/some_func.py b/lazy_loader/tests/fake_pkg/some_func.py index 10e99ed..f20478d 100644 --- a/lazy_loader/tests/fake_pkg/some_func.py +++ b/lazy_loader/tests/fake_pkg/some_func.py @@ -1,3 +1,2 @@ def some_func(): """Function with same name as submodule.""" - pass diff --git a/lazy_loader/tests/test_lazy_loader.py b/lazy_loader/tests/test_lazy_loader.py index dfffb87..42d97f8 100644 --- a/lazy_loader/tests/test_lazy_loader.py +++ b/lazy_loader/tests/test_lazy_loader.py @@ -186,5 +186,6 @@ def test_parallel_load(): [ sys.executable, os.path.join(os.path.dirname(__file__), "import_np_parallel.py"), - ] + ], + check=True, ) diff --git a/pyproject.toml b/pyproject.toml index 19edefc..5cbaaec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,6 @@ dev = ["changelist == 0.5"] Home = "https://scientific-python.org/specs/spec-0001/" Source = "https://github.com/scientific-python/lazy-loader" - [tool.changelist] ignored_user_logins = ["dependabot[bot]", "pre-commit-ci[bot]", "web-flow"] @@ -41,19 +40,48 @@ ignored_user_logins = ["dependabot[bot]", "pre-commit-ci[bot]", "web-flow"] attr = 'lazy_loader.__version__' [tool.ruff] -line-length = 88 exclude = [ "lazy_loader/tests/fake_pkg/__init__.pyi", ] [tool.ruff.lint] -select = [ - "C", - "E", - "F", - "W", - "B", - "I", - "UP", +extend-select = [ + "B", # flake8-bugbear + "I", # isort + "ARG", # flake8-unused-arguments + "C4", # flake8-comprehensions + "EM", # flake8-errmsg + "ICN", # flake8-import-conventions + "G", # flake8-logging-format + "PGH", # pygrep-hooks + "PIE", # flake8-pie + "PL", # pylint + "PT", # flake8-pytest-style +# "PTH", # flake8-use-pathlib + "RET", # flake8-return + "RUF", # Ruff-specific + "SIM", # flake8-simplify + "T20", # flake8-print + "UP", # pyupgrade + "YTT", # flake8-2020 + "EXE", # flake8-executable + "NPY", # NumPy specific rules + "PD", # pandas-vet + "FURB", # refurb + "PYI", # flake8-pyi +] +ignore = [ + "PLR09", # Too many <...> + "PLR2004", # Magic value used in comparison + "ISC001", # Conflicts with formatter + "B018", # Found useless expression + "B028", # No explicit `stacklevel` keyword argument found + "PT011", # `pytest.raises(ValueError)` is too broad + "EM102", # Exception must not use an f-string literal + "EM101", # Exception must not use a string literal + "RET505", # Unnecessary `elif` after `return` statement + "SIM108", # Use ternary operator ] -ignore = ["B018", "B028"] + +[tool.ruff.format] +docstring-code-format = true