I like to keep my local packages, including public and private ones, outside ~/.julia
. This has some benefits, eg that Pkg.update()
does not attempt to update them, and that if my package directory is seriously corrupted I can easily wipe and reinstall.
The downside is that utilities like Pkg.test
and PkgBenchmark.benchmarkpkg
can’t find these packages. Pkg3 will fix these issues, but as a stopgap measure, I wrote RoguePkg.jl.
Usage
It allows you to define objects using non-standard string literals:
using RoguePkg
# package which contains a given module, found using the load path:
pkg_for"FancyModule"
# package at a specified path:
pkg_at"~/this_is/where_I/keep/FancyPkg"
# set ENV[JULIA_LOCAL_PACKAGES], will find it in there:
pkg_local"FancyPkg"
Then you can
Pkg.test(pkg_for"FancyModule")
PkgBenchmark.benchmarkpkg(pkg_for"FancyModule")
The package is not registered, get it from
https://github.com/tpapp/RoguePkg.jl
Implementation
Base.Pkg.dir
is extended to work with the objects above. If they are the first argument, they resolve to the path, in other positions to the package name.