swh.lister.packagist.lister module

swh.lister.packagist.lister.compute_package_url(repo_name: str) → str[source]

Compute packgist package url from repo name.

class swh.lister.packagist.lister.PackagistLister(override_config=None)[source]

Bases: swh.lister.core.lister_transports.ListerOnePageApiTransport, swh.lister.core.simple_lister.SimpleLister

List packages available in the Packagist package manager.

The lister sends the request to the url present in the class variable PAGE, to receive a list of all the package names present in the Packagist package manager. Iterates over all the packages and constructs the metadata url of the package from the name of the package and creates a loading task:

Task:
    Type: load-packagist
    Policy: recurring
    Args:
        <package_name>
        <package_metadata_url>

Example:

Task:
    Type: load-packagist
    Policy: recurring
    Args:
        'hypejunction/hypegamemechanics'
        'https://repo.packagist.org/p/hypejunction/hypegamemechanics.json'
MODEL

alias of swh.lister.packagist.models.PackagistModel

LISTER_NAME = 'packagist'
PAGE = 'https://packagist.org/packages/list.json'
instance = 'packagist'
task_dict(origin_type: str, origin_url: str, **kwargs: Mapping[str, str]) → Dict[str, Any][source]

Return task format dict

This is overridden from the lister_base as more information is needed for the ingestion task creation.

list_packages(response: Any) → List[str][source]

List the actual packagist origins from the response.

get_model_from_repo(repo_name: str) → Mapping[str, str][source]

Transform from repository representation to model