I want to expand a package I’ve written to provide extra functionality if another package is installed, but not to make that package compulsory. I don’t know whether it’s possible to do that, but it seems like it would be a useful thing… ideally I’d also like to put requirements on the version of the package.
I’ve tried defining functions if
Pkg.installed("Package") is not nothing and/or if the version is okay, but it precompiles it once and doesn’t update if “Package” is subsequently installed:
module Expansion if Pkg.installed("TestPkg") != nothing include("expandTestPkg.jl") # containing my expansion code export TestPkgExpansion end end
If I put
Pkg.installed("Package") inside the function or type definition then I can’t make the function dispatch on a type only defined in the “Package”, or the type contain an element of that type.
Is there some way of doing this?