Skip to content

Commit

Permalink
Update to [email protected], drop old Julia support (#661)
Browse files Browse the repository at this point in the history
Removes legacy code, updates docs, adds NEWS

Co-authored-by: Tim Holy <[email protected]>
  • Loading branch information
aviatesk and timholy authored Dec 25, 2021
1 parent 5f428c9 commit e8d8dae
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 510 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0'
- '1'
- '1.6' # LTS
- '1' # current stable
- 'nightly'
os:
- ubuntu-latest
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
# Tests for when using polling
julia --project --code-coverage=user -e 'ENV["JULIA_REVISE_POLL"]="1"; using Pkg, Revise; include(joinpath(dirname(pathof(Revise)), "..", "test", "polling.jl"))'
# The REPL wasn't initialized, so the "Methods at REPL" tests didn't run. Pick those up now.
TERM="xterm" julia --project --code-coverage=user -e 'using InteractiveUtils, REPL, Revise; @async(Base.run_main_repl(true, true, false, true, false)); sleep(2); Revise.async_steal_repl_backend(); include(joinpath("test", "runtests.jl")); REPL.eval_user_input(:(exit()), Base.active_repl_backend)' "Methods at REPL"
TERM="xterm" julia --project --code-coverage=user -e 'using InteractiveUtils, REPL, Revise; @async(Base.run_main_repl(true, true, false, true, false)); while !isdefined(Base, :active_repl_backend) sleep(0.1) end; pushfirst!(Base.active_repl_backend.ast_transforms, Revise.revise_first); include(joinpath("test", "runtests.jl")); REPL.eval_user_input(:(exit()), Base.active_repl_backend)' "Methods at REPL"
# Tests for out-of-process updates to manifest
bash test/envs/use_exputils/setup.sh
julia --project --code-coverage=user test/envs/use_exputils/switch_version.jl
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
This file describes only major changes, and does not include bug fixes,
cleanups, or minor enhancements.

## Revise 3.3

* Upgrade to JuliaInterpreter 0.9 and drop support for Julia prior to 1.6 (the new LTS).

## Revise 3.2

* Switch to synchronous processing of new packages and `@require` blocks.
This is motivated by changes in Julia designed to make code-loading threadsafe.
There are small (100-200ms) increases in latency on first use, but more guarantees that
Revise's workqueue will finish before new operations commence.

## Revise 3.0

* Latencies at startup and upon first subsequent package load are greatly reduced.
Expand Down
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Revise"
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "3.2.1"
version = "3.3.0"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand All @@ -18,12 +18,12 @@ Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[compat]
CodeTracking = "1"
JuliaInterpreter = "0.8.6"
LoweredCodeUtils = "2.0.0"
JuliaInterpreter = "0.9"
LoweredCodeUtils = "2.2"
OrderedCollections = "1"
# Exclude Requires-1.1.0 - see https://github.com/JuliaPackaging/Requires.jl/issues/94
Requires = "~1.0, ^1.1.1"
julia = "1"
julia = "1.6"

[extras]
CatIndices = "aafaddc9-749c-510e-ac4f-586e18779b91"
Expand Down
32 changes: 7 additions & 25 deletions docs/src/config.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Configuration

!!! compat
These instructions are applicable only for Julia 1.5 and higher. If you are running an older version of Julia, upgrading to at least 1.6 is recommended. If you cannot upgrade, see the documentation for Revise 3.2.x or earlier.

## Using Revise by default

If you like Revise, you can ensure that every Julia session uses it by
launching it from your `~/.julia/config/startup.jl` file.
Note that using Revise adds a small latency at Julia startup, generally about 0.7s when you first launch Julia and another 0.25s for your first package load.
Users should weigh this penalty against whatever benefit they may derive from not having to restart their entire session.

### Julia 1.5 and higher

If you're using at least Julia 1.5, this can be as simple as adding
This can be as simple as adding

```julia
using Revise
```
to your `startup.jl`.

or (if you have a Unix terminal available) simply run
to your `startup.jl`. If you have a Unix terminal available, simply run
```bash
mkdir -p ~/.julia/config/ && echo "using Revise" >> ~/.julia/config/startup.jl
```
Expand All @@ -33,23 +32,6 @@ end

is recommended instead.

### Earlier Julia versions

If you sometimes use versions of Julia prior to 1.5, instead of the above add

```julia
atreplinit() do repl
try
@eval using Revise
@async Revise.wait_steal_repl_backend()
catch e
@warn "Error initializing Revise" exception=(e, catch_backtrace())
end
end
```

to your `startup.jl`.

### Using Revise automatically within Jupyter/IJulia

If you want Revise to launch automatically within IJulia, then you should also create a `.julia/config/startup_ijulia.jl` file with the contents
Expand All @@ -63,12 +45,12 @@ end
```
or simply run
```bash
mkdir -p ~/.julia/config/ && tee -a ~/.julia/config/startup_ijulia.jl << END
mkdir -p ~/.julia/config/ && tee -a ~/.julia/config/startup_ijulia.jl << END
try
@eval using Revise
catch e
@warn "Error initializing Revise" exception=(e, catch_backtrace())
end
end
END
```

Expand Down
7 changes: 0 additions & 7 deletions docs/src/dev_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ MethodSummary

## Function reference

### Functions called during initialization of Revise

```@docs
Revise.async_steal_repl_backend
Revise.steal_repl_backend
```

### Functions called when you load a new package

```@docs
Expand Down
10 changes: 5 additions & 5 deletions src/Revise.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""
Revise.jl tracks source code changes and incorporates the changes to a running Julia session.
Revise.jl tracks source code changes and incorporates the changes to a running Julia session.
Revise.jl works behind-the-scenes. To track a package, e.g. `Example`:
```julia
(@v1.6) pkg> dev Example # make a development copy of the package
[...pkg output omitted...]
julia> using Revise # this must come before the package under development
julia> using Revise # this must come before the package under development
julia> using Example
julia> using Example
[...develop the package...] # Revise.jl will automatically update package functionality to match code changes
[...develop the package...] # Revise.jl will automatically update package functionality to match code changes
```
Expand Down Expand Up @@ -39,7 +39,7 @@ using CodeTracking: PkgFiles, basedir, srcfiles, line_is_decl, basepath
using JuliaInterpreter: whichtt, is_doc_expr, step_expr!, finish_and_return!, get_return,
@lookup, moduleof, scopeof, pc_expr, is_quotenode_egal,
linetable, codelocs, LineTypes, is_GotoIfNot, isassign, isidentical
using LoweredCodeUtils: next_or_nothing!, trackedheads, structheads, callee_matches
using LoweredCodeUtils: next_or_nothing!, trackedheads, callee_matches

include("packagedef.jl")

Expand Down
180 changes: 0 additions & 180 deletions src/legacy_loading.jl

This file was deleted.

15 changes: 2 additions & 13 deletions src/lowered.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ function add_docexpr!(docexprs::AbstractDict{Module,V}, mod::Module, ex) where V
return docexprs
end

function lookup_callexpr(frame, stmt)
fargs = JuliaInterpreter.collect_args(frame, stmt)
return Expr(:call, fargs...)
end

function assign_this!(frame, value)
frame.framedata.ssavalues[frame.pc] = value
end
Expand Down Expand Up @@ -187,7 +182,7 @@ function methods_by_execution!(@nospecialize(recurse), methodinfo, docexprs, mod
mode === :sigs && return nothing, nothing
return Core.eval(mod, lwr), nothing
end
frame = JuliaInterpreter.Frame(mod, lwr.args[1])
frame = JuliaInterpreter.Frame(mod, lwr.args[1]::CodeInfo)
mode === :eval || LoweredCodeUtils.rename_framemethods!(recurse, frame)
# Determine whether we need interpreted mode
isrequired, evalassign = minimal_evaluation!(methodinfo, frame, mode)
Expand Down Expand Up @@ -266,12 +261,6 @@ function methods_by_execution!(@nospecialize(recurse), methodinfo, docexprs, fra
end
isassign(frame, pc) && assign_this!(frame, value)
pc = next_or_nothing!(frame)
elseif head structheads
if mode !== :sigs
pc = step_expr!(recurse, frame, stmt, true) # This checks that they are unchanged
else
pc = next_or_nothing!(frame)
end
# elseif head === :thunk && isanonymous_typedef(stmt.args[1])
# # Anonymous functions should just be defined anew, since there does not seem to be a practical
# # way to find them within the already-defined module.
Expand Down Expand Up @@ -406,7 +395,7 @@ function methods_by_execution!(@nospecialize(recurse), methodinfo, docexprs, fra
assign_this!(frame, nothing) # FIXME: the file might return something different from `nothing`
pc = next_or_nothing!(frame)
elseif f === Base.Docs.doc! # && mode !== :eval
fargs = JuliaInterpreter.collect_args(frame, stmt)
fargs = JuliaInterpreter.collect_args(recurse, frame, stmt)
popfirst!(fargs)
length(fargs) == 3 && push!(fargs, Union{}) # add the default sig
dmod::Module, b::Base.Docs.Binding, str::Base.Docs.DocStr, sig = fargs
Expand Down
Loading

2 comments on commit e8d8dae

@timholy
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/51243

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.3.0 -m "<description of version>" e8d8dae7afa4a4f1460b84d9cb70fcbe6c6c466b
git push origin v3.3.0

Please sign in to comment.