Closed juanfung closed 5 years ago
Could this be addressed by packaging dependencies? https://docs.julialang.org/en/v0.7/stdlib/Pkg/#Creating-your-own-packages-1
Problem is not addressed by packaging dependencies. Tested on a toy module based on example in the docs.
Since this is only a problem for running scripts (ie, no problem running functions defined in the module that use external packages), best solution may be to simply load required packages at the top of the script.
DataFrames
StatsModels
StatsBase
(in make_predictors.jl
)Random
(in causal-hedonic.jl
)JLD
(in nearly all scripts)An alternative solution is to export from module CausalMixtures
(eg, `export DataFrames). I tested this with the toy module and it works if the module is loaded via using.
In addition, the following packages are used to generate figures and tables but not explicitly loaded:
Mmap
(in figtab_dpm.jl
)Gadfly
(in figtab_dpm.jl
)This commit loads the last two packages into figtab_dpm.jl
792862a398ab62dc64cc68992871fe47a212fe1a
This commit exports the packages listed in comment above for use in scripts 101d13360f45b6098431965f05c8687d99230fe3
In v0.5, module
CausalMixtures
could, eg, load package like so:using DataFrames
Then when using module
CausalMixtures
, eg, incausal-sims.jl
, I could simply do:Now, in v0.7, this doesn't work. Package
DataFrames
is not bound toMain
but rather toCausalMixtures
, which requires this:This seems a little clunky.
This also works:
df = CausalMixtures.DataFrame(A = 1:4, B = ["M", "F", "F", "M"])
, which is all sorts of confusing!What is the best practice for loading and using packages via a module?