Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juliapluto/plutodependencyexplorer.jl
Pluto's dependency sorting algorithm
https://github.com/juliapluto/plutodependencyexplorer.jl
julia pluto-notebooks
Last synced: about 1 month ago
JSON representation
Pluto's dependency sorting algorithm
- Host: GitHub
- URL: https://github.com/juliapluto/plutodependencyexplorer.jl
- Owner: JuliaPluto
- License: mit
- Created: 2024-01-16T13:53:05.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-11-13T13:13:17.000Z (about 2 months ago)
- Last Synced: 2024-11-25T15:17:59.052Z (about 1 month ago)
- Topics: julia, pluto-notebooks
- Language: Julia
- Homepage: https://plutojl.org/en/docs/plutodependencyexplorer/
- Size: 67.4 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# PlutoDependencyExplorer.jl
This package contains Pluto's dependency sorting algorithm. Given a list of cell codes, PlutoDependencyExplorer can tell you in which order these cells should run. For example:
```julia
julia> import PlutoDependencyExplorer as PDEjulia> struct SimpleCell <: PDE.AbstractCell
code
endjulia> notebook = SimpleCell.([
"x + y"
"x = 1"
"y = x + 2"
]);julia> empty_topology = PDE.NotebookTopology{SimpleCell}();
julia> topology = PDE.updated_topology(
empty_topology,
notebook, notebook;
get_code_str = c -> c.code,
get_code_expr = c -> Meta.parse(c.code),
);julia> order = PDE.topological_order(topology);
julia> order.runnable
3-element Vector{SimpleCell}:
SimpleCell("x = 1")
SimpleCell("y = x + 2")
SimpleCell("x + y")
```## ExpressionExplorer.jl
PlutoDependencyExplorer.jl uses the low-level package [ExpressionExplorer.jl](https://github.com/JuliaPluto/expressionexplorer.jl) to find the assignments and references of each cell. PlutoDependencyExplorer uses this information to build a dependency graph between cells (i.e. a `NotebookTopology`), which can be used to find the order to run them in (a `TopologicalOrder`).
If you are interested in **ordering a list of expressions** in execution order (the order that Pluto runs cells in), then use PlutoDependencyExplorer.jl. If you just want to know which variables are assigned or referenced in a **single expression**, use ExpressionExplorer.jl.
# Docs
Take a look at the [**Documentation →**](https://plutojl.org/en/docs/plutodependencyexplorer/)# Contributing and testing
To work on this package, clone both the Pluto.jl and PlutoDependencyExplorer.jl repositories to your local drive. Then:
1. In your global environment (or another one), develop the Pluto and PlutoDependencyExplorer packages:
`(@1.10) pkg> dev ~/Documents/Pluto.jl`
`(@1.10) pkg> dev ~/Documents/PlutoDependencyExplorer.jl`
2. You can `(@1.10) pkg> test PlutoDependencyExplorer` to run the tests
3. You can also run Pluto, or `(@1.10) pkg> test Pluto`, and it will use your local copy of PlutoDependencyExplorer. This lets you test how your changes to PlutoDependencyExplorer integrate into Pluto.### Advanced: making a change to Pluto and PlutoDependencyExplorer at the same time.
If you are working on a change to PlutoDependencyExplorer that requires a matching change in Pluto, then you open a branch/PR on both repositories.
We need to tell PlutoDependencyExplorer which version of Pluto to use. To do this, edit the file `PlutoDependencyExplorer.jl/test/pluto integration/DEV EDIT ME pluto pkg source.jl`.