JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
620 stars 260 forks source link

When `add`'ing a package, also automatically add its subpackages #3245

Open Keno opened 1 year ago

Keno commented 1 year ago

I have a package that that is internally organized as a collection of sub-packages. Now, when dev, this package, everything works great and the package can find its dependencies. However, when I add MyPackage.jl#main, I get:

    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package MySubPackage [72c5b8b4]:
 MySubPackage [72c5b8b4] log:
 ├─MySubPackage [72c5b8b4] has no known versions!
 └─restricted to versions * by MyPackage [9075980a] — no versions left
   └─MyPackage [9075980a] log:
     ├─possible versions are: 0.1.0 or uninstalled
     └─MyPackage [9075980a] is fixed to version 0.1.0

I'm assuming there's some sort of magic that makes this work for dev. It would be nice if that logic was extended to add, so this could just work.

Keno commented 1 year ago

A related issue is if you dev first and then add, the manifest will keep the paths pointed to the dev version, which is very surprising behavior.

KristofferC commented 1 year ago

the manifest will keep the paths pointed to the dev version, which is very surprising behavior.

Well, untracking a bunch of package directories just because you freed some package could also be argued to be surprising.

Keno commented 1 year ago

I suppose, but here Pkg is kind of maintaining the illusion that these packages are managed as a unit, because it automatically added the sub-packages to the manifest by filesystem path when I dev'ed the main package, so I do think it's surprising that it wouldn't manage them as a unit here.

KristofferC commented 1 year ago

but here Pkg is kind of maintaining the illusion that these packages are managed as a unit, because it automatically added the sub-packages to the manifest by filesystem path when I dev'ed the main package

Yeah, this "search" was added as a workaround for https://github.com/JuliaLang/Pkg.jl/issues/1005. From Pkg's p.o.v they are just completely independent packages though. But something can probably be done better.

oscardssmith commented 1 year ago

One especially problematic part of this is that it is impossible to add an ssh version of a subpackage.

KristofferC commented 1 year ago

Why is that impossible?

oscardssmith commented 1 year ago

it's not. Never mind.