DEV Community


Writing a Package Manager for List Prolog

luciangreen profile image Lucian Green ・2 min read

I recently wrote List Prolog Package Manager (LPPM) - an online registry and installation tool for repositories my algorithms depend upon, where my algorithms are in a programming language called List Prolog, run by my SWI-Prolog interpreter algorithm.

What a Package Manager is

A package manager, by my definition, is a registry editor, viewer and installer of repositories (and their dependencies). Dependencies are other folders, or repositories on GitHub that contribute algorithm parts to the main repository. The repositories are side by side, they may rely on each other and commands are run from within folders. For LPPM, all the required dependencies are "at the top of the page" or in the main repositories' entry, they are not scattered through the registry. Also, I cut versions, ratings and download counts (for the sake of simplicity) because, arguably, everything's latest version should be compatible with everything's latest version (requiring careful testing) and ratings and download counts shouldn't matter in an ideal world.

Adding a Registry Entry to LPPM

In the screenshot below, you can see the registry entry HTML file on the Prolog server (actually my Mac acting as a local host). You can enter the repository's user name, repository name, description (with additional installation instructions in case it relies on an API or non-GitHub file somewhere else) and its dependencies (more user/repository pairs).

Adding a Registry Entry to LPPM

Viewing the Registry

In the screenshot below, you can view the registry for LPPM (which is on GitHub). It lists the repositories (or packages when they include their dependencies) and registry editing and installation instructions.

Viewing the Registry

List Prolog and "Everyone's Myness"

One of the best things about writing a Package Manager is it gives you ownership of your programming language's repositories. I can customise the PM and keep it on my server. Also, PMs encourage users to store files in their own repository rather than in one folder, preventing problems of replacing needed files. And you can install packages with a single command rather than clicking on multiple web pages.

Lucian Green

Discussion (0)

Editor guide