From 39e4d2046e2075da85ee549bd75823c9f4354a6f Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Wed, 22 May 2024 09:47:10 +0200 Subject: [PATCH] fixes --- .pre-commit-config.yaml | 2 +- examples/benchmark.py | 2 +- examples/pickle_lgbm.py | 4 ++-- examples/pickle_sklearn.py | 4 ++-- examples/{utils.py => utils/__init__.py} | 0 pyproject.toml | 3 ++- 6 files changed, 8 insertions(+), 7 deletions(-) rename examples/{utils.py => utils/__init__.py} (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 744cecf..0e4830e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: # mypy - id: mypy name: mypy - entry: pixi run -e default mypy --ignore-missing-imports --scripts-are-modules + entry: pixi run -e default mypy language: system types: [python] require_serial: true diff --git a/examples/benchmark.py b/examples/benchmark.py index 1cf036e..210dd2b 100644 --- a/examples/benchmark.py +++ b/examples/benchmark.py @@ -7,8 +7,8 @@ import lightgbm as lgb from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegressor -from utils import generate_dataset +from examples.utils import generate_dataset from slim_trees import dumps_lgbm_compressed, dumps_sklearn_compressed from slim_trees.pickling import dumps_compressed, get_pickled_size, loads_compressed diff --git a/examples/pickle_lgbm.py b/examples/pickle_lgbm.py index b6cc375..031b30b 100644 --- a/examples/pickle_lgbm.py +++ b/examples/pickle_lgbm.py @@ -4,12 +4,12 @@ import lightgbm as lgb from lightgbm import Booster -from utils import ( + +from examples.utils import ( evaluate_compression_performance, evaluate_prediction_difference, generate_dataset, ) - from slim_trees import dump_lgbm_compressed from slim_trees.lgbm_booster import dump from slim_trees.pickling import load_compressed diff --git a/examples/pickle_sklearn.py b/examples/pickle_sklearn.py index 91a8f85..eec4439 100644 --- a/examples/pickle_sklearn.py +++ b/examples/pickle_sklearn.py @@ -2,12 +2,12 @@ import tempfile from sklearn.ensemble import RandomForestRegressor -from utils import ( + +from examples.utils import ( evaluate_compression_performance, evaluate_prediction_difference, generate_dataset, ) - from slim_trees import dump_sklearn_compressed from slim_trees.pickling import load_compressed from slim_trees.sklearn_tree import dump diff --git a/examples/utils.py b/examples/utils/__init__.py similarity index 100% rename from examples/utils.py rename to examples/utils/__init__.py diff --git a/pyproject.toml b/pyproject.toml index 2187bce..af7ae1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,8 +87,9 @@ indent-style = "space" python_version = "3.8" no_implicit_optional = true check_untyped_defs = true +scripts_are_modules = true [[tool.mypy.overrides]] # https://github.com/scikit-learn/scikit-learn/issues/16705 -module = "sklearn.*" +module = ["sklearn.*"] ignore_missing_imports = true