On this page:
3.1 Git  Hub Deployment
3.2 Manual Deployment
3.3 Helping Others Discover Your Package
3.4 Naming and Designing Packages

3 Developing Packages

To create a package, first make a directory for your package and select its name, ‹package›:

  mkdir package

Next, link your development directory to your local package repository:

  raco pkg install --link package

Optionally, enter your directory and create a basic "info.rkt" file:

  cd package
  echo "#lang setup/infotab" > info.rkt
  echo "(define deps (list))" >> info.rkt

The "info.rkt" file is not necessary if you have no dependencies, but you may wish to create it to simplify adding dependencies in the future. (Note that this "info.rkt" is for the package, not for a collection; definitions such as scribblings or raco-commands work only in a collection’s "info.rkt".)

Next, inside the ‹package› directory, create directories for the collections and modules that your package will provide. For example, the developer of tic-tac-toe package that provides games/tic-tac-toe/main and data/matrix libraries might create directories and files like this:

  mkdir -p games/tic-tac-toe
  touch games/tic-tac-toe/info.rkt
  touch games/tic-tac-toe/main.rkt
  mkdir -p data
  touch data/matrix.rkt

After your package is ready to deploy, choose either GitHub Deployment or Manual Deployment.

3.1 GitHub Deployment

First, create a free account on GitHub, then create a repository for your package. After that, publish your package source as:

  github://github.com/user/package/branch

Typically, ‹branch› will be master, but you may wish to use different branches for releases and development.

Whenever you

  git push

your changes will automatically be discovered by those who used your package source when they use raco pkg update.

3.2 Manual Deployment

By default, raco pkg create generates a Zip archive. For more options, refer to the raco pkg create documentation. If you want to generate an archive through some other means, simply archive what you made in the first part of this section. For more formal details, refer to the package definition.

Alternatively, you can deploy your package by publishing it on a URL you control. If you do this, it is preferable to create an archive from your package directory first:

  raco pkg create package

And then upload the archive and its checksum to your site:

  scp package.zip package.zip.CHECKSUM your-host:public_html/

Now, publish your package source as:

  http://your-host/~user/package.zip

Whenever you want to provide a new release of a package, recreate and reupload the package archive (and checksum). Your changes will automatically be discovered by those who used your package source when they use raco pkg update.

3.3 Helping Others Discover Your Package

By using either of the above deployment techniques, anyone will be able to use your package by referring to your package source. However, they will not be able to refer to it by a simple name until it is listed on a package name resolver.

If you’d like to use the official package name resolver, browse to https://pkg.racket-lang.org/manage/upload and upload a new package. You will need to create an account and log in first.

You only need to go to this site once to list your package. The server will periodically check the package source you designate for updates.

If you use this server, and use GitHub for deployment, then you will never need to open a web browser to update your package for end users. You just need to push to your GitHub repository, then within 24 hours, the official package name resolver will notice, and raco pkg update will work on your user’s machines.

3.4 Naming and Designing Packages

Although of course not required, we suggest the following system for naming and designing packages: