I'm trying to build my first paclet which includes a .txt data file. As per documentation, I added {"Path"} to "Extensions" section in PacletInfo.wl, so that it now looks like this:
PacletObject[
<|
"Name" -> "WordGrid",
"Version" -> "0.0.1",
"WolframVersion" -> "13+",
"Extensions" ->
{
{
"Path"
},
{
"Kernel",
"Root" -> "Kernel",
"Context" -> "WordGrid`"
},
{
"Documentation",
"Language" -> "English"
}
}
|>
]
I put the data file under the paclet's root directory in WordGrid/rusian_nouns.txt and am now trying to access it from within the paclet with e.g. Import["WordGrid/russian_nouns.txt"]:
RussianNouns[] := RussianNouns[] =
ToLowerCase /@ StringSplit[Import["WordGrid/russian_nouns.txt"]];
Everything seems to work during the development: the following code, executed in a fresh kernel, returns the list of Russian nouns as expected:
PacletDirectoryLoad[NotebookDirectory[] <> "WordGrid"]
Needs["WordGrid`"]
RussianNouns[]
However, after I build the paclet with
Needs["PacletTools`"]
PacletBuild[NotebookDirectory[] <> "WordGrid"]
I can't see the .txt file in the build directory or the manifest, and the paclet file itself is too small to contain my list of words.
What am I doing wrong?
BuildPacket: when I create the paclet usingCreatePacletArchiveand install the result, everything works as expected. – Victor K. Oct 16 '22 at 20:04Root->""with "Path" extension will enable you to use it with Import. Also you usually name each resource (i.e. "RussianNouns") and path to it can be extracted withPacletObject["WordGrid"]["AssetLocation", "RussianNouns"](in earlier versions it wasPacletResource, but it got scrubbed it seems). – swish Oct 16 '22 at 20:39Also, the documentation, in the subsection "Path", mentions nothing about the "Root" key - everything should work as I describe above.
– Victor K. Oct 16 '22 at 20:55ReadList. – Victor K. Oct 16 '22 at 20:58PacletObjectwith an Association as an argument and not plainPacletanymore... – Victor K. Oct 16 '22 at 21:41SystemOpen@FileNameJoin[{PacletObject["PacletTools"]["Location"],"PacletInfo.wl"}]. And it uses oldPacletformat, but with new "Asset" extension. I would recommend following the documentation as much as possible. – swish Oct 16 '22 at 21:51
– Victor K. Oct 17 '22 at 02:50With[{all = PacletFind[<|"WolframVersion" -> All|>]}, Length@Select[all, x |-> MemberQ[x["Extensions"], #, All]] & /@ {"Path", "Asset", "Resource", _}]returns{3, 4, 84, 350}.