gap icon indicating copy to clipboard operation
gap copied to clipboard

Start GAP with prescribed package versions

Open ThomasBreuer opened this issue 4 months ago • 6 comments

In order to reproduce computations from a GAP session, it is desirable to start GAP with a given set of GAP packages whose exact version numbers are prescribed.

The idea is as follows.

  • In a GAP session, use the new function PackagesLoaded for collecting the names and version numbers of the currently loaded GAP packages.

  • Write this description to a file.

  • Set the new user preference PrescribedPackageVersions, with value the name of that file.

  • Start a new GAP session. The user preference will modify the autoload process such that exactly the GAP packages listed in the file will be loaded, with exactly the listed versions.

This is just a first proposal. There are things to discuss for example:

  • It is not clear that a user preference is the right way to trigger the changed behaviour, but adding a user preference was easier than adding a command line option.
  • Would it be reasonable to prescribe not only the package version but also its path?
  • What else would we like to get from this new feature?

(One motivation is a remark in oscar-system/GAP.jl/issues/1189.)

ThomasBreuer avatar Aug 13 '25 14:08 ThomasBreuer

I like the idea.

I wonder if at least a warning (and honestly, I'd be tempted to abort GAP, if the point is to ensure reproducability), if one of the package versions we expect to find is missing? Otherwise if someone loads a list of required packages and are missing one of the correct versions, that package just won't exist -- but that might not stop their calculation, just slow it down, if that package was optional.

ChrisJefferson avatar Aug 13 '25 16:08 ChrisJefferson

@ChrisJefferson The proposed code turns the prescribed packages (in the prescribed versions, since all other versions lying around get ignored) into needed packages of GAP. Thus one gets an error as soon as the first such package turns out to be not loadable. This is the error which one gets already now if for example the primgrp package cannot be loaded.

ThomasBreuer avatar Aug 13 '25 19:08 ThomasBreuer

Ah, thanks. I think I didn't read carefully, I thought the packages still got loaded later when requested.

ChrisJefferson avatar Aug 19 '25 14:08 ChrisJefferson

I thought the packages still got loaded later when requested

It is not clear what we really want in this respect.

The currently proposed code removes all information about packages that are not in the list of prescribed package versions. It is still possible to add a new package directory later in the GAP session, and then to load packages which can be found there. Shall we forbid this? Or shall we argue that adding a package directory does not happen silently, and users who do this can add other packages on top of the prescribed ones?

ThomasBreuer avatar Aug 19 '25 14:08 ThomasBreuer

A few years ago I would have said don't bother, but now I do have quite a bit of code that tries using PackageManager to install packages, and people have and maintain multiple package directories, and it might be nice to catch that.

However, I don't think that's required from day one, and we can't stop people doing bad things if they really want to in GAP.

ChrisJefferson avatar Aug 20 '25 07:08 ChrisJefferson

@james-d-mitchell You had mentioned in a discussion during the recent GAP Days that you would like to get a better control of the loaded GAP packages. Is the current pull request helpful in this respect, and what else would you like to get?

ThomasBreuer avatar Sep 12 '25 12:09 ThomasBreuer