API Reference¶
The following section outlines the API of apip.
Client¶
- class apip.Client(index='https://pypi.org/simple')¶
The main class for the apip API wrapper. This class is used to interact with the Pip and PyPi API.
- Parameters
index (str) – The index to install the package from.
- property index¶
Returns the index to install the package from.
- Returns
The index to install the package from.
- Return type
- list()¶
Lists all installed packages and returns them in a list of Package objects.
- Returns
A list of Package objects for all installed packages.
- Return type
- await get(package, version=None)¶
Returns a Package object for a given package name. Queries data from the PyPi API.
- Parameters
- Returns
A Package object for the given package.
- Return type
- Raises
PackageNotFoundException – The package was not found.
Package¶
- class apip.Package(name, version, author=None, summary=None, description=None, license=None)¶
A base class that wraps around Pip packages
- Parameters
- Attr name
The name of the package.
- Attr version
The version of the package.
- property index¶
Returns the index URL for the package.
- Returns
The index URL for the package.
- Return type
- property version¶
Returns the version of the package.
- Returns
The version of the package.
- Return type
- property author¶
Returns the author of the package.
- Returns
The author of the package.
- Return type
- property summary¶
Returns the summary of the package.
- Returns
The summary of the package.
- Return type
- property license¶
Returns the license of the package.
- Returns
The license of the package.
- Return type
- install()¶
Installs a package through the Pip API. Returns a Package object for the installed package.
- Returns
A Package object for the installed package.
- Return type
- Raises
PackageNotFoundException – The package was not found.
self.VersionNotFoundException – The version was not found.
ConnectionException – The connection to PyPi was unsuccessful.
- uninstall(name)¶
Uninstalls a package through the Pip API.
- Parameters
name – The name of the package to uninstall.
- Raises
PackageNotFoundException – The package was not found.
Exceptions¶
The following exceptions are thrown by the library.
- exception apip.errors.ConnectionException¶
Bases:
PipException
An exception raised when the API could not access the server.
- exception apip.errors.PackageException¶
Bases:
PipException
A base exception for package errors.
- exception apip.errors.PackageNotFoundException¶
Bases:
PackageException
An exception that is raised when the API could not find the package.
- exception apip.errors.VersionNotFoundException¶
Bases:
PackageException
An exception raised when the version is not available for the specified package.