Basic Revise.jl usage when developing a module


#1

I am having trouble running Revise.jl on my Windows machine. My workflow is as follows. On VSCode I am writing my Julia module. I also have the Julia REPL open separately.
I’ve run the following code in my REPL

include("path/to/module")
using Revise
using .PackageName
a = foo()  # foo() defined in PackageName

Now when I edit a function in PackageName in VSCode and switch back to the REPL, I was hoping that Revise would “reload” the module with the edited function. But this dosn’t seem to be the case. Am I missing something?


#2

I believe you need to use Revise.includet in this case. Or you could develop the package in Pkg.devdir() (or somewhere else on the LOAD_PATH) and Revise will find it automatically.


#3

Recommended approach:

  • check out this branch of PkgDev
  • navigate to where you want your package to live (I typically use .julia/dev)
  • within Julia do using PkgDev; PkgDev.generate("PackageName", "MIT") or whatever license you prefer.
  • pkg> dev PackageName to bring it into your environment (or pkg> dev /path/to/PackageName if you placed it somewhere other than your .julia/dev directory)
  • using PackageName

Revise will work automatically. Your package is also ready to push up to GitHub, run Travis tests, etc.


#4

It is probably not relevant but I wonder if all this package creation process could not be even more standardized inside Julia in the future (avoiding “Recommend” and “I typically use”). If so, the IDE (atom, vscode,…) job for package creation would be easy and essentially reduced to a one click process (and you can switch between IDEs).

In C++, this kind of work is handled by IDEs like qtcreator or visual studio that generate a CMake project or equivalent setups. It is not convenient because it is not standard. I love to develop softs and libs but I always found configuration/environment/build/config management tool/ Testing tools/doc tools) so painful and boring to learn. Usually I consider the corresponding related “languages”/configuration file syntax (git, doxygen, cvs, travis, cmake,…) to be ugly.

Julia Pkg/doc/test approach is indeed a great improvement but I wonder if it could be even more standardized to the point where there is no more question about it :wink:


#5

You might want to check out: https://github.com/invenia/PkgTemplates.jl
I found it makes the package creation process much easier and faster.


#6

Thank you very much !
Now the standardization question remains.