Functions | |
| str | async_get_user_site (str deps_dir) |
| set[str] | get_installed_versions (set[str] specifiers) |
| bool | install_package (str package, bool upgrade=True, str|None target=None, str|None constraints=None, int|None timeout=None) |
| bool | is_docker_env () |
| bool | is_installed (str requirement_str) |
| bool | is_virtual_env () |
Variables | |
| _LOGGER = logging.getLogger(__name__) | |
| tuple | _UV_ENV_PYTHON_VARS |
Helpers to install PyPi packages.
| str homeassistant.util.package.async_get_user_site | ( | str | deps_dir | ) |
Return user local library path. This function is a coroutine.
Definition at line 162 of file package.py.
| set[str] homeassistant.util.package.get_installed_versions | ( | set[str] | specifiers | ) |
Return a set of installed packages and versions.
Definition at line 35 of file package.py.
| bool homeassistant.util.package.install_package | ( | str | package, |
| bool | upgrade = True, |
||
| str | None | target = None, |
||
| str | None | constraints = None, |
||
| int | None | timeout = None |
||
| ) |
Install a package on PyPi. Accepts pip compatible package strings. Return boolean if install successful.
Definition at line 93 of file package.py.
| bool homeassistant.util.package.is_docker_env | ( | ) |
Return True if we run in a docker env.
Definition at line 30 of file package.py.
| bool homeassistant.util.package.is_installed | ( | str | requirement_str | ) |
Check if a package is installed and will be loaded when we import it. expected input is a pip compatible package specifier (requirement string) e.g. "package==1.0.0" or "package>=1.0.0,<2.0.0" For backward compatibility, it also accepts a URL with a fragment e.g. "git+https://github.com/pypa/pip#pip>=1" Returns True when the requirement is met. Returns False when the package is not installed or doesn't meet req.
Definition at line 40 of file package.py.
| bool homeassistant.util.package.is_virtual_env | ( | ) |
Return if we run in a virtual environment.
Definition at line 21 of file package.py.
|
private |
Definition at line 18 of file package.py.
|
private |
Definition at line 87 of file package.py.