19
$\begingroup$

I want to use GitHub as a paclet server, but this fails:

PacletInstall[
 "ServiceConnection_StackExchange",
 "Site" -> "https:/github.com/paclets/Repository"
 ]

PacletSiteUpdate::err: An error occurred attempting to update paclet information from site https:/github.com/b3m2a1/PacletServer. Does not appear to be a valid paclet site

PacletInstall::notavail: No paclet named ServiceConnection_StackExchange is available for download from any currently enabled paclet sites.

$Failed

Is there a work around?


See also: How to distribute Mathematica packages as paclets? and this answer

$\endgroup$
20
$\begingroup$

First things first we set up the paclet server in the normal way as described here or here.

Then all we need to do is pass the "raw.githubusercontent" version of that so that the resources themselves get downloaded instead of the HTML pages:

PacletInstall[
 "ServiceConnection_StackExchange",
 "Site" -> 
  "http://raw.githubusercontent.com/paclets/Repository/master"
 ]

Paclet[
"Name" -> "ServiceConnection_StackExchange", "Version" -> "1.0.0", 
 "Description" -> "A service connection to the Stack Exchange API. \
Supports the majority of the functions defined in the API", 
 "Extensions" -> {{
   "Kernel", "Root" -> ".", 
    "Context" -> "ServiceConnection_StackExchange`"}, {
   "FrontEnd", "Prepend" -> True}}, 
 "Location" -> "~/Library/Mathematica/Paclets/Repository/\
ServiceConnection_StackExchange-1.0.0"]

Note:

As Szabolcs points out, you must use "http://raw.githubusercontent.com". The PacletManger refuses to use the "https://" form.

$\endgroup$
  • 2
    $\begingroup$ Do point out the HTTPS thing for those who wouldn't realize its importance. $\endgroup$ – Szabolcs Sep 5 '17 at 20:37
  • $\begingroup$ a) GitHubServer should be PacletServer right? b) I think this topic deserves a one line intro about the setup because users could be confused about that is really going on. $\endgroup$ – Kuba Jan 7 at 10:20
  • $\begingroup$ @Kuba the GitHubServer was a repo I set up specifically for this question and at some point must have removed. I'll change it to the public server. That's a better one to point to. $\endgroup$ – b3m2a1 Jan 7 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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