def __init__(self, core: Core, root_path: Optional[os.PathLike], is_global: bool = False) -> None: self._pyproject: Optional[Dict] = None self._lockfile: Optional[Dict] = None self._environment: Optional[Environment] = None self._python: Optional[PythonInfo] = None self.core = core if root_path is None: root_path = find_project_root( ) if not is_global else self.GLOBAL_PROJECT if not is_global and root_path is None and self.global_config[ "auto_global"]: self.core.ui.echo( "Project is not found, fallback to the global project", fg="yellow", err=True, ) root_path = self.GLOBAL_PROJECT is_global = True self.root = Path(root_path or "").absolute() self.is_global = is_global self.init_global_project()
def __init__(self, root_path: Optional[str] = None) -> None: if root_path is None: root_path = find_project_root() or "" self.root = Path(root_path).absolute() self.pyproject_file = self.root / self.PYPROJECT_FILENAME self.lockfile_file = self.root / "pdm.lock" self._pyproject = None # type: Optional[Container] self._lockfile = None # type: Optional[Container] self._config = None # type: Optional[Config] context.init(self)
def __init__(self, root_path: Optional[str] = None) -> None: self.is_global = False self._pyproject = None # type: Optional[Container] self._lockfile = None # type: Optional[Container] self.core = None if root_path is None: root_path = find_project_root() if root_path is None and self.global_config["auto_global"]: self.root = self.GLOBAL_PROJECT self.is_global = True self.init_global_project() else: self.root = Path(root_path or "").absolute()
def __init__(self, root_path: Optional[str] = None) -> None: self.is_global = False self._pyproject: Optional[Dict] = None self._lockfile: Optional[Dict] = None self._environment: Optional[Environment] = None self._python_executable: Optional[str] = None if root_path is None: root_path = find_project_root() if root_path is None and self.global_config["auto_global"]: self.root = self.GLOBAL_PROJECT self.is_global = True self.init_global_project() else: self.root = Path(root_path or "").absolute()
def __init__( self, core: Core, root_path: str | Path | None, is_global: bool = False, global_config: str | Path | None = None, ) -> None: self._pyproject: dict | None = None self._lockfile: dict | None = None self._environment: Environment | None = None self._python: PythonInfo | None = None self.core = core if global_config is None: global_config = Path.home() / ".pdm/config.toml" self.global_config = Config(Path(global_config), is_global=True) global_project = Path(self.global_config["global_project.path"]) if root_path is None: root_path = ( find_project_root(max_depth=self.global_config["project_max_depth"]) if not is_global else global_project ) if ( not is_global and root_path is None and self.global_config["global_project.fallback"] ): self.core.ui.echo( "Project is not found, fallback to the global project", fg="yellow", err=True, ) root_path = global_project is_global = True self.root = Path(root_path or "").absolute() self.is_global = is_global self.init_global_project() self._lockfile_file = self.root / "pdm.lock"