A common case, you are working on your package, and need some additional packaged during the development only (for plotting, benchmarking, debugging etc.). You put them into your default environment, and soon the Manifest.toml file there lists dozens or hundreds of dependencies, with increasing chances of a conflict with the dependencies in your package.
I am thinking of a workflow where your default environment contains just a minimum of packages, maybe just one (see below). Then there are several shared environments for specific tasks - e.g. @Plots with the Plots.jl, @Data ( DataFrames.jl, CSV.jl, âŚ), @Benchmarking, @Debug etc.
Then a package for a usage within REPL (and installed into the default environment), which would export the @using macro (any objections against the name?), doing roughly following:
If a package SomePackage is already in one of the environments in the current LOAD_PATH, then execute using SomePackage.
If a package AnotherOne is in a shared environment @AnotherEnv, then first push @AnotherEnv into the LOAD_PATH, then using AnotherOne.
If the package ToBeInstalled is not in any shared environment, ask user and install it into @ToBeInstalled environment.
For @using Pk1, Pk2, Pk3, find an optimal combination of environments, if some packages are present in multiple shared environments.
Does that all sound reasonably, of have I overlooked something important? Is that functionality or part of that already implemented in some package? (I am aware of similarly motivated Draft.jl .) Will it become obsolete after implementation of the incoming workspace feature of Pkg.jl?
Iâm pinging some of those who already discussed relevant topics @lmiq@feanor12@mkitti
Some former threads are listed below, but actually there were not many threads about it, suggesting these features are not commonly used:
During the recent years, I found Julia temp environments and the autoinstall feature to be very nice.
Now, I only have few packages in the default env (stuff like Pluto and Revise), and for everything else I just type the package name:
julia> using DataManipulation
â Package DataManipulation not found, but a package named DataManipulation is available from a registry.
â Install package?
â (@v1.10) pkg> add DataManipulation
â Select environment:
> 1: `/var/folders/2j/9vtd991d201dbkh9dnx3wvy00000gq/T/jl_tcW3N8` (/var/folders/2j/9vtd991d201dbkh9dnx3wvy00000gq/T/jl_tcW3N8)
2: `~/.julia/environments/v1.10/Project.toml` (@v#.#)
Resolving package versions...
<... Pkg output ...>
julia> # DataManipulation loaded
I like how Node.js has both âregularâ dependencies and then development dependencies. When you install a new package, you can simply include the --save-dev or -D flag. In the package.json file in a Node project, thereâs a dependencies section and a devDependencies section. The packages in the devDependencies donât get installed for someone cloning a repo and running npm install.
I wonder if it could be useful to have something similar in Julia. If youâre developing a package it may be nice to be able to add BenchmarkTools -D and then just have that package be listed as a development dependencyâŚ?