Packs & Deployment
Create a pack: directory with pack.pl (name/1, version/1, title/1, author/2, requires/1) and prolog/ folder; publish via a Git URL.
44.1 Packs (SWI-Prolog packages)
Create a pack: directory with pack.pl (name/1, version/1, title/1, author/2, requires/1) and prolog/ folder; publish via a Git URL.
Popular packs: reif, func, lambda, list_util, quickcheck, regex, tabling extras, cplint, logtalk, lsp_server, markdown, tor (search strategies).
?- pack_list(json). % search
?- pack_install(reif). % install
?- pack_list_installed.
?- pack_upgrade(reif).
?- pack_remove(reif).44.2 Scripts and executables
qsave_program/2 creates a saved state containing compiled code. GNU Prolog's gplc produces native standalone binaries.
#!/usr/bin/env swipl
:- initialization(main, main).
main(Argv) :- format("Args: ~w~n", [Argv]).chmod +x script.pl && ./script.pl a b
swipl -o myapp -c main.pl --goal=main --stand_alone=true # saved state / executable44.3 Project structure
Use :- use_module(library(myproject)) after attaching the pack (attach_packs/2) or adding file_search_path/2.
myproject/
├── pack.pl
├── prolog/
│ ├── myproject.pl (main module)
│ └── myproject/utils.pl
├── test/
│ └── test_myproject.pl (plunit)
├── examples/
└── README.md44.4 Containers & CI
Official Docker image swipl:latest; run tests in CI with swipl -g run_tests -t halt test/test_myproject.pl.