6
$\begingroup$

Questions:

  • What is an idiomatic way to upload/install a paclet in own Wolfram Cloud account?

  • What is an idiomatic way to update/overwrite existing paclet?

It is not tough but:

  • PacletManager works in 'read-only' mode so PacletInstall can't be used

  • While CreateDirectory and CopyDirectory work well to set a new one I failed to update a package this way. Even with DeleteDirectory[.., DeleteContents->True] there were traces of nested directory structure which prompted errors when CopyDirectory was called again. Otoh I could not delete them directly with DeleteDirecotry and I could not access them via browser interface because the top one was already missing from the file menu...

Again a basic use case is a pain to perform.

Probably assembling a simple code that does it will not take long, but only if you know the 'proper' way.

related: Clean package update for API/FormFunctions on Wolfram Cloud

$\endgroup$
  • $\begingroup$ I don't know if I have a terribly idiomatic way. I effectively just use CopyFile and update the PacletSite.m file programmatically. Most of my work has gone into simplifying and generalizing the paclet construction. $\endgroup$ – b3m2a1 Jun 18 '18 at 16:26
  • $\begingroup$ @b3m2a1 I think there isn't any and anything that works will be useful for future readers. $\endgroup$ – Kuba Jun 18 '18 at 16:27
5
$\begingroup$

The rule of thumb is:

for a cloud file system related actions use CloudObject wrapper for files/dirs whenever it is possible. One can do a lot of deviations e.g.:

CloudEvaluate @ DeleteDirectory["test/dir", DeleteContents->True]

And it more or less works, untill the next time you upload something in the same place. In cases of nested directories, inner ones are somehow cached and it is not possible to overwrite it unless you DeleteDirectory @ CloudObject @ "test/dir/innerdir" directly.

TL;DR;

Quick package cleanup:

DeleteDirectory[
  CloudObject["Base/Applications/`packageName`"]
, DeleteContents -> True
]

You can use FileNameJoin and $UserBaseDirectory but then you need to evaluate via cloud because your OS can be different than Cloud's linux.

Quick package installation:

CopyDirectory[
  "local/dir/of/thePackage"
, CloudObject["Base/Applications/thePackage"]
]

Seems to be elementary but deviations from mentioned rule will cost you a lot of time.

$\endgroup$

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.