Ann: SWI-Prolog 9.1.22

Dear SWI-Prolog user,

This release had a longer delay than what you are used to. It also
brings a lot more. In addition, it is a pre-release of SWI-Prolog
9.2.0 (stable), to be expected end of next week.

Highlights:

  • Janus, the Python interface is now considered stable. Final
    synchronization with XSB has taken place. We are in the
    process of writing up the PIP (Prolog Improvement Proposal)
    that documents the common part of the interface.

  • The coverage analysis tool has been moved from the plunit
    pack to the main library. In addition, it can now create
    coverage reports of multi-threaded programs and it can
    combine reports of multiple Prolog invocations.

  • The pack management system has been almost completely rewritten.
    The pack format has not changed. A brief summary of the changes:

    • Plan the installation of multiple packages, selecting a compatible
      combination.
    • Plan the installation, including dependencies before installing
      anything, first asking consent from the user. On accept, the
      packs are downloaded and the build process is established.
    • Deal with versions of dependencies as well as the Prolog version
      and Prolog features that may be required for the pack to function
    • Easily support installing packs specifically for a project in
      addition to user and system-wide packs.
    • More informative listing of packs, including listing only
      outdated packs.
    • More work on the app pack.
    • Combine and extend all pack related documentation into a single
      chapter of the manual.
    • Much better support for CMake base packs. The environ pack
      has been updated to cmake, using ctest for testing.
  • Several minor bug fixes and additions.

    Enjoy — Jan

