# Developed package "shadows" dependency package

**URL:** <https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017>\
**Category:** General Usage\
**Tags:** package\
**Created:** [March 15, 2020, 5:59pm UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017 "2020-03-15T17:59:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [March 15, 2020, 5:59pm UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/1 "2020-03-15T17:59:14Z")

</div>

I’m not sure how to formulate this question/issue, I try to be as straightforward as possible.  
So I have two packages developed by myself (both are public, hosted on github). I started developing `PackageA` and at some point made a tag, let’s call it `tagofA` (then continued developing). Then I started developing `PackageB` which has `PackageA` as dependency, and I added the version of the tag (`tagofA`) as the version of the dependency. My issue is, that now, that both packages are `]dev`-ed, and the tag is added as dependency, it seems, that `using PackageB` loads the dev-ed version of `PackageA`.

So I,

1. `]dev`-ed `PackageA`
2. `]dev`-ed `PackageB`
3. added `PackageA#tagofA` as dependency to PackageB
4. and `using PackageB` loads the `]dev`-ed version of `PackageA` insted of the `tagofA`.

Both packaged are `]dev`-ed in the main Julia 1.3. environment, on Windows10. I skimmed through the documentation of Pkg, searching for the develop keyword, but did not find anything useful.  
Is this the expected behavior or is it a bug? Or am I missing something?

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [March 15, 2020, 6:31pm UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/2 "2020-03-15T18:31:05Z")

</div>

How are you specifying the version of `PackageA` in `PackageB`? The reason I’m asking is that if you specify just the plain version number, all versions after that that aren’t supposed to be breaking are allowed, e.g. when you specify 1.0.0, 1.0.2 or 1.3.2 are allowed as well. This is explained pretty well in the Pkg docs here:  
[https://julialang.github.io/Pkg.jl/v1/compatibility/](https://julialang.github.io/Pkg.jl/v1/compatibility/)  
If you don’t want that, you can restrict the allowed versions further either with `~1.0.0` or, even more restrictive `=1.0.0`.  
Edit:  
This would go under the `[compat]` section in your `Project.toml` file of `ProjectB`. If you only added the dependency in the `pkg>` REPL, then you probably don’t have a compat entry and need to add it.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 15, 2020, 6:46pm UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/3 "2020-03-15T18:46:09Z")

</div>

> [@cserteGT3](#):
>
> I added the version of the tag ( `tagofA` ) as the version of the dependency.

You don’t add a version of a package as a dependency, only the package itself. The version you get is what the resolver (the thing that figures out versions) gives you. The version information is stored in the `Manifest.toml` file. The manifest file of dependent packages is not used, only the manifest file of the current project is used. Therefore, since you have `PackageA` developed in your current project, that is also the version of `PackageA` that will be loaded.

Also, note that there will ever only be one version of a package loaded in a given Julia session.

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [March 16, 2020, 11:47am UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/4 "2020-03-16T11:47:14Z")

</div>

I thought I specified by addig the package to the `PackageB` environment by `]add PackageA#tagofA`. As the version I want to use is tagged with version number, but with a name, I don’t think I can specify it with a `[compat]` entry.

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [March 16, 2020, 11:53am UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/5 "2020-03-16T11:53:59Z")

</div>

Thank you, this make sense!

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [March 16, 2020, 11:24pm UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/6 "2020-03-16T23:24:59Z")

</div>

> [@kristoffer.carlsson](#):
>
> You don’t add a version of a package as a dependency, only the package itself

This makes sense, but was not immediately obvious to me. I had a package (`Package`) that in it’s manifest declared the use of a fork of a dependency (`Dependency`). A project (`project`) using `Package` then will have to also specify the fork of `Dependency` in its manifest file, otherwise the non fork will be installed when doing `instantiate -m` on the `project` manifest.  
(related to our brief discussion we forgot about on slack the other day, Kristoffer)

Question: If I in `Package` want to enforce the fork of `Dependency` being used, is the correct way forward to `pin Dependency` in `Package`’s environment?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 17, 2020, 8:51am UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/7 "2020-03-17T08:51:45Z")

</div>

> [@baggepinnen](#):
>
> Question: If I in `Package` want to enforce the fork of `Dependency` being used, is the correct way forward to `pin Dependency` in `Package` 's environment?

I don’t really understand what “in ‘Package’” means. The version/fork of ‘Dependency’ that will be used is the one in the manifest for your current active project (the one showed by ‘status -m’)

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [March 18, 2020, 5:57am UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/8 "2020-03-18T05:57:02Z")

</div>

I mean that `Package` is only compatible with the fork, so any project using `Package` must get the fork installed. If I in the package environment add the fork, this is not enough, as projects adding the package still get the non fork dependency in their Manifest.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 18, 2020, 7:34am UTC](https://discourse.julialang.org/t/developed-package-shadows-dependency-package/36017/9 "2020-03-18T07:34:03Z")

</div>

> [@baggepinnen](#):
>
> I mean that `Package` is only compatible with the fork, so any project using `Package` must get the fork installed.

Pkg doesn’t know about forks. It nows about packages (identified by UUID) and versions. So in this case, changing the UUID for the fork and depending on that should work.
