feat: implement flags - #1040
Conversation
|
I love the direction! I'm not sure about the name Obviously we could have a fixed set of keys and their values could be enums rather than free-form, but this would allow to select these things in an intuitive way, and it's strictly more powerful (and IMO expressive) than toggling flags on and off (which becomes difficult anyway if there are any choices with more than two states, which is easily possible for e.g. licenses, microarches, etc.) For completely custom overrides per package (like your libarchive example), there's probably still some room to have some I'm sorry for always referencing conda/conda#11053 in these discussions, but that's still the basic shape of the problem I'd love to solve (though for the purpose of this issue, I'd be fine to descope the |
|
With the current implementation you would be free to do I don't think adding completely open key-value to the matchspec will be a good idea as we would have no way to evolve the matchspec syntax anymore without breaking someone. Features is something that existed at some point in the conda universe which is why I avoided the name :) |
|
But I do like the idea of also having a numerical flag value, e.g. for microarch, so that you can say |
That's what I meant with having a fixed set of keys, for example: Those keys will not change meaning, and we could make it an error if a key is not in the allowed set. That way you guard the possibility for evolution in the future, while providing an easier (less nested) syntax for a large majority of cases. Sidenote: I've been quite heavily involved in the conda ecosystem for many years, and I never heard about |
|
But |
Great! One thing less to worry about. Some key dimensions (e.g. gpu) should also be on that level, and both should be possible to use in environment specs. |
|
I think from an implementation perspective this should be pretty trivial to add, should we maybe open a CEP where we can discuss the concept overall? |
|
Flags and more CEP here: conda/ceps#111 @h-vetinari I see where you are coming from but that's mostly syntactic sugar for conda / mamba / pixi or other implementations. I think we should not add this kind of extra stuff into the rigid repodata to ensure the highest flexibility to evolve it further as a standard and the highest value & flexibility for conda-forge and other distributions. On the CLI we could totally allow to map We could also do that in rattler-build if that cristallizes as the standard, without touching CEPs. |
|
Closing in favor of #1550 |
This is a new idea for Conda packages.
I imaging that for compiled packages, having flags can be quite useful. For example, a library like libarchive can be built with support for a number of different compression algorithms. It would be nice if we could express these variants with a more natural syntax vs. relying on globs on the build string. For example, for libarchive it would be nice to be able to say libarchive[flags=[zstd, bz2, zlib]] to denote the minimum enabled flags.
For pixi build we already discussed we might want to have release and debug flags which we could express in a similar way. We might also want to be able to negate flags (e.g. libarchive[flags=[~zstd]].
Different from extras, flags would select a different variant of the package (ie. completely different repodata record). This different package might also have different requirements (for example, if zstd is enabled, the zstd package will be a dependency of libarchive).
Conceptually, this is similar to matching packages based on their build string, but just a much better syntax vs trying to do that with globs.
I would like to implement two extensions to the current implementation:
?releaseor?debug: if thereleaseflag is available, select it (can be turned on for all packages). If the flag does not exist, that's ignored.~zstd: negate the existence ofzstd(could also be!zstd).