SWI-Prolog Changelog since version 9.1.21

  • MODIDIED: library(prolog_pack) This is an extensive rewrite of the
    package infra structure. The pack format has not changed.

  • ADDED: swipl pack list: --installed option.

  • ENHANCED: Hide library(apply) from debugger.

  • ADDED: git_tags/2.

  • ADDED: git_branches/2: option remote(true).

  • ENHANCED: logic behind git_default_branch/2

  • ADDED: git_process_output/3: option status(-Status)

  • ADDED: Prolog flag rationals to claim rational number support.

  • ADDED: cov_property/1 Allows querying coverage collection system
    properties (currently only whether coverage data collection is active).

  • FIXED: #1222 answer subsumption pruning of answers may crash.

  • ADDED: library(prolog_coverage). This used to be available as
    library(test_cover) from the plunit package.

  • ADDED: ‘$cov_add’/3 to allow loading coverage data from a file.

  • CLEANUP: Removed predicate indicator from ‘$cov_data’/3 call_site/3
    term. Was not used and wrong anyway as it was not module qualified.

  • ADDED: git_current_branch/2. git_default_branch/2 was actually
    implementing getting the current branch. This commit renames
    git_default_branch/2 to git_current_branch/2, making it fail
    if there is no current branch (detached HEAD). It adds a
    new git_default_branch/2 that returns the branch related to
    refs/origin/HEAD.

  • FIXED: git_branches/2 to omit the reported detached head.

  • MODIFIED: Moved pack_attach/2 from the library to the core.
    This predicate is not about installing. This patch also deletes
    '$pack_attach'/1 and '$pack_attach'/2.

  • ADDED: library(git): is_git_hash/1.

  • FIXED: #1220 create_prolog_flag/3 using type(term), keep(true)
    If the initial type is not a term, the type must be set to term
    and the value must be converted.

  • ADDED: pack_install_local/3 This predicate adds one or more packs to
    the local project directory. Work in progress.

  • ADDED: Prolog environment variable SWIPL_PACK_PATH This defines
    the Prolog search path for packs at startup.

  • ADDED: Prolog flag path_sep. Provides access to OS path separator
    (: or ; for Windows).

  • ADDED: replace(+Bool) option to attach_packs/2. Allows attach_packs/2
    to clear the default package list.

  • FIXED: Make sure saving the environment always succeeds

  • ADDED: Allow installing git packs from a URL whose base name does
    not match the pack name

  • ENHANCED: Improve listing of packs

  • ADDED: pack_list/2 List packs with options.

  • ENHANCED: library(prolog_versions). Extended and improved
    require_prolog_version/2. Added require_version/3 and cmp_versions/3.
    Added to library documentation.

  • DOC: Succeed if there is no profiling support in this version.

  • FIXED: Keep track of base and size of the C-stack This information
    was stored in the thread-info structure. However, if an engine
    is detached and later attached in a new OS thread this information
    is wrong. We now cache it in the info structure, but we store it in
    a pthread key.

    This notably fixes thread interaction for JPL.

  • ENHANCED: always save buildenv.sh on pack build directory.

  • ADDED: swipl_add_test() to home/cmake/swipl.cmake

  • ADDED: Set ${swipl_module_dir} in home/cmake/swipl.cmake

  • FIXED: CMake error in home/cmake/swipl.cmake.

  • DOC: #1217 Improve documentation for selecting Python version.

  • BUILD: Disable Janus when using -DSTATIC_EXTENSIONS=ON

  • FIXED: Avoid PL_thread_attach_engine()/PL_thread_destroy_engine()
    destroying the thread. If this pair is called on a thread that already
    exists, it should not destroy the engine. This notably causes Janus
    to crash when running on a background thread. Reported by Fabrizio
    Riguzzi.

  • FIXED: Use snapshot/1 when computing exports This is used to update the
    autoload library as well as several other IDE related tasks. For this
    we read and expand the file until we find the first non-directive.
    This may however leave traces in dynamic predicates. Using snapshot/1
    avoids that.

    It is a partial work around. There could be other side-effects.
    Should
    probably be considered experimental.

  • FIXED: Declare more system dynamic predicates as not being subject
    to transactions. This fixes several issues when (auto)loading sources
    files inside snapshots (snapshot/1) or discarded transactions.

  • FIXED: #1213 transactions interfering with wrap_predicate/4. More
    generally, transactions and snapshots should not affect some system
    maintained dynamic predicates. The wrapper used by wrap_predicate/4
    is one example. This also affects dynamic predicates involved in
    loading sources. This patch disconnects whether predicates are
    subject to transactions from whether they are dynamic.

    For now, the ability to separate the two properties is reserved to the
    system.

  • FIXED: Consistency of LD and CC variables for building packages.

  • BUILD: Use static libraries to silence Windows Defender It appears
    that executables cannot be copied when Windows Defender is active.

  • BUILD: Use CMake recommended CMAKE_C_BYTE_ORDER when available

  • ENHANCED: Allow for some rounding and jitter when deciding INDEX.pl
    is out-of-date.

  • TEST: Make test_installation/0 run package tests concurrently.

  • CLEANUP: document many of the maintenance scripts and remove some
    outdated ones.

  • FIXED: require_prolog_version/2: silent failure of git version parsing
    Git version parsing fails if we are at a release.

  • ENHANCED: Declare wrap_predicate/4 body argument as meta-argument.

  • ENHANCED: library(prolog_colour) support for Prolog flags.

  • ADDED: library(prolog_colour): colorized known but unset flags.

  • ADDED: library(prolog_colour): support arithmetic function
    roundtoward/2. Second argument is not a function but a rounding
    mode identifier.

  • ADDED: arithmetic_function/1 to allow import/export If the
    implementation of a function is exported, it may be imported into
    another module and used. This patch also updates the documentation.

  • FIXED: pretty_print/2 to deal with bobs around an operator.

  • DOC: PL_new_term_refs() takes size_t since recently.

  • FIXED: Fixup script for MacOS bundle was not executed. Seems a change
    in recent CMake that requires the script to start with #!.

Package bdb

  • DOC: Build documentation

Package clib

  • ADDED: process_which/2 to find executable.

  • FIXED: directory_file_path/3: typo in raised exception.

Package cpp

  • DOC: Improve blob sample code

Package plunit

  • MODIFIED: removed library(test_cover). This library is moved to the
    core as library(prolog_coverage) because it has no dependencies on
    the unit testing and serves more purposes.

  • ADDED: library(test_cover): allow to save and restore coverage data.
    This patch is a major improvement to the coverage analysis tool.
    It modifies the API, although the old show_coverage/2 is still working
    as it used to.

    It improves the report and, most importantly, allows for combining
    coverage data from multiple Prolog invocations.

  • ADDED: cov_save_data/1.

  • FIXED: #23 allow set_tests_options([run(make(all))]).

  • DOC: Improved documentation for show_coverage/1,2

