Conditional loading of packages – a bug? #2345
Unanswered
kellertuer
asked this question in
Questions about using Pluto
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a question about conditional loading of packages.
Short background: We have a Pluto notebook with interactive parts that we also want to include in the docs (using PlutoStaticHTML). For that we have a Boolean to toggle to “static mode” of the notebook, since we can not use WGLMakie.jl in the CI. So we only load that if the toggle is true.
If I recreate that scenario (with our package as an example, which defines
is_point) on Julia REPL, I get❯ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.8.1 (2022-09-06) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | julia> a = false false julia> a && using Manifolds false julia> is_point ERROR: UndefVarError: is_point not defined julia>If I do the same three things in a Pluto Notebook, I get
even if I do not use the Pluto package manager I get (yes Manifolds is installed in my global environment ;) )
So – is that a bug?
Or phrased differently: How can I achieve the result from Julia REPL, conditionally loading a package, in Pluto?
Beta Was this translation helpful? Give feedback.
All reactions