22
$\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$

1 Answer 1

21
$\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$
7
  • 3
    $\begingroup$ Do point out the HTTPS thing for those who wouldn't realize its importance. $\endgroup$
    – Szabolcs
    Commented Sep 5, 2017 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
    Commented Jan 7, 2019 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
    Commented Jan 7, 2019 at 16:09
  • $\begingroup$ How can you pass on Authentication and/or Header information to PacletSiteRegister and/or PacletSiteUpdate to access private GitHub repos? $\endgroup$ Commented Apr 8, 2021 at 13:01
  • $\begingroup$ @IstvánZachar there’s no general way, but you can intercept the behavior of PacletInstall to do so, e.g. write a PrivatePacletInstall that can forward auth details to URLFetch when it’s called $\endgroup$
    – b3m2a1
    Commented Apr 8, 2021 at 17:06

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.