Skip to content

pkg

thkit.pkg

Functions:

check_package(package_name: str, auto_install: bool = False, git_repo: str | None = None, conda_channel: str | None = None)

Check if the required packages are installed.

install_package(package_name: str, git_repo: str | None = None, conda_channel: str | None = None) -> None

Install the required package.

Parameters:

  • package_name (str) –

    package name

  • git_repo (str, default: None ) –

    git path for the package. Default: None. E.g., http://somthing.git

  • conda_channel (str, default: None ) –

    conda channel for the package. Default: None. E.g., conda-forge

Notes
  • Default using: pip install -U {package_name}
  • If git_repo is provided: pip install -U git+{git_repo}
  • If conda_channel is provided: conda install -c {conda_channel} {package_name}

dependency_info(packages=['numpy', 'polars', 'thkit', 'ase']) -> str

Get the dependency information.

Parameters:

  • packages (list[str], default: ['numpy', 'polars', 'thkit', 'ase'] ) –

    list of package names

Note

Use importlib instead of __import__ for clarity.