Message Boards Message Boards

Create your own Paclet Site

This tutorial shows how to create your own Paclet site. If you deploy code to other people you can use the Paclet system to allow your application to check for code or data updates. This is useful if you have bugs that have been fixed, new features added or data that has changed or been updated.

I am going to use a GitHub release page for my site.

sitepathpath = 
  "https://github.com/ERWS/diyPaclet/releases/download/v1.0/";
mysite = PacletSiteAdd[sitepathpath, "ERWS", "Local" -> False];
PacletSites[]

{PacletSite["http://pacletserver.wolfram.com", 
  "Wolfram Research Paclet Server", "Local" -> False], 
 PacletSite[
  "https://github.com/ERWS/diyPaclet/releases/download/v1.0/", "ERWS",
   "Local" -> False]}

To make a site you need at least one Paclet.

diypacpath = 
  First@URLDownload["https://github.com/ERWS/diyPaclet/releases/download/v1.0/ diyPaclet-0.0.1.paclet", 
URLDownload["http://wolfram.com",  FileNameJoin[{$TemporaryDirectory, "diyPaclet-0.0.1.paclet"}]]];
   diypac = PacletInstall[diypacpath] 

Then create your Paclet site object

pacassoc = Append[diypac /. Paclet[x__] :> <|x|>, "Location" -> sitepathpath];
modifiedpac = Paclet @@ Normal@pacassoc;
pacletsitenew = PacletSite[modifiedpac]

Some processing is required to create a zipped archive file with a .mz extension

pacletsitetext = ToString[pacletsitenew, InputForm]
 newfile = CreateFile[FileNameJoin[{NotebookDirectory[], "Pacsite1", "PacletSite.m"}]]

s = OpenWrite[newfile, CharacterEncoding -> "UTF8"]
WriteString[s, pacletsitetext]
Close[s]

zip = CreateArchive[newfile, FileNameDrop[newfile, -1]]
ziprename = CopyFile[zip, FileNameJoin[{FileNameDrop[zip, -1], "PacletSite.mz"}]]

Upload the .mz file to your site. If you are able to use a http site instead and can create a sub-directory /Paclets and then put your paclet files in it you could finish at this stage. Paclet Install and other useful functionality should work.

I want to use a GitHub release page so I need to use https and I also can't create a sub-directory at this location so a slight modification of code is need for this. The code is in the attached notebook.

Block[{PacletManager`Package`setLocation = mysetLocation,
  PacletManager`Package`downloadPaclet = mydownloadpaclet}, 
 PacletInstall["diyPaclet", "Site" -> sitepathpath, "Asynchronous" -> False]]

PacletManager`Paclet[ "Name" -> "diyPaclet", "Version" -> "0.0.1", 
 "MathematicaVersion" -> "7+", "Creator" -> "ERWS", 
 "Loading" -> "Automatic", "Root" -> "diyPaclet", 
 "Extensions" -> {{"Kernel", "Context" -> "diyPaclet`"}, {
   "Documentation", "Language" -> "English", 
    "MainPage" -> "Guides/diyPacletGuide"}}, 
 "Location" -> "C:\\Users\\2moro\\AppData\\Roaming\\Mathematica\\\Paclets\\Repository\\diyPaclet"]
Attachments:
POSTED BY: Emerson Willard
4 Replies
Posted 6 years ago

Here's a nice example (and shameless plug) for what you can do with these:

my paclet server

POSTED BY: b3m2a1 ​ 

Thank you, nice spelunking!

It's a pity about the HTTPS thing though ...

POSTED BY: Szabolcs Horvát

enter image description here - another post of yours has been selected for the Staff Picks group, congratulations! We are happy to see you at the top of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!

POSTED BY: Moderation Team

The notebook attachment isn't a valid link anymore. @Emerson Willard, Could you upload it again?

POSTED BY: Eric Smith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract