How to manage dependencies of developed packages

I’m sorry, I tried to read docs and various related discourse posts, but I still can’t figure out how to handle dependencies in developed packages. (I’m using Julia 1.1.1 on windows.)

I am working with an environment that I always activate in the package manager before any other package commands, or using commands.

I am working with a mixture of publicly available packages and my own packages. The public packages are added to the environment with add, while my own packages are added with develop. When using the developed packages, I get depency warnings. I can make the warnings go away with manual editing of the environment’s manifest.toml file, but than only lasts until I add another package, which ovewrwrites my edits, and then I have to do it all over again!

Doing things like update and resolve in the package manager don’t help.

Please advise: What am I doing wrong?

The workflow you describe should work, so it is very difficult to understand what goes wrong without an example that shows this broken behaviour. Perhaps you can construct an example (without the private packages)?

1 Like

Thanks @fredrikekre for your prompt reply. Since this is not a code problem, but a setup problem, it would be very difficult to reproduce elsewhere.

(The one private package that gives me this problem is really very simple. It imports but a single other package and all it does is to declare a single constant. I doubt there is anything special about my code that would cause the problem.)

But perhaps you could help me understand where the package manager finds the dependency relationships that it writes into the environment’s manifest.toml file. Whenever the manifest file is updated, there are no dependencies listed for the developed packages, but for the public packages it does manage to find all dependencies. Does it read the dependencies directly from using and import statements in the code, or is this information specified (or cached) elsewhere ?

I seem to have found a solution: For each of the (misbehaving) packages in development do:

julia> cd("MyPackage")  
(MyEnvironment) pkg> activate .
(MyPackage) pkg> add Dependency1   #dependency of MyPackage
(MyPackage) pkg> add Dependency2   #dependency of MyPackage
...
julia> cd("..")
(MyPackage) pkg> activate .
(MyEnvironmentDir) pkg> up MyPackage

After doing this, the problem goes away: whenever I do a package manager action that rewrites the environment manifest file, the dependencies of the packages under development are now properly added in the manifest.

I could add that the misbehaving packages did have project.toml files, but not manifest.toml files. (These project files were originally created by doing pgk> generate MyPackage.) After doing the above procedure, each development now also has a manifest file.

I’m not sure whether the package manager harvests its dependency information from these manifest files, or whether it finds it in the Julia registry, but I’d love to know.

Only the active environments manifest file is used, so you need to make sure you have added relevant packages to your active environment.

It depends; if you do e.g. pkg> add Example the package manager looks up the name Example in the registry and finds its dependencies there. If you do pkg> add www.mypackage.com Pkg will find the dependencies there etc.

1 Like

I’m not having a good Julia coding day. I still can’t reliably convince the package manager to see dependecies of packages that I’m developing.

I have just created a new package. It lives only on my disk and is not yet checked into any git repositories. I can manage to add this package to my environment by usignt the develop command. But when I want to use that package, it won’t even compile, because whatever i do today, I just can’t convince the package manager to see the dependencies of my new package.

I’m almost ready to give up on Julia modules altogether and to just throw all my Julia code into one huge disorganized junkheap.