You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[backports-release-1.10] allow extensions to trigger from packages in [deps] (#54009)
There is a use case where you have a weak dependency (for one of your
extensions) that is misbehaving and you quickly want to try debug that
issue. A workflow that feels reasonable for this could be:
```
pkg> dev WeakDependency
julia> using Package, WeakDependency
```
This doesn't work right now for two reasons:
1. Doing the `dev WeakDependency` will add the dependency to `[deps]`
but not remove it from `[weakdeps]` which means you all of a sudden are
in the scenario described in
https://pkgdocs.julialang.org/v1/creating-packages/#Transition-from-normal-dependency-to-extension
which is not what is desired.
2. The extension will not actually load because you can right now only
trigger extensions from weak deps getting loaded, not from deps getting
loaded.
Point 1. is fixed by JuliaLang/Pkg.jl#3865
Point 2. is fixed by this PR.
(cherry picked from commit f46cb4c)
Copy file name to clipboardExpand all lines: doc/src/manual/code-loading.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -351,7 +351,7 @@ Since the primary environment is typically the environment of a project you're w
351
351
352
352
### [Package Extensions](@id man-extensions)
353
353
354
-
A package "extension" is a module that is automatically loaded when a specified set of other packages (its "extension dependencies") are loaded in the current Julia session. Extensions are defined under the `[extensions]` section in the project file. The extension dependencies of an extension are a subset of those packages listed under the `[weakdeps]` section of the project file. Those packages can have compat entries like other packages.
354
+
A package "extension" is a module that is automatically loaded when a specified set of other packages (its "triggers") are loaded in the current Julia session. Extensions are defined under the `[extensions]` section in the project file. The triggers of an extension are a subset of those packages listed under the `[weakdeps]` (and possibly, but uncommonly the `[deps]`) section of the project file. Those packages can have compat entries like other packages.
355
355
356
356
```toml
357
357
name = "MyPackage"
@@ -371,27 +371,27 @@ FooExt = "ExtDep"
371
371
```
372
372
373
373
The keys under `extensions` are the names of the extensions.
374
-
They are loaded when all the packages on the right hand side (the extension dependencies) of that extension are loaded.
375
-
If an extension only has one extension dependency the list of extension dependencies can be written as just a string for brevity.
374
+
They are loaded when all the packages on the right hand side (the triggers) of that extension are loaded.
375
+
If an extension only has one trigger the list of triggers can be written as just a string for brevity.
376
376
The location for the entry point of the extension is either in `ext/FooExt.jl` or `ext/FooExt/FooExt.jl` for
377
377
extension `FooExt`.
378
378
The content of an extension is often structured as:
379
379
380
380
```
381
381
module FooExt
382
382
383
-
# Load main package and extension dependencies
383
+
# Load main package and triggers
384
384
using MyPackage, ExtDep
385
385
386
-
# Extend functionality in main package with types from the extension dependencies
386
+
# Extend functionality in main package with types from the triggers
387
387
MyPackage.func(x::ExtDep.SomeStruct) = ...
388
388
389
389
end
390
390
```
391
391
392
392
When a package with extensions is added to an environment, the `weakdeps` and `extensions` sections
393
393
are stored in the manifest file in the section for that package. The dependency lookup rules for
394
-
a package are the same as for its "parent" except that the listed extension dependencies are also considered as
394
+
a package are the same as for its "parent" except that the listed triggers are also considered as
0 commit comments