Hello,
I’m trying to understand the Julia ‘best practices’ around projects/environments with Pkg.
First, are ‘project’ and ‘environment’ synonymous in Julia?
Second, since I’ve separated my packages into environments to avoid incompatibilities, and then activated a specific environment through julia --project foo
or ] activate foo
, I’m surprised that I still have to import
each package (which i assume belies some fundamental misunderstanding). I understand that I might not want to ‘using’ everything because I might want to refer to things through the SomePackage.somefunction
syntax, but why would I want to have an environment with access to a specific bunch of packages but have no way to access them? It seems to me that I’d always want to run something like:
import Pkg; for pkg in Pkg.project().dependencies |> keys @eval import $(Symbol(pkg)) end
once I open a REPL in a particular environment, but I’ve never seen anything like that in a startup script. Coming from R, I can access any installed packaged through pkgname::symbol
syntax as soon as the REPL launches.
Third, how should packages be organised? I think I read that the base environment (@1.8
currently) should preferably just contain packages that will always be useful, so I have Revise
, Match
, OhMyREPL
in there. Then I have a @stats
environment that I use for an R-like batteries-included REPL with GLM
, CSV
, Makie
, DataFrames
etc. Then if I have a specific, defined project to complete (for publication for example), I would make a new environment from scratch specifically for that project. Is this roughly the right idea?
Many thanks!