Skip to content

update note on package extensions #3451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/src/creating-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,16 @@ If one considers `PlottingContourExt` as a completely separate package, it could
However, for extensions, it is ok to assume that the extension owns the methods in its parent package.
In fact, this form of type piracy is one of the most standard use cases for extensions.

An extension will only be loaded if the extension dependencies are loaded from the same environment or environments higher in the environment stack than the package itself.
!!! note
An extension will only be loaded if the extension dependencies are loaded from the same environment or environments
higher in the environment stack than the package itself. This means that you can load a package having an extension
from your main/default environment, load another package required for the dependency from your active project, and
get the functionality from the extension. The other way round does not work, i.e., if you load a package having
an extension from a project environment and then load the package required for the extension from you main/default
environment, the extension will not be loaded. This is different from the behavior of Requires.jl where the
conditional code is evaluated no matter from what environment the "extension dependency" is loaded.



!!! compat
Often you will put the extension dependencies into the `test` target so they are loaded when running e.g. `Pkg.test()`. On earlier Julia versions
Expand Down