API Reference

The following section outlines the API of apip.

Client

Attributes
Methods
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

str

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

list

await get(package, version=None)

Returns a Package object for a given package name. Queries data from the PyPi API.

Parameters
  • package (str) – The name of the package to get.

  • version (str) – The version of the package to get.

Returns

A Package object for the given package.

Return type

Package

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
  • name (str) – The name of the package.

  • version (str) – The version of the package.

Attr name

The name of the package.

Attr version

The version of the package.

property name

Returns the name of the package.

Returns

The name of the package.

Return type

str

property index

Returns the index URL for the package.

Returns

The index URL for the package.

Return type

str

property version

Returns the version of the package.

Returns

The version of the package.

Return type

str

property author

Returns the author of the package.

Returns

The author of the package.

Return type

str

property summary

Returns the summary of the package.

Returns

The summary of the package.

Return type

str

property license

Returns the license of the package.

Returns

The license of the package.

Return type

str

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

Package

Raises
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.PipException

Bases: Exception

A base class for apip exceptions.

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.

Exception Hierarchy