Use stable version of package while developing

I am developing a package, changing the files in .julia/dev/Package. Usually, my development workflow is:

using Revise
] dev Package
using Package

However, from time to time I want to use the stable version of the same package. Then, I want to start a Julia session and use:

using Package

and I expected that the stable version of the package was loaded in this case, not the development one from .julia/dev/, which might be even broken.

Am I doing something wrong? I think that the development versions of the packages should not be loaded unless one explicitly states that. But, anyway, how do I use the stable version of my package if I want to, without removing the data from dev?

I think it all comes to environments. If using Package do not throw an error, then Package is present/installed in the environment you are currently using (if you did not activate any environment, then you are using the general/global one). If you used dev Package in your environment then you changed the version of Package available in that environment to a dev version. You may want to have two distinct folders/projects, each with their own environment (i.e., Project.toml and Manifest.toml), in which one of them you have the dev version and in another the stable version. Otherwise (i.e., if you want to do this in the same folder), you will need to be changing through and back the package version in the single environment you are using (i.e., removing the deved package and reinstalling the not dev one).

2 Likes

If you start from ~/.julia/dev/Package and then start Julia with julia --project, you’ll start with the "dev"ved version without needing to dev it in your default environment.

1 Like

Also worth nothing that Revise typically lets you toggle back and forth between the released version and the devved version in the same session. (Exceptions are changes Revise can’t handle, like altered struct definitions.)

2 Likes

Thank you both. I got it. I had a misconception on what dev ... meant. I got the logic of the activation of environments now.

How do you do this? Can you give an example?

sec ing and hoping to find.

1 Like

There’s nothing to it, see the example in the docs. You can toggle back and forth as many times as you want. This is super-useful if you want to check that a test fails on the released version but passes with your bugfix.

4 Likes

Yup. That’s easy.

1 Like