Package Usage and Development » Paclet Development

Paclet Distribution

We can distribute paclets in either of two ways. We can distribute a packed .paclet file directly or distribute via a server.

Whichever route we go, though, we'll first need the .paclet file.

Creating a .paclet File

To create a .paclet file we use the PackPaclet function in the "PacletManager`" context. We can call it one of two ways:

  • PackPaclet[dir] creates a packed .paclet file from dir and places it in dir
  • PackPaclet[dir, dest] creates a packed .paclet file from dir and places it in dest

Say, for the sake of argument, that I am Etienne Bernard and write the Machine Learning functionality packaged into Mathematica. I can find my paclet directory like

 dir = PacletFind["MachineLearning"][[1]]["Location"]

Then this can be packed into a .paclet file like:

 paclet = PackPaclet[dir, $TemporaryDirectory]

And now this can be distributed

Direct Distribution

Once a paclet is packed it can be distributed directly as it. For instance, I can put this in on my Wolfram Cloud account:

  CloudObject["user:b3m2a1.testing/MachineLearning.paclet", Permissions->"Public"]

And now anyone could come along and install this with:


Often we want something a little more sophisticated, though.

Paclet Servers

Paclet servers exist to make it easy to serve many paclets from the same location. The PacletManager indexes all the paclet servers available to it and figures out where to install paclets from if simply provided with a name. Therefore it's useful for us to be able to set up our own servers.

To do this we simply need to add a Paclets directory to our server and provide a compressed metadata file . Overall our server will look like:


The paclet manager indexes the paclets on the server by looking at , which is much like a PacletInfo.m file, except instead of containing a single Paclet expression it contains a PacletSite expression that bundles up a bunch of different Paclet expressions.

In all it'll look like:


Then this gets written to a file as an expression and ZIP compressed.

In general we don't need to handle this ourselves, though, as there's a function in the PacletManager that does this. If we call PacletManager`Package`BuildPacletSiteFiles on our target directory it will do this for us.

For instance, I could call:


And all of the files in the Paclets sub-folder will get indexed into a PacletSite.m and file.

Setting Up a Paclet Server

Once the construction is done locally, the server should be served over HTTP if possible. Older versions of the PacletManager failed to deal appropriately with HTTPS content.

I tend to serve mine via the Wolfram Cloud or GitHub.

An example of the former is here and the latter is here .

See Also: