How to update dependencies in an dev'd package

It’s not clear to me how dependencies are updated.

Let’s say I’m developing a package MyPackage that resides in ~./Julia/dev/MyPackage in which I have


module MyPackage
 using DistributionsAD
 #...code
end

Now I want to make changes to DistributionsAD which should be reflected in MyPackage.
So I did:


**(@v1.6) pkg>** dev DistributionsAD

**Cloning** git-repo `https://github.com/TuringLang/DistributionsAD.jl.git`

**Resolving** package versions...

**Updating** `~/.julia/environments/v1.6/Project.toml`

[ced4e74d] + DistributionsAD v0.6.26 `~/.julia/dev/DistributionsAD`

**Updating** `~/.julia/environments/v1.6/Manifest.toml`

[ced4e74d] ~ DistributionsAD v0.6.26 ⇒ v0.6.26 `~/.julia/dev/DistributionsAD`

Then I do some changes in ~/.julia/dev/DistributionsAD, e.g. I added the line using ForwardDiff at the top. After this I run:


**(@v1.6) pkg>** activate DistributionsAD

**Activating** environment at `~/.julia/dev/DistributionsAD/Project.toml`

**(DistributionsAD) pkg>** resolve

**Installed** Distributions ─ v0.25.1

**Updating** `~/.julia/dev/DistributionsAD/Project.toml`

[79e6a3ab] + Adapt v3.3.0

[082447d4] + ChainRules v0.7.65

...

but I still run into

**(DistributionsAD) pkg>** precompile

**Precompiling** project...

**Progress** [========================================>] 2/2

✗ DistributionsAD

1 dependency successfully precompiled in 9 seconds (34 already precompiled)

**ERROR:** The following 1 direct dependency failed to precompile:

DistributionsAD [ced4e74d-a319-5a8a-b0ac-84af2272839c]

**ERROR:** LoadError: ArgumentError: Package DistributionsAD does not have ForwardDiff in its dependencies:

- If you have DistributionsAD checked out for development and have

added ForwardDiff as a dependency but haven't updated your primary

environment's manifest file, try `Pkg.resolve()`.

- Otherwise you may need to report an issue with DistributionsAD

Stacktrace:

[1] **require(** into::Module, mod::Symbol **)**

@ Base ./loading.jl:884

[2] **include**

@ ./Base.jl:386 [inlined]

[3] **include_package_for_output(** pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing **)**

@ Base ./loading.jl:1213

[4] top-level scope

@ none:1

[5] **eval**

@ ./boot.jl:360 [inlined]

[6] **eval(** x::Expr **)**

@ Base.MainInclude ./client.jl:446

[7] top-level scope

@ none:1

in expression starting at /Users/tseidler/.julia/dev/DistributionsAD/src/DistributionsAD.jl:1

My understanding was, that after resolve the dependencies/manifests should have been update.
So what am I doing wrong? Also is it correct that by dev-ing DistrbutionsAD, the dev branch will be loaded in MyPackage?

You have to dev the package within your package. I.e start julia with julia --project within ~./Julia/dev/MyPackage then ] & dev DistributionsAD.

This points to the same folder of the edited version of DistributionsAD


**(MyPackage) pkg>** dev DistributionsAD

Path `/Users/me/.julia/dev/DistributionsAD` exists and looks like the correct package. Using existing path.

**Resolving** package versions...

    Updating `~/.julia/dev/MyPackage/Project.toml`
  [ced4e74d] ~ DistributionsAD v0.6.26 `../DistributionsAD` ⇒ v0.6.26 `~/.julia/dev/DistributionsAD`
    Updating `~/.julia/dev/MyPackage/Manifest.toml`
  [ced4e74d] ~ DistributionsAD v0.6.26 `../DistributionsAD` ⇒ v0.6.26 `~/.julia/dev/DistributionsAD`
...

which I guess correctly updates the manifest of my package to point to the edited version of DistributionsAD but the problem that within DistributionsAD the Manifest is not updated after adding a dependency there still exists.

Just using ForwardDiff is not enough, you have to add it: start julia within DistributionAD dev-folder, ], and 'add ForwardDiff`.

Now I get it, I was assuming having it in (@1.6) will also make it available in there.
Many thanks for the help.

1 Like