๐Ÿ”Œ Application Programming Interface#

galactic.helpers.market.core module.

class Market#

Bases: object

The Market class is used to produce a list of installable packages.

This class implements the Singleton pattern to ensure only one instance exists throughout the applicationโ€™s lifecycle. It aggregates the functionality of both a PackageManager and a ProxyManager.

__init__()#

Init the Market instance only once.

static __new__(cls)#

Override the object creation method to implement the Singleton pattern.

Return type:

Market

Returns:

Market: The singleton instance of the Market class.

property package_manager: PackageManager#

Get the package manager.

Returns:

The package manager

Return type:

PackageManager

property proxy_manager: ProxyManager#

Get the proxy manager.

Returns:

The proxy manager

Return type:

ProxyManager

class ProxyManager#

Bases: object

A class to manage a list of PyPI proxy URLs.

__init__()#

Initialize a ProxyManager instance with an empty list of proxy URLs.

add_proxy(proxy_url)#

Add a new proxy URL to the internal proxy list.

Parameters:

proxy_url (str) โ€“ The URL of the proxy to add.

Return type:

None

get_proxies()#

Retrieve the list of registered proxy URLs.

Return type:

list[str]

Returns:

list[str]: A list of proxy URLs.

get_proxy_name(url)#

Return the name of the proxy from a given URL.

Parameters:

url (str) โ€“ The URL of the proxy.

Return type:

str

Returns:

str: The name of the proxy if found, otherwise โ€œRepositoryโ€.

remove_proxy(proxy_name)#

Remove a proxy from the list based on its name.

Parameters:

proxy_name (str) โ€“ The name of the proxy to remove.

Return type:

bool

Returns:

bool: True if the proxy was found and removed, False otherwise.

class PackageManager#

Bases: object

PackageManager handles operations related to installed wheel (.whl) packages.

__init__()#

Initialize the PackageManager.

install_package(filename)#

Install a package by filename.

Parameters:

filename (str) โ€“ The name of the package file to retrieve.

Return type:

None

Note

This method is currently not implemented.

is_matching_package(kwargs)#

Check if a package matches a set of filtering criteria.

Parameters:

kwargs (dict[str, str]) โ€“ Criteria to match (e.g., name, version, etc.).

Return type:

bool

Returns:

bool: Always returns True for now (no actual matching logic implemented).

show_all_packages()#

Return full metadata for all packages found in the local cache.

Scans the user cache directory for wheel files and returns complete metadata for each one.

Return type:

list[dict[str, str]]

show_all_packages_summary()#

Return a summary (basic info) for all packages found in the local cache.

For each wheel file found, returns a summary including name, version, author, license, and description.

Return type:

list[dict[str, str]]

show_package(path)#

Extract and return full metadata from a wheel package.

Parameters:

path (Path) โ€“ Path to the wheel (.whl) file.

Return type:

dict[str, str]

Returns:

dict[str, str]: All metadata fields as key-value pairs.

Raises:

FileNotFoundError โ€“ If the file does not exist.:

show_package_summary(path)#

Extract and return a summary of key metadata fields from a package.

Parameters:

path (Path) โ€“ Path to the wheel (.whl) file.

Returns:

Metadata fields (name, version, summary, author, license).

Return type:

dict[str, str]

Raises:

FileNotFoundError โ€“ If the file does not exist.