Add local package at specific version

To install a local package I usually use ] add or ] dev + the path to the package folder. Is there a way yo install a package at a specific version?

Something like : ] add c:/MyPackage@0.0.2

If I want to install at a specific commit it seems the following is working:

] add c:/MyPackage#12345gd2

(By the way the progress bar is totally messed up when I use the above command in Windows)

Thank you

I guess you can install at the commit that corresponds to the version release tag, but manually finding that can be extra work.

This is about dependencies of a project, but have a read of 6. Compatibility · Pkg.jl
Among other useful information, it has this statement:

There is currently no way to give compatibility from the Pkg REPL mode so for now, one has to manually edit the project file.

1 Like

It seems add of a local directory with a version number is explicitly disallowed: add /path/to/package @1.0 returns
ERROR: version specification invalid when tracking a repository: `1.0` specified for package `/path/to/package`

For one-off usage, you can get the commit corresponding to a tag wtih git rev-list -n 1 v0.0.2 (source) on the command line and add with that commit hash.

If you have need to do this regularly with a package, a local registry might make this easier.


Thank you for your replies and help.

If you have a git tag corresponding to your version you can add with path#tag.