-
Notifications
You must be signed in to change notification settings - Fork 697
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
Cabal-install as a library #1597
Comments
I've wanted this in the past. I can only assume the reason it has been exposed as a library is to avoid caring about changing the APIs. But they seem pretty stable. |
@23Skidoo: I've created a patch right now and wanted to create pull request ... I understand @dcoutts, what you are talking about (7597a17): But exposing all the unctions is less evil than not exposing the library at all, at least in my opinion. |
Btw - can I ask why allmost no datatypes are derriving Show in cabal-install? It makes very hard to learn whats going under the hood without the ability to print something to terminal. I've added lots of "deriving (Show) for my own purposes and its a lot easier now. |
So I'm a bit concerned about having the same package be both a lib and an exe. I fear that will create problems with mixing ghc versions etc. At the moment with cabal-install having no installed footprint other than the exe itself, it's easy to mix ghc versions and cabal binary versions. However, having much of the cabal-install functionality available as one or more libraries is certainly a good plan. I just think we ought to make them as separate libs, and in a deliberate way, not just declare the package to be both a lib and an exe. We could do this at the same time as reorganising the Cabal lib. e.g.:
|
As an example, the hackage doc builder client could do with getting access to some of the cabal-install functionality. So I can certainly see the utility of it. |
Two thoughts:
|
+1 for reorganising Cabal lib. Small and well-organised library is easier to grasp, so it would be really helpful for new programmer who wants to use Cabal as a lib. |
-1000. This is a terrible idea unless there is some specific design which considers the API very thoroughly[1] and ensured that no process-wide state (or termination and such) can possibly leak. Cabal-install is designed as and must remain an-executable-only, for reasons mentioned by @dcoutts and @ttuegel. [1] ... and even so, it might unduly constrain what are essentially internal APIs and needlessly slow down or outright prevent global refactoring. In addition there are just too many way cabal-install potentially affects the current process state, e.g. signals, std I/O buffering, current working dir (not currently, but potentially), etc. We should just work to make cabal-the-executable more flexible so that you don't have to write something which uses it as a library. |
Just to clarify: I'd consider this a WONTFIX and close it with prejudice. But maybe that's just me. |
@BardurArantsson I think we need to be a bit more nuanced here. There are portions of functionality currently implemented in I agree that just adding a library section to |
I agree that e.g. the solver should perhaps be split out, but then perhaps there should be an issue for separating the solver out? (Perhaps there already is, haven't looked.) I detest abstract issues like "Make this a library" because they're not really actionable unless there's a concrete plan. It's fine to think about these things and come up with plans, but IMO this kind of discussion should probably take place on a mailing list[1] where enough people will actually have a chance to see it. I certainly know that I would never ever have discovered this particular issue (and subsequent discussion) unless I'd happened to be trawling through the issue track since I've starting developing a bit for Cabal. I was, however, lurking on the development mailing list for a long time before that (several years, I think). [1] Since that's what this particular project seems to be using for general development discussion. |
@BardurArantsson indeed there is, #2768. Fair enough, I agree that this sort of discussion of general direction should probably occur in a more visible forum. |
Another significant use-case: reading and writing |
minor nitpick: no, the |
Arguably, rather than an umbrella thing, we could granularly consider which
individual components of cabal-install could be migrated to
Cabal-the-library on a case by case basis.
|
It's completely unrealistic to think that anything like this will happen. There's way too much inertia in the code base and in the project. (Being hamstrung by a very long backward-compat 'guarantee' for Cabal doesn't help either. For one thing it makes it very "dangerous" to move things from cabal-install to Cabal because then the project it stuck with those possibly-bad decisions, effectively forever.) I gave it a good shot by splitting out the solver[1], but actually creating a separate "intermediate" solver package 'between' Cabal and cabal-install stalled on much hemming and hawing over (of all things) the minutiae of version numbers... It would actually have been very little extra work and would trivially have prevented the back-sliding mentioned in [1]. AFAICT this happens with almost every major change anybody who's not already "an insider" tries to do... and that wasn't even a major externally visible change. (I'm not particularly bitter though it may sound like it. Just disappointed.) The only way forward to avoid complete ossification is disruption, I'm afraid. I have no idea where that disruption would come from, but certainly Stack has provided some of that (for better or worse, I haven't ever even used it knowingly). I also get the gut feeling that a lot of the inertia in the project is due to fear of disruption or of being rendered irrelevant. [1] It was split into a separate module with no dependencies back to cabal-install. Of course those dependencies then crept back because there was no mechanism in place to prevent that such as keeping it in a separate package. |
I think that with the more frequent release schedule forced on us by GHC HQ (which I consider a good thing for the project) this is now more realistic. If we can't backport a patch because it introduces a breaking API change, it's less of a problem if major releases are frequent. |
I'm against growing the API surface of Cabal-the-library. It's already too big. Splitting parts of cabal-install into auxiliary libs is OTOH not a bad idea. (Case example: hackage-security, though it has been developed as a separate lib from the beginning)
…Sent from my iPhone
On 31 Jul 2018, at 11.57, Mikhail Glushenkov ***@***.***> wrote:
I think that with the more frequent release schedule forced on us by GHC HQ (which I consider a good thing for the project) this is now more realistic. If we can't backport a patch because it introduces a breaking API change, it's less of a problem if major releases are frequent.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This has been requested multiple times in the past, and now that the releases of Cabal and cabal-install are more frequent, the downsides are IMO not as big as in the past. To make the maintenance easier, I propose that we don't require @SInCE annotations in lib:cabal-install and don't go out of our way to support clients that want to be compatible with multiple major releases of lib:cabal-install. Additionally, this simplifies cabal-install.cabal a bit by removing the 'lib' flag. Fixes haskell#1597.
But we do have that mechanism! We just couldn't use it yet as it was too new. But soon we can! |
@hvr Which mechansim are you talking about? Multiple private libraries in a package? |
Hello! I would love to use
Distribution.Client.* tree
as a library - it has got a lot of useful functions, we can use to create custom behaviours. Right now it is used only by thecabal
executable, but I do no think it will take much time to separate it as a library and create a simpleMain.hs
using this library to producecabal
executable.I've asked about it on Haskell's IRC and I'm not the only person who finds this idea to be usefull.
The text was updated successfully, but these errors were encountered: