[{"data":1,"prerenderedAt":572},["ShallowReactive",2],{"doc:\u002Fguides\u002Fprojects":3,"nav:guides":523},{"doc":4,"source":522},{"id":5,"title":6,"body":7,"description":515,"extension":516,"meta":517,"navigation":131,"path":518,"seo":519,"stem":520,"__hash__":521},"guides\u002Fguides\u002Fprojects.md","Projects",{"type":8,"value":9,"toc":508},"minimark",[10,14,31,36,349,368,404,408,421,449,453,464,468,486,490,504],[11,12,6],"h1",{"id":13},"projects",[15,16,17,18,22,23,26,27,30],"p",{},"A ",[19,20,21],"code",{},"PklProject"," file declares evaluator settings and dependencies for the modules beside it. ",[19,24,25],{},"zig_pkl.project"," loads both so that an evaluator behaves like ",[19,28,29],{},"pkl eval"," run inside the project.",[32,33,35],"h2",{"id":34},"load-a-project","Load a project",[37,38,43],"pre",{"className":39,"code":40,"language":41,"meta":42,"style":42},"language-zig shiki shiki-themes github-light github-dark","\u002F\u002F Any evaluator can evaluate the PklProject file itself.\nconst loader = try manager.createEvaluator(zig_pkl.Options.preconfigured(), &rejected);\ndefer loader.close();\n\nvar project = try zig_pkl.project.loadFile(allocator, io, loader, \"PklProject\");\ndefer project.deinit();\n\nconst evaluator = try manager.createEvaluator(project.options, &rejected);\ndefer evaluator.close();\n\nconst main_uri = try project.moduleUri(allocator, \"main.pkl\");\ndefer allocator.free(main_uri);\nvar tree = try evaluator.evaluateSource(.uri(main_uri), null, &failure);\n","zig","",[19,44,45,54,110,126,133,183,197,202,237,250,255,285,305],{"__ignoreMap":42},[46,47,50],"span",{"class":48,"line":49},"line",1,[46,51,53],{"class":52},"sJ8bj","\u002F\u002F Any evaluator can evaluate the PklProject file itself.\n",[46,55,57,61,65,68,71,74,78,82,85,88,90,93,95,98,101,104,107],{"class":48,"line":56},2,[46,58,60],{"class":59},"szBVR","const",[46,62,64],{"class":63},"s4XuR"," loader",[46,66,67],{"class":59}," =",[46,69,70],{"class":59}," try",[46,72,73],{"class":63}," manager",[46,75,77],{"class":76},"sVt8B",".",[46,79,81],{"class":80},"sScJk","createEvaluator",[46,83,84],{"class":76},"(",[46,86,87],{"class":63},"zig_pkl",[46,89,77],{"class":76},[46,91,92],{"class":63},"Options",[46,94,77],{"class":76},[46,96,97],{"class":80},"preconfigured",[46,99,100],{"class":76},"(), ",[46,102,103],{"class":59},"&",[46,105,106],{"class":63},"rejected",[46,108,109],{"class":76},");\n",[46,111,113,116,118,120,123],{"class":48,"line":112},3,[46,114,115],{"class":59},"defer",[46,117,64],{"class":63},[46,119,77],{"class":76},[46,121,122],{"class":80},"close",[46,124,125],{"class":76},"();\n",[46,127,129],{"class":48,"line":128},4,[46,130,132],{"emptyLinePlaceholder":131},true,"\n",[46,134,136,139,142,144,146,149,151,154,156,159,161,164,167,170,172,175,177,181],{"class":48,"line":135},5,[46,137,138],{"class":59},"var",[46,140,141],{"class":63}," project",[46,143,67],{"class":59},[46,145,70],{"class":59},[46,147,148],{"class":63}," zig_pkl",[46,150,77],{"class":76},[46,152,153],{"class":63},"project",[46,155,77],{"class":76},[46,157,158],{"class":80},"loadFile",[46,160,84],{"class":76},[46,162,163],{"class":63},"allocator",[46,165,166],{"class":76},", ",[46,168,169],{"class":63},"io",[46,171,166],{"class":76},[46,173,174],{"class":63},"loader",[46,176,166],{"class":76},[46,178,180],{"class":179},"sZZnC","\"PklProject\"",[46,182,109],{"class":76},[46,184,186,188,190,192,195],{"class":48,"line":185},6,[46,187,115],{"class":59},[46,189,141],{"class":63},[46,191,77],{"class":76},[46,193,194],{"class":80},"deinit",[46,196,125],{"class":76},[46,198,200],{"class":48,"line":199},7,[46,201,132],{"emptyLinePlaceholder":131},[46,203,205,207,210,212,214,216,218,220,222,224,226,229,231,233,235],{"class":48,"line":204},8,[46,206,60],{"class":59},[46,208,209],{"class":63}," evaluator",[46,211,67],{"class":59},[46,213,70],{"class":59},[46,215,73],{"class":63},[46,217,77],{"class":76},[46,219,81],{"class":80},[46,221,84],{"class":76},[46,223,153],{"class":63},[46,225,77],{"class":76},[46,227,228],{"class":63},"options",[46,230,166],{"class":76},[46,232,103],{"class":59},[46,234,106],{"class":63},[46,236,109],{"class":76},[46,238,240,242,244,246,248],{"class":48,"line":239},9,[46,241,115],{"class":59},[46,243,209],{"class":63},[46,245,77],{"class":76},[46,247,122],{"class":80},[46,249,125],{"class":76},[46,251,253],{"class":48,"line":252},10,[46,254,132],{"emptyLinePlaceholder":131},[46,256,258,260,263,265,267,269,271,274,276,278,280,283],{"class":48,"line":257},11,[46,259,60],{"class":59},[46,261,262],{"class":63}," main_uri",[46,264,67],{"class":59},[46,266,70],{"class":59},[46,268,141],{"class":63},[46,270,77],{"class":76},[46,272,273],{"class":80},"moduleUri",[46,275,84],{"class":76},[46,277,163],{"class":63},[46,279,166],{"class":76},[46,281,282],{"class":179},"\"main.pkl\"",[46,284,109],{"class":76},[46,286,288,290,293,295,298,300,303],{"class":48,"line":287},12,[46,289,115],{"class":59},[46,291,292],{"class":63}," allocator",[46,294,77],{"class":76},[46,296,297],{"class":80},"free",[46,299,84],{"class":76},[46,301,302],{"class":63},"main_uri",[46,304,109],{"class":76},[46,306,308,310,313,315,317,319,321,324,327,330,332,334,337,340,342,344,347],{"class":48,"line":307},13,[46,309,138],{"class":59},[46,311,312],{"class":63}," tree",[46,314,67],{"class":59},[46,316,70],{"class":59},[46,318,209],{"class":63},[46,320,77],{"class":76},[46,322,323],{"class":80},"evaluateSource",[46,325,326],{"class":76},"(.",[46,328,329],{"class":80},"uri",[46,331,84],{"class":76},[46,333,302],{"class":63},[46,335,336],{"class":76},"), ",[46,338,339],{"class":59},"null",[46,341,166],{"class":76},[46,343,103],{"class":59},[46,345,346],{"class":63},"failure",[46,348,109],{"class":76},[15,350,351,353,354,356,357,360,361,364,365,77],{},[19,352,158],{}," reads ",[19,355,21],{}," and, when present, ",[19,358,359],{},"PklProject.deps.json"," beside it. Create or refresh the lock file with ",[19,362,363],{},"pkl project resolve",". A project that declares dependencies but has no lock file fails with ",[19,366,367],{},"error.MissingDependencyLock",[15,369,370,373,374,376,377,380,381,383,384,387,388,391,392,399,400,403],{},[19,371,372],{},"project.options"," is a complete ",[19,375,92],{}," value built from ",[19,378,379],{},"evaluatorSettings",", with ",[19,382,153],{}," filled in from the dependencies. Change any field before creating the evaluator. A project that sets no allow lists leaves ",[19,385,386],{},"allowed_modules"," and ",[19,389,390],{},"allowed_resources"," null; ",[393,394,396],"a",{"href":395},"..\u002F..\u002Fexamples\u002Fproject\u002Fmain.zig",[19,397,398],{},"examples\u002Fproject"," fills them from ",[19,401,402],{},"Options.preconfigured()"," in that case.",[32,405,407],{"id":406},"paths-and-symlinks","Paths and symlinks",[15,409,410,412,413,416,417,420],{},[19,411,158],{}," resolves the project path to its canonical location, following symlinks. ",[19,414,415],{},"project.projectUri()"," returns that location, and ",[19,418,419],{},"project.moduleUri(allocator, \"relative\u002Fpath.pkl\")"," builds URIs beside it. Evaluate project modules through those URIs: Pkl applies the project's dependencies only to modules inside the project directory.",[15,422,423,424,426,427,430,431,166,434,166,437,440,441,444,445,448],{},"Relative paths in ",[19,425,379],{}," resolve against the project directory, the same way Pkl 0.32's ",[19,428,429],{},"resolvedEvaluatorSettings"," resolves them. That covers ",[19,432,433],{},"modulePath",[19,435,436],{},"moduleCacheDir",[19,438,439],{},"rootDir",", the working directory of external readers, and reader executables that contain a path separator. Executables given as a bare name, such as ",[19,442,443],{},"pkl-reader",", are looked up on ",[19,446,447],{},"PATH"," when the reader starts. zig-pkl does this resolution itself, so it gives the same result on every supported Pkl release.",[32,450,452],{"id":451},"dependencies","Dependencies",[15,454,455,456,459,460,463],{},"Local dependencies (",[19,457,458],{},"import(\"..\u002Flib\u002FPklProject\")",") and remote packages both come from the lock file. Each dependency carries its declared name, so modules import it as ",[19,461,462],{},"@name\u002Fmodule.pkl",". Local dependencies keep their own dependencies at every level of nesting.",[32,465,467],{"id":466},"settings-that-need-newer-pkl","Settings that need newer Pkl",[15,469,470,471,474,475,477,478,481,482,77],{},"HTTP proxy and CA settings need Pkl 0.26, external readers 0.27, HTTP rewrites 0.29, ",[19,472,473],{},"traceMode"," 0.30, and HTTP headers 0.32. When a project sets one of these, ",[19,476,81],{}," checks the server version and fails with ",[19,479,480],{},"error.UnsupportedVersion"," on an older release. See ",[393,483,485],{"href":484},"compatibility","Version compatibility",[32,487,489],{"id":488},"owned-memory","Owned memory",[15,491,492,495,496,387,498,501,502,77],{},[19,493,494],{},"project.Owned"," owns every string and slice in ",[19,497,372],{},[19,499,500],{},"project.project",". Keep it alive until the evaluators created from those options are closed, then call ",[19,503,194],{},[505,506,507],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":42,"searchDepth":56,"depth":56,"links":509},[510,511,512,513,514],{"id":34,"depth":56,"text":35},{"id":406,"depth":56,"text":407},{"id":451,"depth":56,"text":452},{"id":466,"depth":56,"text":467},{"id":488,"depth":56,"text":489},"A PklProject file declares evaluator settings and dependencies for the modules beside it. zig_pkl.project loads both so that an evaluator behaves like pkl eval run inside the project.","md",{},"\u002Fguides\u002Fprojects",{"title":6,"description":515},"guides\u002Fprojects","ywvzm8XbtBdzME_O1Ar4pMOqXNIWY2MBF8Ik-tj0xpQ","docs\u002Fguides\u002Fprojects.md",[524,527,531,535,539,543,547,551,555,559,560,564,568],{"title":485,"path":525,"stem":526},"\u002Fguides\u002Fcompatibility","guides\u002Fcompatibility",{"title":528,"path":529,"stem":530},"Concurrency","\u002Fguides\u002Fconcurrency","guides\u002Fconcurrency",{"title":532,"path":533,"stem":534},"Errors","\u002Fguides\u002Ferrors","guides\u002Ferrors",{"title":536,"path":537,"stem":538},"Evaluation","\u002Fguides\u002Fevaluation","guides\u002Fevaluation",{"title":540,"path":541,"stem":542},"External readers","\u002Fguides\u002Fexternal-readers","guides\u002Fexternal-readers",{"title":544,"path":545,"stem":546},"Installation","\u002Fguides\u002Finstallation","guides\u002Finstallation",{"title":548,"path":549,"stem":550},"Logging","\u002Fguides\u002Flogging","guides\u002Flogging",{"title":552,"path":553,"stem":554},"Migrating from pkl-zig","\u002Fguides\u002Fmigration","guides\u002Fmigration",{"title":556,"path":557,"stem":558},"Ownership","\u002Fguides\u002Fownership","guides\u002Fownership",{"title":6,"path":518,"stem":520},{"title":561,"path":562,"stem":563},"Quick start","\u002Fguides\u002Fquickstart","guides\u002Fquickstart",{"title":565,"path":566,"stem":567},"Readers","\u002Fguides\u002Freaders","guides\u002Freaders",{"title":569,"path":570,"stem":571},"Security","\u002Fguides\u002Fsecurity","guides\u002Fsecurity",1792908673090]