0.7 "projects" and "applications" -- how to use?


#1

The new 0.7.0-alpha manual section on the package manager introduces the concepts of “project” and “application”-- I presume that these are meant for ordinary users trying to develop their own code? In this case, I have a few questions about how these are supposed to work.

  1. If I use the “]” operation in the REPL and then ask the package manager to generate a project, it creates the folder hierarchy in the current directory. However, by default, the current directory is not searched by the import operation. What is the recommended workflow-- append “.” to the LOAD_PATH? To the DEPOT path? Or somehow instruct the generate command to use a different folder?

  2. If there is a file called runtests.jl that lives in PROJ/test/ of a package, then this file is executed by the Pkg.test("PROJ") command. But what about “projects” and “applications” that aren’t packages-- what is the standard way to reach this runtests.jl file? So far I have reached it by import Test.@test, import Test.@testset, etc., and finally include("PROJ/test/runtests.jl"). UPDATE (a few minutes later): I just discovered that the pkg command prompt supports a test command. However, I couldn’t figure out how to use it. f I execute it in the current working directory, it doesn’t know which package to test, and if I execute it in the top-level directory of the project, it tells me that the name of the project is undefined (UndefVarError).

  3. If I change one of the .jl files in the src directory of a project, how do I tell the package manager to reload the source, i.e., what is the typical development workflow? I tried the update command from inside the package manager, but it did not have the desired effect. So far, the only means I know to load changes in the source files of the project is to exit and restart the REPL.


#2

You can cd into the project that was created. Then you can import it.

To test a dependency in a project you should be able to do Pkg.test("Dependency") or using the REPL pkg> test Dependency. To test the project itself use Pkg.test() or pkg> test.

I don’t see how this is related to the new package manager. To hot-load code use something like Revise. Maybe I am missunderstanding.


#3

Thanks for the suggestions! The test operation was failing because of a bug in my runtests.jl file, not because a problem with the system, but the error message confused me. After I fixed the bug, it works fine.

With regard to my other question, I had not previously used Revise.jl. My previous workflow was to put my code in modules inside .jl files and then include them after each revision. However, Revise.jl in tandem with the new “project” system appears to be a much better solution.


#4

Obstinate fans of the old-fashioned (Revise-free) workflow may find this useful:

"""
    minclude(path::String)

load a module-defining file at toplevel.
This makes the associated module available for other modules to use or import,
allowing for hot-reloading (by repeated invocation of `minclude`).
"""
minclude(path) = Base.include_relative(Base.__toplevel__,path)