When working on a package MyPackage, I have so far also used MyPackage as my current environment. This seems to work well, for instance I can easily add package dependencies using ]add.
But sometimes, e.g. during debugging, I may temporarily need a package (e.g. Plots) that I don’t want to add to MyPackage, and also not to my default environment.
What is the best practice for this? Should I have a different environment specifically for the development of MyPackage, and then activate MyPackage only temporarily when working with its dependencies?
I personally have an environment, where the package(s) I develop are in development mode, I have revise and other debugging tools installed.
I actually only ever use a packages own environment to add (or remove) dependencies.
So yes, I do exactly as you write, I have a development environment for my package – or more precisely one where all packages from the ecosystem I mostly work on are in dev-mode.
Using MyPackage as your only environment or the one you activate, I would suggest putting MyPackage in @MyPackage and then you can install anything to your julia pkgs and include them or call using from the repl while your MyPackage is loaded. Keeps your environment clean and lets you access any features from other pkgs. You can make temp dirs with julia too or if your MyPackage is on git you can dev . your repo as well, you have alot of options for isolating things.