# Workflow for Contributing to Base

**URL:** <https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312>\
**Category:** General Usage\
**Created:** [February 12, 2022, 6:43pm UTC](https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312 "2022-02-12T18:43:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Post date:** [February 12, 2022, 6:43pm UTC](https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312/1 "2022-02-12T18:43:10Z")

</div>

Hi! I’m trying to contribute to Base by making `sort(x)` print `"Hello World"` before returning the correct answer. Is there a good workflow without building Julia locally?  
(edited for concision)

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [February 12, 2022, 6:53pm UTC](https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312/2 "2022-02-12T18:53:04Z")

</div>

You can use Revise.jl for Julia base with `Revise.track(Base)`. See [What Revise can track](https://timholy.github.io/Revise.jl/stable/#What-Revise-can-track-1).

---

<div class="post-metadata">

**Author:** ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Post date:** [February 12, 2022, 7:08pm UTC](https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312/3 "2022-02-12T19:08:43Z")

</div>

Thanks! Here’s what I’ve ended up doing:

1. Open a Julia REPL
2. `using Revise` (or add to `.julia/config/startup.jl`)
3. `Revise.track(Base)`
4. `@edit sort([3,2,1])` to see that source file is running (`/Applications/Julia-1.8.0-DEV-7ccc83ebaf.app/Contents/Resources/julia/share/julia/base/sort.jl`)
5. edit that source directory in a text editor to instert `println("hello world")`
6. run `sort([3,2,1])` in the original REPL

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [February 12, 2022, 7:10pm UTC](https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312/4 "2022-02-12T19:10:07Z")

</div>

A manual way to do this, if you want something quick, eg to test an idea, and don’t want to edit directly in base is.

mysort.jl

```julia
sort(v::AbstractVector; kws...) = (println("Hello world!"); sort!(copymutable(v); kws...))

```

And

```julia
julia> Base.include(Base.Sort, "mysort.jl");

julia> sort([2,1])
Hello world!
2-element Vector{Int64}:
 1
 2

```

---

<div class="post-metadata">

**Author:** ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Post date:** [February 12, 2022, 7:16pm UTC](https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312/5 "2022-02-12T19:16:58Z")

</div>

Thanks! In this case, I want to contribute my changes upstream so editing the file directly is nice, but it’s also often nice not to. Is there a way to set up Revise to track mysort.jl in your example?

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [February 12, 2022, 7:26pm UTC](https://discourse.julialang.org/t/workflow-for-contributing-to-base/76312/6 "2022-02-12T19:26:56Z")

</div>

The docs for [includet](https://timholy.github.io/Revise.jl/stable/user_reference/#Revise.includet) suggest that this is the way to do it.  
`Revise.track(Base.Sort, "mysort.jl"; mode=:eval, skip_include=false)`

And this works. I’m not sure how valuable it is. Maybe it is.
