[GAP Forum] Reloading a package

Alexander Konovalov alexander.konovalov at st-andrews.ac.uk
Tue Mar 30 18:32:07 BST 2021


Dear Piotr,

I also recommend to use tests - many GAP packages have them in the tst directory, for example see the Example package at 

	https://github.com/gap-packages/example/tree/master/tst

Instead of continuing in the same GAP session with multiple reloads, you can leave that to the situations when you need to test the code interactively, otherwise gap tst/testall.g starts new clean session, loads your package, runs tests and reports discrepancies, if any.

Please see also 

	https://carpentries-incubator.github.io/gap-lesson/04-testing/index.html 

and 

	https://www.gap-system.org/Manuals/doc/ref/chap76.html#X8559D1FF7C9B7D14 

Best wishes
Alexander


> On 30 Mar 2021, at 15:32, Alexander Hulpke <hulpke at fastmail.fm> wrote:
> 
> Dear Forum, Dear Piotr Mizerka, 
>> I have the following question concerning loading of GAP packages
>> (concerns in the same way both Linux and Windows). 
>> 
>> Suppose I have a package named "SamplePackage" located in the pkg
>> directory. After launching a GAP session I load the SamplePackage with
>> 
>> LoadPackage( "SamplePackage" );
>> 
>> and it works fine. My problem is now as follows: I work "live" on the
>> SamplePackage and I make a lot of changes and want to see the effect.
>> Unfortunately after making a change in some of SamplePackage files and
>> 
>> Is there a way to reload the package in the same GAP session such that
>> the updates are visible?
> 
> Since this is only an issue for a developer of the package, but not for the general user, there is no generic "reload" mechanism. What one can do is to reload individual files with `RereadPackage` (without causing warnings about objects already having been declared). You could simply reload the file you worked as:
> 
> ```
> RereadPackage("SamplePackage","/lib/myfile.gi");
> ```
> 
> If your changes go over multiple files, you could put all these `RereadPackage` commands into a single file you then read in.
> 
> One Caveat:
> If you re-read a file that includes declarations, these prioperties get re-declared, and there might be some incompatibility with objects you created before re-reading the file.
> 
> 
> Best,
> 
>  Alexander Hulpke
> 
> 
> _______________________________________________
> Forum mailing list
> Forum at gap-system.org
> https://mail.gap-system.org/mailman/listinfo/forum




More information about the Forum mailing list