On Wed, Feb 24, 2016 at 6:21 PM, Jeffrey Sarnoff <[email protected]> wrote: > To allow different independent capabilities and have them be read only if > chosen, you should have each capability be written as a separate module with > its own [set of] files. > If you want the user to see them as subordinate to a larger package, let the > larger package import each conditionally. > > Currently, the only way I know to do that is to check for a global symbol.
Conditional modules and seperated sub-modules are currently not supported. Ref https://github.com/JuliaLang/julia/issues/6195 https://github.com/JuliaLang/julia/issues/4600 > > > Module ScikitLearn > > if isdefined(Main, :skLinearModel) && Main.skLinearModel==true > include("models/LinearModel.jl") # or perhaps with @reexport > end > > end > > Then, before using ScikitLearn, define skLinearModel true. > > julia> skLinearModel=true > julia> using ScikitLearn > > > On Wednesday, February 24, 2016 at 4:28:08 PM UTC-5, Cedric St-Jean wrote: >> >> >> >> On Wednesday, February 24, 2016 at 4:15:49 PM UTC-5, Jeffrey Sarnoff >> wrote: >>> >>> This should not be a problem. What is your concern? >> >> >> Loading time/RAM usage. I'm trying to wrap/port scikit-learn, and their >> module arrangement makes a lot of sense. In Python, I don't get to load code >> for support vector machines unless I actually need them. >> >> import sklearn.svm >> >> I could define separate modules like "sklearn_svm", "sklearn_cluster", but >> it's awfully ugly. >> >>> >>> On Wednesday, February 24, 2016 at 3:45:50 PM UTC-5, Cedric St-Jean >>> wrote: >>>> >>>> In Python, loading a module (i.e. importing a file) does not load >>>> sub-modules, eg.: >>>> >>>> import sklearn >>>> import sklearn.linear_model >>>> >>>> Is there any way to achieve the same thing in Julia? >>>> >>>> module A >>>> println("loaded A") >>>> >>>> module B >>>> println("loaded B") >>>> end >>>> >>>> end >>>> >>>> Can I have "loaded A" without "loaded B"?
