vpip.pip_api¶
pip
command API.
- vpip.pip_api.create_ns_from_dict(d)¶
Create a namespace object from a dict.
- Parameters:
d (dict) – Dictionary.
- Return type:
- vpip.pip_api.execute_pip(cmd, capture=False)¶
Run pip command.
- vpip.pip_api.freeze(include: Container[str] | None = None, exclude: Container[str] | None = None) List[str] ¶
List installed packages in
pip freeze
format (my_pkg==1.2.3
).- Parameters:
include – If defined, only returns specified packages.
exclude – If defined, exclude specified packages.
- vpip.pip_api.get_compatible_version(version)¶
Return the compatible version.
- Parameters:
version (str) – Version string.
- Returns:
The compatible version which could be used as
~={compatible_version}
.- Return type:
Suppose the version string is
x.y.z
:If
x
is zero then returnx.y.z
.Otherwise return
x.y
.
- vpip.pip_api.install(packages: List[str], install_scripts: str | None = None, upgrade: bool = False, latest: bool = False, deps: bool = True) List[str] ¶
Install packages and return a list of collected package names.
- Parameters:
packages – A list of package name, which may include the version specifier. It can also be a URL.
install_scripts – Install scripts to a different folder. It uses the
--install-option="--install-scripts=..."
pip option.upgrade – Upgrade package.
latest – Whether upgrade to the latest version. Otherwise upgrade to the compatible version. This option has no effect if
package
includes specifiers.deps – Whether to install dependencies.
- vpip.pip_api.install_editable()¶
Install the current cwd as editable package.
- vpip.pip_api.install_requirements(file='requirements.txt')¶
Install
requirements.txt
file.
- vpip.pip_api.list_(not_required=False, format='json')¶
List installed packages.
- Return type: