Goto Chapter: Top 1 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

1 PackageMaker
 1.1 What is PackageMaker?
 1.2 Before you start
 1.3 Where should the generated package go?
 1.4 A worked example
 1.5 Important wizard choices
 1.6 What gets generated?
 1.7 What next?

1 PackageMaker

1.1 What is PackageMaker?

PackageMaker is a GAP package that makes it easy to create new GAP packages, by providing a wizard function that asks a few questions about the new package, such as its name and authors; and from that creates a complete usable skeleton package. It optionally can set up several advanced features, including:

The generated package is meant as a starting point, not as a finished package ready for release. In particular, you should expect to edit README.md, PackageInfo.g, the generated tests and, depending on your choices, the documentation, CI workflows or kernel extension sources.

1.2 Before you start

A typical session looks like this:

By default, the wizard creates the new package directory in the current working directory of your GAP session. That is often convenient for creating the package, but it does not automatically make the package loadable. See the next section for the different ways to make GAP find the generated package.

If you ask PackageMaker to create a git repository, git should have user.name and user.email configured. If they are missing, PackageMaker explains how to set them up, lets you retry, or keeps the generated package directory without creating a git repository.

1.3 Where should the generated package go?

The generated package directory must eventually live in a place where GAP searches for packages.

For normal day-to-day use, the best destination is usually ~/.gap/pkg. You may have to create that directory first. Keeping personal packages there means they survive GAP upgrades and are separate from the main GAP installation.

Another natural choice is the pkg directory inside your main GAP installation. This is common when you built GAP from source in a directory that you control. The drawback is that when you later upgrade or reinstall GAP, it is easy to forget to copy over packages that you added there manually.

For quick testing, GAP 4.15 or later can be started with gap --packagedirs . to tell GAP to search the current directory directly for packages.

There are also more advanced alternatives:

These advanced options are useful to know about, but for most users the practical advice is simple: keep the package in ~/.gap/pkg for normal use, and use gap --packagedirs . only as a quick-testing convenience when running GAP 4.15 or newer.

1.4 A worked example

The following transcript shows a complete example session. It uses GitHub, enables the generated workflows, chooses the MIT license, creates a C kernel extension, and enters one author / maintainer record.

1.4-1 PackageWizardInput
‣ PackageWizardInput( arg )( function )

Interactively create a package skeleton. You can abort by either answering quit or pressing Ctrl-D.

gap> PackageWizard();
Welcome to the GAP PackageMaker Wizard.
I will now guide you step-by-step through the package
creation process by asking you some questions.

What is the name of the package? DemoPackage
Enter a short (one sentence) description of your package: A package used to demonstrate PackageMaker
Which license should the package use? MIT
Shall I prepare your new package for GitHub? [Y/n] y
Do you want to use GitHub Actions for automated tests and making releases? [Y/n] y
The release workflow updates the package website on GitHub Pages
whenever you make a package release.
I need to know the URL of the GitHub repository.
It is of the form https://github.com/USER/REPOS.
What is USER (typically your GitHub username)? demo-user
What is REPOS, the repository name? DemoPackage
Shall your package provide a GAP kernel extension? Yes, written in C

Next I will ask you about the package authors and maintainers.

Last name? Doe
First name(s)? Dana
Is this one of the package authors? [Y/n] y
Is this a package maintainer? [Y/n] y
Email? dana@example.invalid
WWWHome? https://example.invalid/~dana/
GitHubUsername? demo-user
PostalAddress? Example Institute\nDepartment of Algebra\nExample Street 1\n12345 Example City
Place? Example City, Country
Institution? Example Institute
Add another person? [y/N] n
Creating the git repository...
Initialized empty Git repository in .../DemoPackage/.git/
[main (root-commit) ...] initial import
Done creating git repository.
Create <https://github.com/demo-user/DemoPackage> via <https://github.com/new> and then run:
  git push -u origin main

After this finishes, the new package lives in a directory named DemoPackage below the current directory. You can now inspect and edit the generated files, move the package into a package directory, and try loading it in GAP.

1.4-2 PackageWizardGenerate
‣ PackageWizardGenerate( arg )( function )

1.4-3 PackageWizard
‣ PackageWizard( arg )( function )

1.5 Important wizard choices

Some answers mainly affect metadata, while others determine which files are generated.

1.5-1 Package name

The package name becomes the name of the top-level package directory and is also used in file names such as gap/YourPackage.gd, gap/YourPackage.gi and in many entries of PackageInfo.g. It therefore should be chosen with care.

1.5-2 License

The license choice affects both the generated LICENSE file and the guidance inserted into README.md. By default, the wizard uses GPL-2.0-or-later, because that is the license of GAP itself and is also used by many GAP packages. Other built-in choices are GPL-3.0-or-later, MIT and BSD-3-Clause.

If you are unsure which license to use, then the following sites may help:

If you choose the custom option, then PackageMaker generates a placeholder LICENSE file which you must replace with the full text of your chosen license. You should also make sure that the License field in PackageInfo.g and the package README.md describe the same license.

1.5-3 GiHub setup

Saying yes to GitHub setup does two things:

If you also enable GitHub Actions, then PackageMaker adds CI and release workflows below .github/workflows/ and creates .codecov.yml. The release workflow updates the package website on GitHub Pages when you make a release.

If you do not use GitHub setup, then PackageInfo.g contains placeholder URL entries instead. They work as reminders, but you should replace them before publishing your package.

1.5-4 Kernel extension

The kernel extension choice determines whether the package is purely interpreted GAP code or also contains code in C or C++. Choosing a kernel extension adds files such as src/YourPackage.c or src/YourPackage.cc, together with configure, Makefile.in and Makefile.gappkg.

1.6 What gets generated?

Every generated package contains the basic files needed for a small but usable package:

Depending on your choices, the wizard may also create:

A few of these files deserve immediate attention:

1.7 What next?

Once the wizard has finished, a typical next-step checklist is:

For broader guidance on package structure and release preparation, it is worth reading the GAP manual chapter on Reference: Using and Developing GAP Packages as well as the manual and PackageInfo.g file of the https://github.com/gap-packages/example package.

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 Ind

generated by GAPDoc2HTML