Pkg.build() vs Pkg.add() with julia -e

When constructing command-lines to start he Julia REPL, I’m noticing some folks using Pkg.build("PyCall) rather than Pkg.add("PyCall").

The command-line I want to build is to allow many Julia environments, particularly jupyter-based tutorials, to start with their own independent Python environments.

I’ve added the -i parameter for my experimentation. Adding IJulia is probably unnecessary, and should be in the activated environment anyway.

Looks like:

PYTHON="" julia -i -e  'using Pkg; Pkg.activate("."); Pkg.build("PyCall");Pkg.add("IJulia"); Pkg.instantiate(); using PyCall IJulia'

Questions:

  1. It all seems to work fine, but why build()? Does it force some reconciliation with my local environment?
  2. Could both PyCall and IJulia packages been added to the activate environment’s .toml?