-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
WIP: Support for weak dependencies #3216
Conversation
b30f943
to
40318a3
Compare
docs/src/weakdeps.md
Outdated
It is sometimes desirable to be able to extend some functionality of a package without having to | ||
unconditionally take on the cost (in terms of e.g. load time) of adding an extra dependency. | ||
A *weak* dependency is a package that is only available to load if some other package in the | ||
current environment have that package as a normal (or strong) dependency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current environment have that package as a normal (or strong) dependency. | |
current environment has that package as a normal (or strong) dependency. |
docs/src/weakdeps.md
Outdated
|
||
Weak dependencies are listed in a `Project.toml` file under the `[weakdeps]` section which can be compared to a | ||
(strong) dependency which is under the `[deps]` section. | ||
Compatibility on weak dependencies are specified like a normal dependeny unde the ´[compat]` section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compatibility on weak dependencies are specified like a normal dependeny unde the ´[compat]` section. | |
Compatibility on weak dependencies are specified like a normal dependency under the `[compat]` section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the current docs are still very WIP.
|
||
if Base.@hasdep Contour | ||
using Contour | ||
function plot(c::Contour.ContourCollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function plot(c::Contour.ContourCollection | |
function plot(c::Contour.ContourCollection) |
docs/src/weakdeps.md
Outdated
## Compatibility with older Julia versions. | ||
|
||
It is possible to have a dependency be a weak version in Julia versions that support it and be a strong dependency in earlier | ||
Julia versions. This is done by having the dependency as *both* a strong and weak dependency. Older Julia version will ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Julia versions. This is done by having the dependency as *both* a strong and weak dependency. Older Julia version will ignore | |
Julia versions. This is done by having the dependency as *both* a strong and weak dependency. Older Julia versions will ignore |
docs/src/weakdeps.md
Outdated
|
||
It is possible to have a dependency be a weak version in Julia versions that support it and be a strong dependency in earlier | ||
Julia versions. This is done by having the dependency as *both* a strong and weak dependency. Older Julia version will ignore | ||
the specificaton of the depenency as weak while new Julia versions will tag it as a weak dependency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the specificaton of the depenency as weak while new Julia versions will tag it as a weak dependency. | |
the specification of the dependency as weak while new Julia versions will tag it as a weak dependency. |
|
||
if !isdefined(Base, :hasdep) || Base.hasdep(@__MODULE__, :Contour) | ||
using Contour | ||
function plot(c::Contour.ContourCollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function plot(c::Contour.ContourCollection | |
function plot(c::Contour.ContourCollection) |
old_num_promoted = count(in(old_uuids), weak_uuids) | ||
new_num_promoted = count(in(new_uuids), weak_uuids) | ||
|
||
# @show pkgentry pkgentry.weakdeps old_uuids new_uuids new_num_promoted old_num_promoted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# @show pkgentry pkgentry.weakdeps old_uuids new_uuids new_num_promoted old_num_promoted |
6b6d479
to
9d7a180
Compare
9d7a180
to
f9cd4c4
Compare
Closing because package extensions won #3264 |
See JuliaLang/julia#47040