diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 4cc94342..946f2c83 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -707,7 +707,7 @@ class Interpreter(Script): """ _allow_descriptor_getattr_default = True - def __init__(self, code, namespaces, **kwds): + def __init__(self, code, namespaces, *, project=None, **kwds): try: namespaces = [dict(n) for n in namespaces] except Exception: @@ -720,8 +720,11 @@ class Interpreter(Script): if not isinstance(environment, InterpreterEnvironment): raise TypeError("The environment needs to be an InterpreterEnvironment subclass.") - super().__init__(code, environment=environment, - project=Project(Path.cwd()), **kwds) + if project is None: + project = Project(Path.cwd()) + + super().__init__(code, environment=environment, project=project, **kwds) + self.namespaces = namespaces self._inference_state.allow_descriptor_getattr = self._allow_descriptor_getattr_default