MinimalWorkingExamples provides an easy way to run and share minimal working examples (MWEs) in Julia. It is especially useful when you want to show a small, self-contained example in a GitHub issue, a Discourse thread, a PR, or elsewhere.
As a simple example:
using MinimalWorkingExamples
@mwe begin
using Example
Example.hello("World")
end
produces (copied to clipboard)
using Example
Example.hello("World")
#> "Hello, World"
Created on 2026-07-01 with MinimalWorkingExamples v0.1.1 using Julia 1.12.6
The idea is simple: you write the code you want to share, and the package turns it into a copy-pasteable reproducible example. It runs the code in a fresh session without startup files, in a temporary environment, and installs any packages detected from using and import statements. The value of the final expression is captured, since this is usually what you want to show.
You can modify much of the behaviour, such as disabling the temporary environment, including a Manifest.toml in the output, and changing the output format, see the docs for details.
I would love any feedback!
It is inspired by the R package reprex, and by a suggestion for such a Julia package made here on Discourse.
That’s insightful in and of itself. You must have had something in your environment that had some unexpected effect.
Could you include versioninfo() in the output?
Yes, good idea. As a collapsible details block like Mainifest.toml also, i.e. like this?
@mwe begin
1+1
end versioninfo=true advertise=false
gives
1 + 1
#> 2
Environment
Julia Version 1.12.6
Commit 15346901f00 (2026-04-09 19:20 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 Ă— AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, znver3)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)
Environment:
JULIA_EDITOR = code
JULIA_VSCODE_REPL = 1
JULIA_LOAD_PATH = @:@stdlib
I would also consider making it the default. GitHub issues without this environment output can be difficult to solve.
Another random idea: you could consider a REPL mode for MWE where users could simply copy/paste content and get back the desired output. That way this small friction to load the package and add a @mwe block would be gone. Users could setup the startup.jl to always load the package and then whenever they needed to produce a MWE they would hit a special character (e.g., |) to switch to MWE mode:
julia> |
mwe>
Please feel free to ignore this suggestion, it is a big stretch 
See ReplMaker.jl for examples of custom modes.
In case you didn’t see, the function version mwe exists. If no positional argument is given then mwe() copies the code from the clipboard, which is how I would use it myself (and is how the R package reprex works too). (Maybe I should have mentioned that in the post also).
Nice, I didn’t see it. Thank you for clarying 