54
$\begingroup$

I often see references to "paclets", for example the PacletManager` context, the PacletInfo.m file in some packages and next to downloaded computable data, $UserBaseDirectory/Paclets, etc.

Question: What are "paclets", what is their relevance to end users, and how can one use them with packages?

Clarification: Since I saw a PacletInfo.m file in several third party packages as well, I assume that they must be useful in packages and there must be some documentation on how to use them somewhere. I am hoping someone could point me to the relevant documentation.

$\endgroup$
4
  • 3
    $\begingroup$ PacletInfo.m is described in the Wolfram Workbench documentation. $\endgroup$
    – WReach
    Commented Feb 12, 2012 at 15:24
  • $\begingroup$ @WReach Can you post that as an answer? $\endgroup$
    – Szabolcs
    Commented Feb 12, 2012 at 15:25
  • $\begingroup$ @Szabolcs, is this question relevant any more? $\endgroup$
    – SPPearce
    Commented Oct 7, 2017 at 5:45
  • $\begingroup$ @KraZug If you are looking at distributing packages as paclets, then not really. $\endgroup$
    – Szabolcs
    Commented Oct 8, 2017 at 8:35

2 Answers 2

38
$\begingroup$

Update for version 12.1

Starting with version 12.1, paclets are now exposed as user-accessible packaging functionality. They are documented here.

Todd Gayley of WRI has published some preliminary documentation about Paclets and Paclet Development. There is also an associated introductory video.


Original Response

A paclet is a distribution mechanism for resources that contribute to the contents of a package. Most of the paclet machinery is in the PacletManager context, which is not public API.

It appears that the only part of paclet functionality presently intended for public use involves PacletInfo.m, a descriptor file for Mathematica applications. This is described in the Wolfram Workbench documentation.

$\endgroup$
7
  • $\begingroup$ Do you by any chance know if this functionality can be used for automatically updating a package (in my case: a palette) from the internet? $\endgroup$
    – Szabolcs
    Commented Jul 21, 2012 at 15:14
  • 1
    $\begingroup$ @Szabolcs Sorry, I don't know about any such functionality. However, there looks to be some interesting spelunking around PacletInstall, PacletUpdate, etc in NotebookOpen@ FileNameJoin@{$InstallationDirectory, "SystemFiles", "Autoload", "PacletManager", "Kernel", "Manager.m"}. $\endgroup$
    – WReach
    Commented Jul 21, 2012 at 16:43
  • $\begingroup$ @WReach Are there any differences between the "official" 12.1 paclet functionality and the previous implementation? $\endgroup$
    – Chris K
    Commented Mar 16, 2020 at 19:28
  • $\begingroup$ @ChrisK I'm afraid I cannot offer a good assessment of that difference. Some members of our community have worked hard to use the undocumented features so if the issue is of interest to you a new question may draw some interesting answers... although it is hard to "diff" against an undocumented moving target :) $\endgroup$
    – WReach
    Commented Mar 16, 2020 at 22:10
  • $\begingroup$ @WReach Thanks for the info... I'll wait and see if it breaks anything I'm doing. $\endgroup$
    – Chris K
    Commented Mar 16, 2020 at 22:19
31
$\begingroup$

Paclets are downloaded chunks of curated computable data:

Load-on-Demand Curated Data

Mathematica 6 pioneers the powerful concept of built-in computable data sources. An efficient load-on-demand mechanism makes hundreds of gigabytes of carefully curated and continually updated data immediately available inside Mathematica for use in computations. Mathematica 6 introduces major collections of data in mathematics, physics, chemistry, astronomy, geography, linguistics and finance—all organized and aggregated for the first time by Wolfram Research for direct use in computations.

From Mathematica Internet Connectivity:

When you call a data function like FinancialData, Mathematica gets the data it needs from the internet. When you click a link to a documentation notebook or call a data function like CountryData, Mathematica knows whether a newer version of the information is available on a Wolfram Research Paclet Server, and if so it will download and install the update automatically. In the case of smaller paclets like documentation notebooks, this is often so fast that you will not even notice it happening.

Some details of this functionality are found here:

Mathematica‘s data functions download data paclets from our data servers. Hence functions such as CityData,WeatherData, and CountryData will not work on computers disconnected from the internet. It is possible to transfer such paclets from an online to an offline machine with the following steps:

  • Download your paclet of interest (e.g. CityData) to the online machine by evaluating this in Mathematica:

    CityData[All,"Preload"]
    
  • Locate the paclet repository folder by evaluating:

    ToFileName[{$UserBaseDirectory, "Paclets", "Repository"}]
    
  • And identify the subfolders starting with “CityData” in their names.

  • Copy these folders into the equivalent paclet repository folder on your offline machine. (The corresponding location on the offline computer can be found using the same ToFileName evaluation from above.)

  • Have the offline Mathematica installation recognize the added data paclets by evaluating :

    RebuildPacletData[]
    
  • Finally, evaluate a few examples in the documentation for CityData to verify that the desired data is now available in Mathematica.


Specific use and format of the PacletInfo.m file is provided by Scientific Arts (.nb):

As mentioned above, within the package directory which we are calling MyApplication there will also be a file called PacletInfo.m. This is a file with a specific structure which tells Mathematica what is contained within the Guides, Tutorials, and ReferencePages directories and how the Documentation Center should categorize and access them. The PacletInfo.m file is a plain text file with elements that describe what sorts of materials are contained in the Guides, Tutorials, and ReferencePages directories as well as things such as what Context the functions described within the ReferencePages belong to. Also it lets the Documentation Center know how to list the material on the Installed Add-Ons page that is linked to from the front page of the Documentation Center.

Read the Notebook for much more complete coverage.

$\endgroup$
11
  • $\begingroup$ Why do some packages contain a PacletInfo.m file then? See for example this package. What is the function of PacletInfo.m and can I make use of it in my own packages? $\endgroup$
    – Szabolcs
    Commented Feb 12, 2012 at 13:00
  • $\begingroup$ I clarified the question a bit. $\endgroup$
    – Szabolcs
    Commented Feb 12, 2012 at 13:05
  • $\begingroup$ @Szabolcs I see. I figured you were asking this as a beginner's question. Thanks for not completely changing the question and pulling the rug out from under me. $\endgroup$
    – Mr.Wizard
    Commented Feb 12, 2012 at 13:08
  • $\begingroup$ The downloaded computable data also has a PacletInfo.m, this is a relevant answer. $\endgroup$
    – Szabolcs
    Commented Feb 12, 2012 at 13:09
  • $\begingroup$ @Szabolcs does the linked Notebook cover what you're after? $\endgroup$
    – Mr.Wizard
    Commented Feb 12, 2012 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.