From 1d196203406227222ede7a391354ab30d501d6e8 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Tue, 4 Jul 2023 08:24:37 +0300 Subject: [PATCH 1/2] recommend adding Requires to weakdeps --- docs/src/creating-packages.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/creating-packages.md b/docs/src/creating-packages.md index 911cae8142..0c758e31fa 100644 --- a/docs/src/creating-packages.md +++ b/docs/src/creating-packages.md @@ -418,6 +418,7 @@ This is done by making the following changes (using the example above): ```julia isdefined(Base, :get_extension) ? (using Contour) : (using ..Contour) ``` +- Add `Requires` to `[weakdeps]` in your `Project.toml` file, so that it is only installed on Julia versions that do not support extensions. The package should now work with Requires.jl on Julia versions before extensions were introduced and with extensions on more recent Julia versions. From 46b4f9b0e12a4be77bc538608215433905976d10 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Wed, 9 Aug 2023 04:40:44 +0300 Subject: [PATCH 2/2] Update docs/src/creating-packages.md Co-authored-by: Ian Butterworth --- docs/src/creating-packages.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/src/creating-packages.md b/docs/src/creating-packages.md index 0c758e31fa..5a17d01558 100644 --- a/docs/src/creating-packages.md +++ b/docs/src/creating-packages.md @@ -418,7 +418,8 @@ This is done by making the following changes (using the example above): ```julia isdefined(Base, :get_extension) ? (using Contour) : (using ..Contour) ``` -- Add `Requires` to `[weakdeps]` in your `Project.toml` file, so that it is only installed on Julia versions that do not support extensions. +- Add `Requires` to `[weakdeps]` in your `Project.toml` file, so that it is listed in both `[deps]` and `[weakdeps]`. + Julia 1.9+ knows to not install it as a regular dependency, whereas earlier versions will consider it a dependency. The package should now work with Requires.jl on Julia versions before extensions were introduced and with extensions on more recent Julia versions.