swh.lister.elm package#


Module contents:

Elm lister#

Elm is a functional language that compiles to JavaScript.

Additional packages for the language can be searched from the Packages website and installed with elm install command. The Elm packages website also provides a Http Api endpoint listing all available packages versions since a count of package versions.

Elm origins are Git repositories hosted on GitHub. Each repository must provide its packaged releases using the GitHub release system.

As of July 2023 Packages list 1746 packages.

Origins retrieving strategy#

To build a list of origins we make a GET request to the Http Api endpoint with a since argument as a sequential index in the history which returns a Json array of strings. Each string represents a new version for a package. The string is split to get the name of the package. The origin url for each package is constructed with the information of corresponding name entry which represents the suffix of GitHub repositories (org/project_name).

Page listing#

There is only one page listing all origins url.

Origins from page#

The lister is stateful and yields all new origins url from one page since the last run. It is a list of package repository url.

Running tests#

Activate the virtualenv and run from within swh-lister directory:

pytest -s -vv --log-cli-level=DEBUG swh/lister/elm/tests

Testing with Docker#

Change directory to swh/docker then launch the docker environment:

docker compose up -d

Then schedule a elm listing task:

docker compose exec swh-scheduler swh scheduler task add -p oneshot list-elm

You can follow lister execution by displaying logs of swh-lister service:

docker compose logs -f swh-lister