Reference
Contains a rundown of the functionality exposed by quibraries, including exposes modules and classes along with
their definitions, arguments, and types.
- class quibraries.LibIOSession(api_key: str = '')[source]
Used to perform regular, non-iterable requests to libraries.io.
- make_request(op: SearchOperationTypes | SubscribeOperationTypes, req_type: HttpOperation, *args, **kwargs) dict | list[source]
Make the request to libraries.io
API.- Parameters:
op (SearchOperationTypes | SubscribeOperationTypes) – The operation to perform when making the request.
req_type (HttpOperation) – Part of the
HttpOperationenum which can be either get, post, put, or delete.
- Returns:
Returns the
jsonencoded response from libraries.io.- Return type:
(dict | list)
- class quibraries.LibIOIterableRequest(op: SearchOperationTypes | SubscribeOperationTypes, req_type: HttpOperation, *args, **kwargs)[source]
Class that facilitates iterated requests to facilitate a more user-friendly pagination functionality. Apart from its constructor no other method is exposed.
- class quibraries.HttpOperation(value)[source]
Helper enum that defines the http codes
- GET = 'get'
The HTTP
GEToperation.
- POST = 'post'
The HTTP
POSToperation.
- PUT = 'put'
The HTTP
PUToperation.
- DELETE = 'delete'
The HTTP
DELETEoperation.
- class quibraries.Search(api_key: str = '')[source]
Class for wrapping the libraries.io
APIfor platform, project, repo, and userGETactions.- platforms(page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Return a list of supported package managers.
- Parameters:
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool) – Flag that indicates if we are to return a consumable iterator for pagination.
- Returns:
List of dicts of platforms with platform info from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- project(platform: str, project: str) dict | list[source]
Return information about a project and its versions from a platform (e.g. “PyPi”).
- Parameters:
platform (str) – The package manager (e.g. “PyPi”).
project (str) – The project name.
- Returns:
List of dictionaries with information about the project from libraries.io.
- Return type:
(dict | list)
- project_dependencies(platform: str, project: str, version: str = 'latest', page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Get a list of dependencies for a given version of a project. By default, it returns the dependencies for the latest version on record.
- Parameters:
platform (str) – The package manager (e.g. “PyPi”).
project (str) – The project name.
version (str) – The project version, by default it is equal to ‘latest’.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool) – Flag that indicates if we are to return a consumable iterator for pagination.
- Returns:
Dict of dependencies for a version of a project from libraries.io.
- Return type:
(dict | list | Iterator[dict | list])
- project_dependents(platform: str, project: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Gets the list of projects that have at least one version that depends on a given project. By default, it returns information for the most recent version of the project libraries.io has on their record.
- Parameters:
platform (str) – The package manager (e.g. “PyPi”).
project (str) – The project name.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool) – Flag that indicates if we are to return a consumable iterator for pagination.
- Returns:
List of dicts project dependents from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- project_dependent_repositories(platform: str, project: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Get a list of repositories that depend on a given project.
- Parameters:
platform (str) – The package manager (e.g. “PyPi”).
project (str) – The project name.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool) – Flag that indicates if we are to return a consumable iterator for pagination.
- Returns:
List of dicts of dependent repositories from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- project_contributors(platform: str, project: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Get a list of users that have contributed to a given project.
- Parameters:
platform (str) – The package manager.
project (str) – The project name.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool) – Flag that indicates if we are to return a consumable iterator for pagination.
- Returns:
List of dicts of project contributor info from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- project_sourcerank(platform: str, project: str) list | dict[source]
Get breakdown of SourceRank score for a given project.
- Parameters:
platform (str) – The package manager.
project (str) – The project name.
- Returns:
Dict of sourcerank info response from libraries.io.
- Return type:
(list | dict)
- project_search(query: str = '', filters: dict[SearchFilterTypes, set[str]] | None = None, sort: SearchSortTypes | None = None, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Search for projects, which mimics the functionality provided by libraries.io. To ensure type safety and avoid mishaps the sorting and filtering types have been encapsulated into two enumerations,
SearchFilterTypes()andSearchSortTypes().An example of how to use it is as follows,
- Parameters:
query (str) – The query to search for, by default it is empty.
filters (dict[SearchFilterTypes, set[str]] | None) – The filters to perform, as described
SearchFilterTypes. (in) –
sort (SearchSortTypes | None) – One of options defined in SearchSortTypes enumeration.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier
pagination. –
- Returns:
List of dicts of project info from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- repository(host: str, owner: str, repo: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns information about a repository. Note, this currently only works for open source repositories.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”).
owner (str) – The owner.
repo (str) – The repository name.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier
pagination. –
- Returns:
List of dicts of info about a repository from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- repository_dependencies(host: str, owner: str, repo: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list with information about a repository’s dependencies.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”).
owner (str) – The owner.
repo (str) – The repository name.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier pagination.
- Returns:
Dict of repo dependency info from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- repository_projects(host: str, owner: str, repo: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list of projects referencing the given repository.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”)
owner (str) – The repository owner.
repo (str) – The repository name.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier pagination.
- Returns:
List of dicts of projects referencing a repo from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- user(host: str, user: str) list | dict[source]
Returns information about the given user.
- Parameters:
host (str) – The name of host provider (e.g. “GitHub”).
user (str) – The username.
- Returns:
Dict of info about user from libraries.io.
- Return type:
(list | dict)
- user_repositories(host: str, user: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list with information about a user repos.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”).
user (str) – The username.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier pagination.
- Returns:
List of dicts with info about user repos from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- user_packages(host: str, user: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list of packages and their information referencing the given user’s repositories.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”).
user (str) – The username.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier pagination.
- Returns:
List of dicts of user packages info from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- user_packages_contributions(host: str, user: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list of packages that the given user has contributed to.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”).
user (str) – The username.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier pagination.
- Returns:
List of dicts with user packages contribution info from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- user_repository_contributions(host: str, user: str, page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list with information about the repositories the given user has contributed to.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”).
user (str) – The username.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier pagination.
- Returns:
List of dicts response from libraries.io.
- Return type:
(list | dict | Iterator[list | dict])
- user_dependencies(host: str, user: str, platform: str = '', page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list of the unique packages that the given user’s repositories list as a dependency.
Ordered by frequency of use in those repositories. The request can be parameterised by platform.
- Parameters:
host (str) – The host provider name (e.g. “GitHub”).
user (str) – The username.
platform (str) – The platform to search dependencies within (e.g. “PyPi”) - by default returns results from any platform.
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool = False) – Indicates if the request should return a consumable iterator for easier pagination.
- Returns:
List of dicts with user project dependency info.
- Return type:
(list | dict | Iterator[list | dict])
- class quibraries.Subscribe(api_key: str = '')[source]
Class for libraries.io
APIfor changing user’s subscriptions.- user_subscriptions(page: int = 1, per_page: int = 30, iterated: bool = False) list | dict | Iterator[list | dict][source]
Returns a list of packages a user is subscribed to for release notifications.
- Parameters:
page (int) – The page to get from the list, default is to get the first page.
per_page (int) – The items per page to return, the default is 30.
iterated (bool) – If the request is iterated or not - i.e. returns a consumable iterator.
- Returns:
Dict with info for each package subscribed to at libraries.io.
- Return type:
(dict | list | Iterable[dict | list])
- subscribe(platform: str, project: str, include_prerelease: bool = False) dict | list[source]
Subscribe to receive notifications about new releases of a project.
Note include_prerelease argument might not be working fully; potentially due to a possible bug at libraries.io…? Use with caution.
- Parameters:
platform (str) – The package manager name (e.g. “PyPi”).
project (str) – The package name.
include_prerelease (bool) – If we include prerelease versions.
- Returns:
Subscription confirmation message.
- Return type:
(dict | list)
- check_if_subscribed(platform: str, project: str) bool[source]
Check if a user is subscribed to notifications for new project releases.
- Parameters:
platform (str) – The package manager name (e.g. “PyPi”).
project (str) – The package name.
- Returns:
Trueif subscribed to the package indicated, elseFalse.- Return type:
(bool)
- update_subscription(platform: str, project: str, include_prerelease: bool = False) dict | list[source]
Update the options for a subscription.
Note include_prerelease argument might not be working fully; potentially due to a bug at libraries.io…? Use with caution.
- Parameters:
platform (str) – The package manager name (e.g. “PyPi”).
project (str) – The package name.
include_prerelease (bool) – Include prerelease notifications, by default is
False.
- Returns:
Update confirmation message.
- Return type:
(dict | list)
- unsubscribe(platform: str, project: str) dict | list[source]
Stop receiving release notifications from a project.
- Parameters:
platform (str) – The package manager name (e.g. “PyPi”).
project (str) – The package name.
- Returns:
Message confirming deleted or deletion unnecessary.
- Return type:
(dict | list)
- class quibraries.SearchFilterTypes(value)[source]
The filter types accepted by libraries.io.
- LANGUAGES: str = 'languages'
Enables filtering by language.
- LICENSES: str = 'licenses'
Enables filtering by licenses.
- KEYWORDS: str = 'keywords'
Enables to filter by using keywords.
- PLATFORMS: str = 'platforms'
Enables to filter based on the platform.
- class quibraries.SearchSortTypes(value)[source]
The sort types accepted by libraries.io.
- CONTRIBUTIONS_COUNT: str = 'contributions_count'
Sort by the contributions count.
- CREATED_AT: str = 'created_at'
Sort by the created date.
- DEPENDENTS_COUNT: str = 'dependents_count'
Sort by the dependents count.
- DEPENDENT_REPOS_COUNT: str = 'dependents_repo_count'
Sort by the dependent repositories count.
- LATEST_RELEASE_PUBLISHED_AT: str = 'latest_release_published_at'
Sort by the latest released publish date.
- RANK: str = 'rank'
Sort by SourceRank.
- STARS: str = 'stars'
Sort by the number of stars.
- class quibraries.SearchOperationTypes(value)[source]
The Search operation types enumeration as provided by libraries.io.
- PLATFORMS: str = 'platforms'
Returns the platforms available by libraries.io.
- PROJECT: str = 'project'
Searches for a specific project details.
- PROJECT_DEPENDENCIES: str = 'project-dependencies'
Searches for project dependencies.
- PROJECT_DEPENDENTS: str = 'project-dependents'
Searches for project dependents.
- PROJECT_DEPENDENT_REPOSITORIES: str = 'project-dependent-repositories'
Searches for project dependent repositories.
- PROJECT_CONTRIBUTORS: str = 'project-contributors'
Searches for project contributors.
- PROJECT_SOURCERANK: str = 'project-sourcerank'
Searches for the project SourceRank details.
- PROJECT_SEARCH: str = 'project-search'
Searches for projects.
- REPOSITORY: str = 'repository'
Searches for a specific repository details.
- REPOSITORY_DEPENDENCIES: str = 'repository-dependencies'
Searches for the repository dependencies.
- REPOSITORY_PROJECTS: str = 'repository-projects'
Searches for list of packages referring the given repository.
- USER: str = 'user'
Searches for the details of a specific user.
- USER_REPOSITORIES: str = 'user-repositories'
Searches for the details of the user’s repositories.
- USER_REPOSITORY_CONTRIBUTIONS: str = 'repository-contributions'
Searches for the details of the repositories the user has given contributions.
- USER_PACKAGES: str = 'user-packages'
Searches for packages referencing the given user’s repositories.
- USER_PACKAGES_CONTRIBUTIONS: str = 'user-packages-contributions'
Searches for the details of packages that the user has given contributions.
- USER_DEPENDENCIES: str = 'user-dependencies'
Searches for the unique packages that the given user’s repositories list as a dependency.
- class quibraries.SubscribeOperationTypes(value)[source]
The Subscribe operation types enumeration as provided by libraries.io.
- USER_SUBSCRIPTIONS: str = 'user-subscriptions'
Performs the retrieval of the current user’s given subscriptions.
- SUBSCRIBE_USER_TO_PROJECT: str = 'subscribe-user-to-project'
Subscribes a user to the given project.
- UNSUBSCRIBE_USER_FROM_PROJECT: str = 'unsubscribe-user-from-project'
Unsubscribes a user from a given project.
- CHECK_IF_SUBSCRIBED_TO_PROJECT: str = 'check-if-subscribed'
Checks if the user is subscribed to the given project.
- UPDATE_SUBSCRIPTION_TO_PROJECT: str = 'update-subscription-to-project'
Updates the subscription of the given user to the provided project.