-
Notifications
You must be signed in to change notification settings - Fork 368
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
Next, Feature request: opam switch pin
#2532
Comments
What configures what is installed in a switch in Before overloading the command set in a manner that will certainly not scale (you may want to pin more than one package), I think this should also be designed in conjunction with local switches @seliopou has been working on. For those some kind of |
@dbuenzli it's in the opam file (the one that configures packages, and now compilers). There is also a file The few things I understood from local switches sounds like it has nothing to do with the current topic. |
Well it has, if compilers become packages, creating a switch should result in an empty shell in which you install packages (some of which may be compilers). Now you certainly want to be able to predefine a certain number of packages to be installed in a switch. |
The ability to create a completely empty switch would please me equally. |
Actually, I got a doubt: I can do it, there is a new |
@AltGr do you have user-level documentation about the way switches and their command set work in I have the feeling that it would be worthwhile to introduce an A Then local switches could be created by specifying an additional |
Sorry, I am lagging behind on documentation, but I'll be glad to explain. The best you can find yet is Metadata is now below /.opam-switch, and contains: directories
files
@Drup: glad you found it! @dbuenzli I think you can do what you want already with something in the lines of:
The import/export format has been much extended: it includes what packages are set as compiler, pins, etc. And it also contains the local definitions of pinned packages (there is even an option to include all packages, but it's not bound in the CLI yet) -- limited by the fact that they must not use a I don't understand, however, what kind of management of the export files you would want from opam, and to what purpose exactly. The To Daniel's delight, I also added a nice retro-compatibility hack so that if the above doesn't work, specifying just a version is also possible (e.g. |
Good, but I think the UI and command set needs rework and I wouldn't care too much about backward compatiblity. First
I don't think this is a good model, why would a SWITCH need a compiler package ? You may have an interesting universe that doesn't have such a package. Besides this way of operating still gives a special status to compiler packages something it is better to minimize in general. It would be much better if So
This was discussed somewhere else and in the context of being able to scale the management of local (or "per project") switches. One of the problem of local switches is that there are a lot of things you'd like in all your switches but it's a pain if you have to manage them manually in all of them (e.g. So the rough idea (many operational details would need to be specified) is to add a notion that I'll call, by lack of better name, a mixin. A mixin is simply the ability to specify packages to install with possible constraints (e.g. pin or version number) under a named entity. Adding a mixin (by its name) to a switch applies the constraints of the mixin to the switch and keeps the reference to the mixin in the switch (it's not added if the constraint fail). Updating the constraints in the mixin, tries to update them in all the switches that have a reference to the mixin (failing switches should drop the reference to the mixin, or maybe the whole operation should be aborted). Removing the mixin from a switch simply drops the reference to the mixin, possibly removing constraints aswell (e.g. would be useful to remove pins). This allows the user e.g. to have a |
On the UI:
It never stopped being the case.
I have nothing against a
It shouldn't impact too much on design, but first, note that the current repository doesn't have dependencies towards OTOH, it's a bit awkward to have the consistency of the repository depend on the packages that are set as compilers; and if we consider transitive dependencies through On switch-templatesI see, so what you wish for is replacing the older mechanism of separate Note that simple bundles have been mentionned already, in the form of virtual packages. These don't provide all the functionality, and in the current state On mixinsInteresting ideas, and that seems like it could be useful. However, it seems a bit overkill to me, and adds a whole lot of mechanisms that could be difficult to track (think about conflict messages).
My feeling is that the "root" is always a subset of "installed" at the moment: one idea was to lift this constraint to allow easier recovery from errors (providing a command that tries to reinstall all root packages). "compiler" packages may be uninstalled, in which case any state-changing command will require them to be reinstalled, to recover switch consistency. One more limitation is that all these sets are packages on specific versions, and can't therefore express acceptable ranges. Putting the handling of these three sets -- and pinnings -- apart, most of the features you are asking for from mixins could be achieved by using virtual packages and leveraging their |
The beginner argument is, as usual, fallacious. People who mention supporting beginners should read more books about usability. You don't want to support beginners, you want to expose a simple conceptual model that both the beginner and the working user are able to quickly grasp, remember and work with pleasantly. Such a simple conceptual model is: a switch is just a named empty space where you can install packages in isolation from other switches. When you create a switch you can mention a switch init (export) file that will immediately install the packages mentioned therein. I think that the conceptual model you expose at the moment is mess and won't scale gracefully to encompass further developments of OPAM (e.g. see below).
These are technical issues. Favouring technical issues over usability and exposition of a simple conceptual model is not a good idea. Looking beyond, the model I propose adapts very well with the possibility of adding local, per-project, switches. In this case when you do an
Maybe overkill and too complex, if you have better proposals I'm all for it. The problem that needs to be addressed is: an easy and efficient way to move and update package constraints between otherwise isolated switches. In my opinion neither Maybe we can drop the idea that switch remember which mixins where applied to, i.e. updates to mixins do not affect switches, that would already be a significant improvement over the status quo. In fact mixins could simply be a command that manipulates switch init files, you have those that are provided by the repo which are immutable and you can create and update your own local init files, e.g. by adding constraints manually, by snapshooting the constraints of a set of packages in a given switch etc. I know you'll tell me all this can already be done using |
Completely agree, and I propose nothing different, I just don't see the need to comfront users to this before they actually need it, esp. since some never will ("— to get an ocaml installation, you need to setup a switch. — what's a switch ?", vs. "— to test on a different compiler/package set, you need to change switch. You actually were in switch
That indeed would be a useful feature, that should fit in the UI.
I take it that by this you mean the fact that a subset of packages in a switch is defined as "base", and immutable. It adds some complexity to the model, but I think it's desirable, because you almost never want Or, maybe, you were just complaining about the UI that doesn't perfectly reflect the actual model behind switches ?
Yes and no. Given our limited resources, the consequences will be limited, or absent checks on the extra repository files, leading to possible errors or mistakes in the repository, in turn impacting usability. Having a simpler layout results in easier (hence better) maintainance in opam but also the repository. I drive these conclusions from the experience of Also, it seems to me that, regarding the global model, what you propose would move complexity around, not reduce it.
This sounds great indeed. And I am convinced that something with the functionality of
I really get the feeling that virtual packages could fit that bill quite gracefully, so would prefer to avoid adding such a complex mechanism. I am speaking from the implementation point of view: this is likely in the domain of "doable but not at all usable" for now, but there is a world of difference between adding a core mechanism and adding usability functions to make a given workflow efficient, while using existing core mechanisms, which I would be glad to do. The real limitation is that by leveraging the Also, again not usable without tooling, but an export file can now include pinnings and their definition, which may contain such virtual packages. E.g. you would get something quite close to a mixin with an export file like:
|
Well, this:
is completely different from what I propose and completely ad-hoc from my perspective.
I don't care if you create a switch on
No I was actually not thinking about this. But now that you mention this it seems suspicious to have that limitation.
Yes.
Basically you'll put the burden of managing these files on the user, separately from the opam tool, which is going to be very painful from a user perspective, especially if you'd like to be able to share switch setups. It's a little bit disappointing since you already have most of the functionality in
TBH I don't see where the complexity lies here, it's managing a set of
I don't plan to need these, I need them now. When I have ~10 pins and I need to test these in another switch, it's a very painful experience. Now you can invent ad-hoc schemes about pins that are in multiple repos or whatever virtual packages to configure switches, nothing of this strikes me as being a good idea if you consider that the problem here is simply being to manipulate and propagate switch state by defining a set of package and their constraints/pins. This problem is exactly what |
So, given the possibility of creating empty switches and the new scheme for ocaml packages, I don't think this is an issue anymore. @AltGr I'll let you close as you see fit, since there is another discussion going on. |
See #2531 for the previous part.
In order to avoid doing
which compiles the compiler twice, I would like to be able to say
The text was updated successfully, but these errors were encountered: