Skip to main content
4 of 5
added 124 characters in body
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k

Update:

This answer is now mostly superseded by:


I am not sure about the difference between "Kernel" and "Application", but I was able to gather the following information:

Adding the "Kernel" extension to PacletInfo.m allows the paclet to provide a package that is loadable with Needs. (I have not tried if "Application" works too).

In order for this to work, it seems to be necessary to set the Context and Root arguments, like so:

Paclet[
    Name -> "MyPack",
    Version -> "0.0.1",
    MathematicaVersion -> "10.0+",
    Description -> "My Mathematica Application",
    Creator -> "John Johnson",
    Extensions -> 
        {
            {"Kernel", Root -> ".", Context -> "MyPack`"}
        }
]

Effects of setting Context -> "MyPack`":

  • FindFile["MyPack`"] will resolve to the correct location so that the package can get loaded by Needs or Get.

  • If the "Documentation" extension is also present, then symbol usage messages will get a little >> sign at the end. Clicking it will open the correct documentation page.

  • The value can also be a list of contexts.

Effects of setting Root:

  • FindFile["MyPack`"] will search in the location that Root points to in the usual manner: it will resolve either to init.m, to Kernel/init.m, to MyPack.m (or I assume to the other usual possibilities such as .mx files within directories having names agreeing $SystemID—but I haven't tried this one)

    The usual setting would be Root -> "." when the package root coincides with the paclet root, but we can also put all the package files and an init.m in a subdirectory and point to that instead.

Further reading

References

Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k