-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
package alternatives in Pkg3? #37
Comments
Similarly, there should be a way for users to specify which option they want to use when multiple are available, presumably via a TOML file? |
The situtation perhaps is more complex.
Etc etc, |
@oxinabox, that doesn't seem too much more complex to me. It just means:
|
Would this be mutually exclusive, with only one package allowed to actively satisfy the dependency at a time? |
@tkelman, I don't think so. At But there should be a way for the user to indicate a preference if the package is just going to use one of the options. |
I'm thinking of an interface something like the following. Suppose MyPackage wants at least one of three different FFT packages, and optionally can use a plotting package or can disable plotting if no such package is present. All of these optional packages are declared as
Then, in
You can specify more than one package, e.g. You can also specify the option as keywords in |
@KristofferC and I have been brainstorming and debating this for a while and so far the best scheme we've come up with is something like this made up example: [deps]
ABC = "<uuid>"
Gtk = "<uuid>"
TclTk = "<uuid>"
Qt = "<uuid>"
XYZ = "<uuid>"
[alts]
graphics = ["Gtk", "TclTk", "Qt"]
[build.deps]
Builder = "<uuid>"
Clang = "<uuid>"
GCC = "<uuid>"
MSVC = "<uuid>"
[build.alts.compiler]
linux = ["GCC", "Clang"]
macos = ["Clang"]
windows = ["MSVC"]
[test.deps]
Test = "<uuid>"
QuickCheck = "<uuid>" There are two different things at play here – alternatives and targets:
The general rules are that:
Each target is a microcosm of the top-level with its own target_deps = merge(project["deps"], project[target]["deps"])
target_alts = merge(project["alts"], project[target]["alts"]) If there are any key collisions it should be an error – targets allowed to override the identity of a package. A generalization of this maybe this: target_project = recursive_merge(project, project[target]) where |
The motivation for naming sets of alternatives is that it allows configuration files to specify them as in: [config.SomePackage]
graphics = "Qt"
compiler = "Clang" |
Maybe its worth spelling |
I was originally writing out |
I find the |
It's just an example of an system-specific alternative. Replace it with [build.alts.glam]
linux = ["Glow", "Sparkle"]
macos = ["Sparkle"]
windows = ["Glint"] if the specifics are bothering you. |
How does the user choose the alternative to be used? It would be nice to support keywords in |
There should also be a way for the config file to specify a default choice, so that if you have a bunch of complicated options it will automatically select a reasonable one and only sophisticated users can opt to select a different option. You also want to be able to change the option later, e.g. by calling |
I would expect that earlier alternatives are preferred so the ordering gives the preference. I don't see any reason why we can't support keyword arguments for picking alternatives. We can also interactively prompt people for which one they want. |
Should the config file be able to specify whether the first one is picked silently if the user doesn't specify (i.e. if there is a reasonable default), or if the user is always prompted for a choice? |
I also find it confusing how you are specifying platform-dependent options. What determines which options have platform-specific choices ( And why is it |
If the dict value for an alternative is an array then it's platform-agnostic, if it's a dict of arrays, then it's platform-specific and the keys are used to choose which set of options apply. |
I wonder whether we want Pkg3 to contain something like Debian alternatives: a package A can depend on package B or package C or package D.
For example, the Plots.jl package might want to depend on having at least one plotting package installed (cc @tbreloff).
Or, now that FFTW.jl is being split off into its own package, and that package in turn will probably depend on an AbstractFFTs package (JuliaMath/FFTW.jl#2), other packages may want to depend on having some package installed that implements FFTs following the AbstractFFT interface (e.g. FFTW, or a native Julia FFT, or FFTPACK, or MKL, etcetera).
The text was updated successfully, but these errors were encountered: