pip is a command line program. While it is implemented in Python, and so is available for import, you must not use pip's internal APIs in this way. Typing information is provided as a convenience only and is not a gaurantee. Expect unannounced changes to the API and types in releases.