Question regarding metapackages under v1.0



I have noticed that metapackages behave differently under v1.0 than under v0.6. Specifically, I added ValidatedNumerics to my v1.0.1 installation. While this installs the various Interval* packages, they are not available to use unless I also add them individually:

(v1.0) pkg> add ValidatedNumerics
  Updating registry at `C:\Users\vdykb\.julia\registries\General`
  Updating git-repo ``
 Resolving package versions...
 Installed FastRounding ────────────────── v0.2.0
 Installed SetRounding ─────────────────── v0.2.0
 Installed IntervalOptimisation ────────── v0.3.0
 Installed ValidatedNumerics ───────────── v0.11.0
 Installed IntervalConstraintProgramming ─ v0.9.0
 Installed IntervalContractors ─────────── v0.3.1
 Installed IntervalRootFinding ─────────── v0.4.0
 Installed IntervalArithmetic ──────────── v0.15.0
 Installed ErrorfreeArithmetic ─────────── v0.2.1
  Updating `C:\Users\vdykb\.julia\environments\v1.0\Project.toml`
  [d621b6e3] + ValidatedNumerics v0.11.0
  Updating `C:\Users\vdykb\.julia\environments\v1.0\Manifest.toml`
  [90fa49ef] + ErrorfreeArithmetic v0.2.1
  [fa42c844] + FastRounding v0.2.0
  [d1acc4aa] + IntervalArithmetic v0.15.0
  [138f1668] + IntervalConstraintProgramming v0.9.0
  [15111844] + IntervalContractors v0.3.1
  [c7c68f13] + IntervalOptimisation v0.3.0
  [d2bf35a9] + IntervalRootFinding v0.4.0
  [3cc68bcd] + SetRounding v0.2.0
  [d621b6e3] + ValidatedNumerics v0.11.0

julia> using IntervalArithmetic
ERROR: ArgumentError: Package IntervalArithmetic not found in current path:
- Run `import Pkg; Pkg.add("IntervalArithmetic")` to install the IntervalArithmetic package.

 [1] require(::Module, ::Symbol) at .\loading.jl:820

(v1.0) pkg> add IntervalArithmetic
 Resolving package versions...
  Updating `C:\Users\vdykb\.julia\environments\v1.0\Project.toml`
  [d1acc4aa] + IntervalArithmetic v0.15.0
  Updating `C:\Users\vdykb\.julia\environments\v1.0\Manifest.toml`
 [no changes]

julia> using IntervalArithmetic
[ Info: Precompiling IntervalArithmetic [d1acc4aa-44c8-5952-acd4-ba5d80a2a253]

Is there a way, using the v1.0 package manager, to achieve the same result as under v0.6, i.e. install the metapackage and all of the constituent packages are available to use? Via a build script, perhaps?

In this example, simply using ValidatedNumerics would of course work, as the constituent packages are all re-exported. I was simply curious to know if there is a simple solution that allows not having all of the constituent packages loaded every time.


Without using or equivalent, no installed package will be available in any given environment.


I think you misunderstood, or I was not clear. The issue is that the packages cannot be directly used, as shown in the example. Only the meta package can be used.


That’s incorrect. Add BenchmarkTools to your default environment (v1.0). Create an new empty environment somewhere (i.e. ] activate . somewhere). Now try using BenchmarkTools in this empty environment: it will work.

However, at least when I started to use 1.0, I guess I would have liked environments to really be separated from each other.


This is intentional, you can only using what you have added. In Julia v0.6 this was not the case, but the fact that it worked can be considered a bug.


Not quite, see my example above. I’d say you can only using what you added somewhere.


If you look at the example (you need to scroll) you will see that I add the metapackage (ValidatedNumerics) which installs the other packages and re-exports them. I can access the exported functions by using the metapackage, but you cannot use only one of the constituent packages unless you add that package individually, as was the case before.


No doubt. This does however reduce the utility of a metapackage. I was wondering if that utility could somehow be recovered.


I think you misunderstood. I meant adding is not enough, you have to do using or equivalent as well to use a package installed via add. An installed package can of course be used from different environments, but they have to be used to be accessed.


Right, but then you have added it, just to an environment lower in the stack.

If this is the case you can

julia> using ValidatedNumerics

julia> using .IntervalContractors

where the . means that Julia should look for the module in the current module (Main in the Julia REPL) instead of loading it like a regular package (which, as you have seen, only work if the package is added).


The only downside here is when I use the metapackage, all of constituent packages also get loaded. I was hoping to avoid this. Obviously the simple solution is to add them individually, which is no hardship. I was just being lazy.


This has not changed since Julia v0.6.


No it has not. But in v0.6 the constituent packages were available to use without adding them individually.


Right, and I suggested this, which works without explicitly adding the constituent package:


I see. I missed that they need then not be added. Thanks!