Package swipy

  • MODIFIED: Drop Module argument for py_dot/[4,5] (now py_dot/[3,4])
    Was ignored anyway. XSB dropped this argument as well.

  • MODIFIED: Get the default arguments from py_initialize/3 from the
    flag py_argv Just passing non-Prolog argv may be illegal to Python,
    crashing it during initialization.

  • COMPAT: Renamed py_object_type/2 to py_type/2 As agreed by the PIP
    meeting dd 2024-01-10.

  • FIXED: Make Janus work with single threaded Prolog.

  • ADDED: Reflection predicates This commet adds py_module_exists/1,
    py_hasattr/2, py_object_type/2 and py_isinstance/2.

    It renames py_obj_dir/2 and py_obj_dict/2 to py_object_dir/2 and
    py_object_dict/2. Old names are kept as deprecated.

    This is the result of the Dec 20 PIP meeting in Janus. The names
    nor implementation details are set in stone yet.

  • FIXED: Unify Python dict as Prolog dict It appears that the size
    reported by PyDict_Size() is not always the same as the number of
    iterations from PyDict_Next().

Package xpce

  • CLEANUP: Removed unused code.
3 Likes

MacOS release has version '9.1.22-DIRTY' resulting in an exception from require_prolog_version/2:

[debug]  ?- require_prolog_version('9.1.5',[rational]).
ERROR: Domain error: `version_string' expected, found `'9.1.22-DIRTY''
ERROR: In:
ERROR:   [17] throw(error(domain_error(version_string,'9.1.22-DIRTY'),_10292))
ERROR:   [16] error:domain_error(version_string,'9.1.22-DIRTY') at /Applications/SWI-Prolog9.1.22.app/Contents/swipl/library/error.pl:106
ERROR:   [15] prolog_versions:parse_version('9.1.22-DIRTY',_10362,_10364) at /Applications/SWI-Prolog9.1.22.app/Contents/swipl/library/prolog_versions.pl:251
ERROR:   [14] prolog_versions:require_version('SWI-Prolog','9.1.22-DIRTY','9.1.5') at /Applications/SWI-Prolog9.1.22.app/Contents/swipl/library/prolog_versions.pl:125
ERROR:   [13] prolog_versions:require_prolog_version('9.1.5') at /Applications/SWI-Prolog9.1.22.app/Contents/swipl/library/prolog_versions.pl:107
ERROR:   [12] prolog_versions:require_prolog_version('9.1.5',[rational]) at /Applications/SWI-Prolog9.1.22.app/Contents/swipl/library/prolog_versions.pl:102
ERROR:   [11] toplevel_call(user:user: ...) at /Applications/SWI-Prolog9.1.22.app/Contents/swipl/boot/toplevel.pl:1317
   Exception: (16) error:domain_error(version_string, '9.1.22-DIRTY') ? 

I’m guessing this should be a valid version for supporting development.

Thanks for reporting. Re-published as swipl-9.1.22-2.fat.dmg with the correct version information. Also fixed parsing the version info to deal with this format, but that fix is only in the git versions and enhanced the scripts to refuse to make a distribution from a “dirty” work directory.

I’m having troubles installing a custom pack with pack_install('pack-1.2.3.tgz', [global(true), interactive(false)]), the version in the file name is parsed by DCG and that later fails with Type error: text’ expected, found version([1,2,3])' (a compound). If I try passing the version in the options either as text or a term, validation fails and asks for the other one.

Thanks. Pushed a fix for this.

For py_module_exists/1 I get:

swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.22-26-g4eb8604da)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- py_module_exists(cupy).
% Interactive session; added `.` to Python `sys.path`
Deprecated: instead of py_call(Obj:Attr = Value), use py_setattr(Obj,Attr,Value)
true.

Sorry, no deprecation warning.
I was using git pull --recurse-submodules instead of

git pull
git submodule update --init

Thanks, I patched 9.2.21 manually with FIXED: pack_install/2 from an archive file. · SWI-Prolog/swipl-devel@525b4ae · GitHub only. No more version issues, but the installation will still check for git and partially install - pack_install/2 reports the pack is up-to-date but use_module/1 will fail with source_sink does not exist.

Thanks. Pushed 997db6df153cd4dcc970441cd7cda9c6320fe292 for that.