Skip to content

Add run_path to control execution directory independently of output#494

Open
jariji wants to merge 4 commits intoJunoLab:masterfrom
jariji:separate-run-and-out-dirs
Open

Add run_path to control execution directory independently of output#494
jariji wants to merge 4 commits intoJunoLab:masterfrom
jariji:separate-run-and-out-dirs

Conversation

@jariji
Copy link

@jariji jariji commented Mar 17, 2026

Summary

  • weave() previously conflated the code execution directory with the output directory via the single out_path parameter
  • Add a run_path keyword argument that independently controls where code is executed, e.g. weave("doc.jmd", out_path=:pwd, run_path=:doc) outputs to the cwd while running code from the document's directory
  • Supported values: nothing (default, preserves previous behavior), :doc, :pwd, or a path string
  • Also available as run_path in the YAML weave_options header
  • Internal: rename WeaveDoc.cwdout_dir and get_cwdget_out_dir (backward compat for doc.cwd preserved via property overrides)

Depends on #493.

Test plan

  • All existing tests pass (193 passed, 2 broken pre-existing)
  • Test run_path=:doc with out_path=:pwd to verify independent control

🤖 Generated with Claude Code

jariji and others added 4 commits March 17, 2026 02:48
Julia 1.12 added source locations to ParseError messages and module
names to UndefVarError messages. These differ between the test's
include_string(Main, ...) and Weave's execution context (temp files,
sandbox module). Normalize these context-dependent parts before
comparing error strings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Test Julia lts, 1 (stable), and pre (allow-failure)
- Drop x86 and Julia 1.5
- Add julia-actions/cache@v3
- Update checkout@v6, setup-julia@v2, codecov@v5
- Add concurrency groups to cancel redundant runs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
`weave()` previously conflated the code execution directory with the
output directory via the single `out_path` parameter. This made it
impossible to e.g. run code from the document's directory while
writing output to the current working directory.

Public API: add a `run_path` keyword argument to `weave()` that
independently controls where code is executed. When unset (the
default), the previous behavior is preserved: code runs in the
output directory. Supported values are `:doc`, `:pwd`, a path
string, or `nothing`. Also supported as `run_path` in the YAML
`weave_options` header.

Internal: rename the `WeaveDoc.cwd` field to `out_dir` and the
`get_cwd` helper to `get_out_dir` for clarity. Backward
compatibility for `doc.cwd` access is preserved via
getproperty/setproperty! overrides.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jariji jariji force-pushed the separate-run-and-out-dirs branch from db8e1e3 to 103f1df Compare March 17, 2026 18:38
@codecov-commenter
Copy link

codecov-commenter commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 74.28571% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.51%. Comparing base (db28a69) to head (103f1df).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
src/Weave.jl 30.00% 7 Missing ⚠️
src/run.jl 93.75% 1 Missing ⚠️
src/writer/latex.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #494      +/-   ##
==========================================
+ Coverage   74.01%   74.51%   +0.49%     
==========================================
  Files          26       26              
  Lines        1351     1448      +97     
==========================================
+ Hits         1000     1079      +79     
- Misses        351      369      +18     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants