ahriman.core.alpm.remote package
Submodules
ahriman.core.alpm.remote.aur module
- class AUR(configuration: Configuration | None = None, section: str | None = None, *, suppress_errors: bool = False)
Bases:
RemoteAUR RPC wrapper
- DEFAULT_AUR_URL
(class attribute) default AUR url
- Type:
str
- DEFAULT_RPC_URL
(class attribute) default AUR RPC url
- Type:
str
- DEFAULT_RPC_VERSION
(class attribute) default AUR RPC version
- Type:
str
- Parameters:
configuration (Configuration | None, optional) – configuration instance (Default value = None)
section (str | None, optional) – settings section name (Default value = None)
suppress_errors (bool, optional) – suppress logging of request errors (Default value = False)
- classmethod remote_git_url(package_base: str, repository: str) str
generate remote git url from the package base
- Parameters:
package_base (str) – package base
repository (str) – repository name
- Returns:
git url for the specific base
- Return type:
str
- classmethod remote_web_url(package_base: str) str
generate remote web url from the package base
- Parameters:
package_base (str) – package base
- Returns:
web url for the specific base
- Return type:
str
- static parse_response(response: dict[str, Any]) list[AURPackage]
parse RPC response to package list
- Parameters:
response (dict[str, Any]) – RPC response json
- Returns:
list of parsed packages
- Return type:
list[AURPackage]
- Raises:
PackageInfoError – for error API response
- aur_request(request_type: str, *args: str, **kwargs: str) list[AURPackage]
perform request to AUR RPC
- Parameters:
request_type (str) – AUR request type, e.g. search, info
*args (str) – list of arguments to be passed as args query parameter
**kwargs (str) – list of additional named parameters like by
- Returns:
response parsed to package list
- Return type:
list[AURPackage]
- Raises:
PackageInfoError – if multiple arguments are passed
- package_info(package_name: str, *, pacman: Pacman | None) AURPackage
get package info by its name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
- Returns:
package which match the package name
- Return type:
- Raises:
UnknownPackageError – package doesn’t exist
- package_provided_by(package_name: str, *, pacman: Pacman | None) list[AURPackage]
get package list which provide the specified package name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
- package_search(*keywords: str, pacman: Pacman | None, search_by: str | None) list[AURPackage]
search package in AUR web
- Parameters:
*keywords (str) – keywords to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
search_by (str | None) – search by keywords
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
ahriman.core.alpm.remote.official module
- class Official(configuration: Configuration | None = None, section: str | None = None, *, suppress_errors: bool = False)
Bases:
Remoteofficial repository RPC wrapper
- DEFAULT_ARCHLINUX_URL
(class attribute) default archlinux url
- Type:
str
- DEFAULT_ARCHLINUX_GIT_URL
(class attribute) default url for git packages
- Type:
str
- DEFAULT_SEARCH_REPOSITORIES
(class attribute) default list of repositories to search
- Type:
list[str]
- DEFAULT_RPC_URL
(class attribute) default archlinux repositories RPC url
- Type:
str
- Parameters:
configuration (Configuration | None, optional) – configuration instance (Default value = None)
section (str | None, optional) – settings section name (Default value = None)
suppress_errors (bool, optional) – suppress logging of request errors (Default value = False)
- classmethod remote_git_url(package_base: str, repository: str) str
generate remote git url from the package base
- Parameters:
package_base (str) – package base
repository (str) – repository name
- Returns:
git url for the specific base
- Return type:
str
- classmethod remote_web_url(package_base: str) str
generate remote web url from the package base
- Parameters:
package_base (str) – package base
- Returns:
web url for the specific base
- Return type:
str
- static parse_response(response: dict[str, Any]) list[AURPackage]
parse RPC response to package list
- Parameters:
response (dict[str, Any]) – RPC response json
- Returns:
list of parsed packages
- Return type:
list[AURPackage]
- Raises:
PackageInfoError – for error API response
- arch_request(*args: str, by: str) list[AURPackage]
perform request to official repositories RPC
- Parameters:
*args (str) – list of arguments to be passed as args query parameter
by (str) – search by the field
- Returns:
response parsed to package list
- Return type:
list[AURPackage]
- package_info(package_name: str, *, pacman: Pacman | None) AURPackage
get package info by its name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
- Returns:
package which match the package name
- Return type:
- Raises:
UnknownPackageError – package doesn’t exist
- package_search(*keywords: str, pacman: Pacman | None, search_by: str | None) list[AURPackage]
search package in AUR web
- Parameters:
*keywords (str) – keywords to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
search_by (str | None) – search by keywords
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
ahriman.core.alpm.remote.official_syncdb module
- class OfficialSyncdb(configuration: Configuration | None = None, section: str | None = None, *, suppress_errors: bool = False)
Bases:
Officialofficial repository wrapper based on synchronized databases.
Despite the fact that official repository provides an API for the interaction according to the comment in issue https://github.com/arcan1s/ahriman/pull/59#issuecomment-1106412297 we might face rate limits while requesting updates.
This approach also has limitations, because we don’t require superuser rights (neither going to download database separately), the database file might be outdated and must be handled manually (or kind of). This behaviour might be changed in the future.
Still we leave search function based on the official repositories RPC.
- Parameters:
configuration (Configuration | None, optional) – configuration instance (Default value = None)
section (str | None, optional) – settings section name (Default value = None)
suppress_errors (bool, optional) – suppress logging of request errors (Default value = False)
- package_info(package_name: str, *, pacman: Pacman | None) AURPackage
get package info by its name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
- Returns:
package which match the package name
- Return type:
- Raises:
UnknownPackageError – package doesn’t exist
- package_provided_by(package_name: str, *, pacman: Pacman | None) list[AURPackage]
get package list which provide the specified package name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
ahriman.core.alpm.remote.remote module
- class Remote(configuration: Configuration | None = None, section: str | None = None, *, suppress_errors: bool = False)
Bases:
SyncHttpClientbase class for remote package search
Examples
These classes are designed to be used without instancing. In order to achieve it several class methods are provided:
info(),multisearch()andsearch(). Thus, the basic flow is the following:>>> from ahriman.core.alpm.remote import AUR, Official >>> >>> package = AUR.info("ahriman") >>> search_result = Official.multisearch("pacman", "manager", pacman=pacman)
Difference between
search()andmultisearch()is thatsearch()passes all arguments to underlying wrapper directly, whereasmultisearch()splits search one by one and finds intersection between search results.- Parameters:
configuration (Configuration | None, optional) – configuration instance (Default value = None)
section (str | None, optional) – settings section name (Default value = None)
suppress_errors (bool, optional) – suppress logging of request errors (Default value = False)
- classmethod info(package_name: str, *, pacman: Pacman | None = None, include_provides: bool = False) AURPackage
get package info by its name. If
include_providesis set toTrue, then, in addition, this method will perform search byahriman.models.aur_package.AURPackage.providesand return first package found. Note, however, that in this case some implementation might not provide this method and search result will might not be stable- Parameters:
package_name (str) – package name to search
pacman (Pacman | None, optional) – alpm wrapper instance, required for official repositories search (Default value = None)
include_provides (bool, optional) – search by provides if no exact match found (Default value = False)
- Returns:
package which match the package name
- Return type:
- Raises:
UnknownPackageError – if requested package not found
- classmethod multisearch(*keywords: str, pacman: Pacman | None = None, search_by: str | None = None) list[AURPackage]
search in remote repository by using API with multiple words. This method is required in order to handle https://bugs.archlinux.org/task/49133. In addition, short words will be dropped
- Parameters:
*keywords (str) – search terms, e.g. “ahriman”, “is”, “cool”
pacman (Pacman | None, optional) – alpm wrapper instance, required for official repositories search (Default value = None)
search_by (str | None, optional) – search by keywords (Default value = None)
- Returns:
list of packages each of them matches all search terms
- Return type:
list[AURPackage]
- classmethod remote_git_url(package_base: str, repository: str) str
generate remote git url from the package base
- Parameters:
package_base (str) – package base
repository (str) – repository name
- Returns:
git url for the specific base
- Return type:
str
- Raises:
NotImplementedError – not implemented method
- classmethod remote_web_url(package_base: str) str
generate remote web url from the package base
- Parameters:
package_base (str) – package base
- Returns:
web url for the specific base
- Return type:
str
- Raises:
NotImplementedError – not implemented method
- classmethod search(*keywords: str, pacman: Pacman | None = None, search_by: str | None = None) list[AURPackage]
search package in AUR web
- Parameters:
*keywords (str) – search terms, e.g. “ahriman”, “is”, “cool”
pacman (Pacman | None, optional) – alpm wrapper instance, required for official repositories search (Default value = None)
search_by (str | None, optional) – search by keywords (Default value = None)
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
- package_info(package_name: str, *, pacman: Pacman | None) AURPackage
get package info by its name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
- Returns:
package which match the package name
- Return type:
- Raises:
NotImplementedError – not implemented method
- package_provided_by(package_name: str, *, pacman: Pacman | None) list[AURPackage]
get package list which provide the specified package name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
- package_search(*keywords: str, pacman: Pacman | None, search_by: str | None) list[AURPackage]
search package in AUR web
- Parameters:
*keywords (str) – keywords to search
pacman (Pacman | None) – alpm wrapper instance, required for official repositories search
search_by (str | None) – search by keywords
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
- Raises:
NotImplementedError – not implemented method