Asynchronous API
This section details the asynchronous components of the pipmaster
library, primarily found within the pipmaster.async_package_manager
module.
Asynchronous Package Manager using pip.
Provides an async class and functions to interact with pip asynchronously.
Author: ParisNeo Created: 23/04/2025 Last Updated: 24/04/2025
- class pipmaster.async_package_manager.AsyncPackageManager(python_executable: str | None = None, pip_command_base: List[str] | None = None)[source]
Bases:
object
Manages Python package installations and queries using pip asynchronously. Mirrors the synchronous PackageManager interface but uses async methods.
- __init__(python_executable: str | None = None, pip_command_base: List[str] | None = None)[source]
Initializes the AsyncPackageManager.
- async install(package: str, index_url: str | None = None, force_reinstall: bool = False, upgrade: bool = True, extra_args: List[str] | None = None, dry_run: bool = False, verbose: bool = False) bool [source]
Async version of install.
- async install_if_missing(package: str, version_specifier: str | None = None, always_update: bool = False, index_url: str | None = None, extra_args: List[str] | None = None, dry_run: bool = False, verbose: bool = False) bool [source]
Async version of install_if_missing.
- async ensure_packages(requirements: str | Dict[str, str | None] | List[str], index_url: str | None = None, extra_args: List[str] | None = None, dry_run: bool = False, verbose: bool = False) bool [source]
Async version of ensure_packages.
- async install_multiple(packages: List[str], index_url: str | None = None, force_reinstall: bool = False, upgrade: bool = True, extra_args: List[str] | None = None, dry_run: bool = False, verbose: bool = False) bool [source]
Async version of install_multiple.
- async uninstall(package: str, extra_args: List[str] | None = None, dry_run: bool = False, verbose: bool = False) bool [source]
Async version of uninstall.
- async pipmaster.async_package_manager.async_install(package: str, **kwargs: Any) bool [source]
Installs a single package asynchronously.
- async pipmaster.async_package_manager.async_install_if_missing(package: str, **kwargs: Any) bool [source]
Conditionally installs a single package asynchronously.
- async pipmaster.async_package_manager.async_ensure_packages(requirements: str | Dict[str, str | None] | List[str], **kwargs: Any) bool [source]
Ensures a set of requirements are met asynchronously.
- async pipmaster.async_package_manager.async_install_multiple(packages: List[str], **kwargs: Any) bool [source]
Installs multiple packages asynchronously.
- async pipmaster.async_package_manager.async_uninstall(package: str, **kwargs: Any) bool [source]
Uninstalls a single package asynchronously.
- async pipmaster.async_package_manager.async_uninstall_multiple(packages: List[str], **kwargs: Any) bool [source]
Uninstalls multiple packages asynchronously.
- async pipmaster.async_package_manager.async_get_package_info(package_name: str) str | None [source]
Gets package details asynchronously.
- async pipmaster.async_package_manager.async_check_vulnerabilities(**kwargs: Any) Tuple[bool, str] [source]
Checks for vulnerabilities asynchronously.
Note
Similar to the synchronous API, async functions like async_install
are exposed at the top level (e.g., pipmaster.async_install
) as convenience wrappers around a default AsyncPackageManager
instance.
Warning
Functions for checking package status (is_installed()
, get_installed_version()
, is_version_compatible()
) do not have direct async counterparts as they rely on the synchronous importlib.metadata
library. See the Asynchronous Operations guide for strategies on using them in async code.