Skip to content

Conversation

@ThomasBreuer
Copy link
Contributor

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.)

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.
@ThomasBreuer ThomasBreuer added kind: new feature topic: packages issues or PRs related to package handling, or specific to a package (for packages w/o issue tracker) release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Aug 13, 2025
@ChrisJefferson
Copy link
Contributor

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.

@ThomasBreuer
Copy link
Contributor Author

@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.

@ChrisJefferson
Copy link
Contributor

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

@ThomasBreuer
Copy link
Contributor Author

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?

@ChrisJefferson
Copy link
Contributor

ChrisJefferson commented Aug 20, 2025

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.

@ThomasBreuer
Copy link
Contributor Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: new feature release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: packages issues or PRs related to package handling, or specific to a package (for packages w/o issue tracker)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants