Yes @lmiq. It is also true that you have to build your package folders correctly, and use the package manager correctly. This is definitely another possible source of issues (took me a while to understand what Julia wants).
Possible issues with your solution
Relative paths
My first suggestion would be to avoid using relative paths at all when you add
or dev
a package. Since I’m pretty sure you don’t know what will be the “current directory” (I sure don’t), to me, that seems like a bad way to learn how to use the package manager correctly:
By looking carefully at the package manager output, it would appear that you are using a relative path:
I’m pretty sure this is a problem waiting to happen unless you really know what you are doing.
add
vs dev
Indeed. pkg> add
is not the best choice to to add packages under development. Each time you would want to test a change in your code, you’d have to:
bash$ git commit .
(The changes to your package).
pkg> up
(make Juila update which version of your package it uses).
Otherwise, you will be testing out old code.
Going back to relative paths:
Look at the package manager output:
- It looks to me like you tried developing a package that was already registered by the package manager - so instead of pointing to your new directory, it kept using the old version of your package.
Once added, you don’t specify paths anymore
Since you already had a Package1
, the dev
command should have just been:
(@v1.5) pkg> dev Package1
That will correctly switch you over to dev
mode on Package1
.
If you wish to switch to a different “Package1
”, then I suggest the following:
(@v1.5) pkg> rm Package1
(@v1.5) pkg> dev /abs/path/to/new/Package1
Works for me
I tried creating your Package1
, just to make sure I am not misleading anyone:
But on my side, I stuffed this code in a package I “generate”-ed with the package manager:
(v1.3) pkg> generate Package1
So, this code went into my new ./Package1/src/Package1.jl
. Everything worked fine:
(v1.3) pkg> dev /abs/path/to/new/Package1
julia> using Package1
julia> Package1.Package1_A.f(3)
6