Share package enviroments between 1.0 and master

Since I use both master and 1.0, I was wondering if I could somehow maintain a consistent environment of packages (ie the global Project.toml and Manifest.toml in ~/.julia/environments/VERSION) between the two, to make it easier to switch back and forth.

  1. Just checking, could this have any unintended downsides I am not seeing?

  2. Regarding the implementation, can I just symlink ~/.julia/environments/v1.1 etc to ~/.julia/environments/v1.1, or is there a more canonical way of doing this?

I was interested in this for bridging 0.7 and 1.x since I still test things in 0.7 to find out what library I’m missing.

Why bother?
Installing packages is instantaneous if you already have that version installed in another environment.

It is because of this that I can
Use new environments almost every time I do anything,
even with Australian Internet

2 Likes

Primarily so that the packages I dev are consistent.

That is fair, good point.

Though option when deving is to just activate the package dir, or your working environment (if dev --local) in each by name/command line arg.
Which is l what I almost do, since I never use default environment at all.

First thing I’d try is moving ~/.julia/environments/v1.1 somewhere temporary and replacing it with a symlink to ~/.julia/environments/v1.0. Probably want to make a back up of that directory first, though, since some of its contents will be modified.

Though a safer (but harder) option might be to create a script that scans the manifests and syncs them.

Personally I have just symlinked environments/v1.0 and environments/v1.1 to environments/v1. Works perfectly fine. See also https://github.com/JuliaLang/julia/pull/28631

1 Like

This works fine.

The version in the ] prompt shows up as the directory of the real path, but I have not decided whether to think of this as a bug or a feature:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.0-DEV.427 (2018-10-06)
 _/ |\__'_|_|_|\__'_|  |  Commit cfc967bf93 (0 days old master)
|__/                   |

(v1.0) pkg> 

Then I don’t think you did what I suggested? I have the real path at environments/v1 and link all environments/v1.X to it. My prompt is thus

(v1) pkg>

which I kinda like.

1 Like

I cd’ed to where the v1 project.toml file is located, started julia master and executed ]activate . - which should activate the same set of packages (dev’ed and not dev’ed) for master!

Nice, I like that. Mine says v1.1 — this is better.

Indeed I missed the common /v1 part, I will do that instead, thanks for pointing it out.

Maybe another alternative; I have a separate depot/environments/common and use JULIA_LOAD_PATH="@common::". Could use ::@common if you want the v1.1 prompt, but then installing stuff into the common environment is annoying (unless there’s a way to switch?)

1 Like