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:
Remote
AUR 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
default constructor
- 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)
- 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]
- 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) list[AURPackage]
search package in AUR web
- Parameters:
*keywords (str) – keywords 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]
- 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
- classmethod remote_git_url(package_base: str, repository: str) str
generate remote git url from the package base
- Args
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
- Args
package_base(str): package base
- Returns:
web url for the specific base
- Return type:
str
ahriman.core.alpm.remote.official module
- class Official(configuration: Configuration | None = None, section: str | None = None, *, suppress_errors: bool = False)
Bases:
Remote
official 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
default constructor
- 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)
- 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) list[AURPackage]
search package in AUR web
- Parameters:
*keywords (str) – keywords 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]
- 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
- classmethod remote_git_url(package_base: str, repository: str) str
generate remote git url from the package base
- Args
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
- Args
package_base(str): package base
- Returns:
web url for the specific base
- Return type:
str
ahriman.core.alpm.remote.official_syncdb module
- class OfficialSyncdb(configuration: Configuration | None = None, section: str | None = None, *, suppress_errors: bool = False)
Bases:
Official
official 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.
default constructor
- 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
ahriman.core.alpm.remote.remote module
- class Remote(configuration: Configuration | None = None, section: str | None = None, *, suppress_errors: bool = False)
Bases:
SyncHttpClient
base 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)
Differnece between
search()
andmultisearch()
is thatsearch()
passes all arguments to underlying wrapper directly, whereasmultisearch()
splits search one by one and finds intersection between search results.default constructor
- 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) AURPackage
get package info by its name
- Parameters:
package_name (str) – package name to search
pacman (Pacman | None, optional) – alpm wrapper instance, required for official repositories search (Default value = None)
- Returns:
package which match the package name
- Return type:
- classmethod multisearch(*keywords: str, pacman: Pacman | 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)
- Returns:
list of packages each of them matches all search terms
- 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_search(*keywords: str, pacman: Pacman | 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
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]
- Raises:
NotImplementedError – not implemented method
- classmethod remote_git_url(package_base: str, repository: str) str
generate remote git url from the package base
- Args
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
- Args
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) 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)
- Returns:
list of packages which match the criteria
- Return type:
list[AURPackage]