Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Add setting to do deep requirement inspection (#606)
Browse files Browse the repository at this point in the history
Always do deep inspections for local code
closes #548
  • Loading branch information
mike0sv authored Feb 14, 2023
1 parent 4c8e1a7 commit f51fbe2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions mlem/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class Config:
EMOJIS: bool = True
STATE: Dict = {}
SERVER: Dict = {}
DEEP_INSPECTION: bool = False

@property
def storage(self):
Expand Down
8 changes: 5 additions & 3 deletions mlem/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pydantic.main import ModelMetaclass

import mlem
from mlem.config import LOCAL_CONFIG
from mlem.core.requirements import (
CustomRequirement,
InstallableRequirement,
Expand All @@ -36,7 +37,6 @@
PYTHON_BASE = os.path.dirname(threading.__file__)
# pylint: disable=no-member,protected-access
IGNORE_TYPES_REQ = (type(Requirements._abc_impl),) # type: ignore
DEEP_INSPECTION = False


def check_pypi_module(
Expand Down Expand Up @@ -602,9 +602,11 @@ def save(self, obj, save_persistent_id=True):
if id(obj) in self.seen or isinstance(obj, IGNORE_TYPES_REQ):
return None
self.seen.add(id(obj))
base_module = get_object_base_module(obj)
if (
get_object_base_module(obj) in self._modules
and not DEEP_INSPECTION
base_module in self._modules
and not is_local_module(base_module)
and not LOCAL_CONFIG.DEEP_INSPECTION
):
return None
self.add_requirement(obj)
Expand Down

0 comments on commit f51fbe2

Please sign in to comment.