You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to expose cabal.project data structures and parsing code in a public cabal-install library component?
This would be helpful for cabal-install wrapper tools. For example, I may want to write a tool that automagically runs one ghcid session for each component in a package (since ghci can only load one component at a time). Doable for single-package projects using the Cabal library, but more difficult for entire projects with multiple .cabal files in different subdirectories.
Note: since cabal-install-2.4 there are no such thing as cabal-install lib component.
I'm not saying that there couldn't be some small specific independent library, but that library ought to have well-designed API (i.e. not everything cabal-install uses internally).
This has been discussed previously, see #5476. I think that perfect is the enemy of good enough here, so personally am +1 on following the GHC API approach and exposing the existing internals with no guarantees of stability between major releases. Though I'd like to do this in gradual fashion and expose the solver lib first.
The #5476 already mentioned the fact which is worth repeating:
If we don't care about minor releases breaking stuff, than having a public library is ok. But in that case cabal-install would be a PITA library to depend upon.
An alternative is to be very strict of which patches to let in / backport.
If we don't care about minor releases breaking stuff
If for one strongly care about this; and this would effectively mean that we won't be able to fix some things within a patch-level or minor-release, except with high costs, due to the hard requirement to not break the API contract; and fixes might be delayed by ~6 months because of this. Are we sure we want to incur that cost?
On a related note, we should start date-versioning WIP lib:Cabal snapshots. So e.g. when a breaking change is added to Cabal-3.1, the version is bumped to Cabal-3.1.20190624 and cabal-install-3.1's dependency on lib:Cabal gets bumped to Cabal >= 3.1.20190624. Same for filterConfigureFlags. We can date-version cabal-install itself as well.
@phadej> But in that case cabal-install would be a PITA library to depend upon.
It isn't already? Almost every piece of code that I have that depends on Cabal/cabal-install internals breaks with each new release already. I don't see this as making that any worse.
I don't think having a major release of cabal-install without corresponding Cabal major is a biggie.
We can do that at some additional cost (note that we currently rely on the versions being synced to simplify some of the codepaths -- those will become harder to maintain when this symmetric simplificiation doesn't hold anymore); and it's just kinda ironic since we intentionally made lib:Cabal and exe:cabal sync up their major versions starting with cabal-install-1.16, and now you've basically saying that it was pointless to do so in the first place...
I'm implemented this in #7358 after considering this discussion. The PR deals with a few knock-on effects of the decision to not expose the cabal-install library coming from a different angle: coverage is broken. This is particularly egregious for several reasons:
The dogfooding effort required to test the cabal-install internals becomes a circus exercise for the user and the devs. Users must jump through Makefile hoops and lousy tooling support as a result of library and doc definitions not being immediately available. This incentivizes fewer tests, infrequent contributions, and poor coverage, as well as poor code hygiene because discoverability is low. I also notice we are constantly re-exporting the same shit in many different modules, and we have like, 3 different different Preludes working redundantly.
The devs need to maintain this dogfooding nonsense which bleeds from the project right up into the CI practice. I just went through this. It sucks. Don't make me do that again. It's unnecessary. We're already PVP compliant. Like @ekmett said, the API breaks and is broken in fun ways all over the place, and we do a major version bump every release except on very rare occasions. I would rather converge on correctness than stay in this broken state.
Until HPC manages to adequately support sublibrary components and multiproject builds, the lesser sin is exposing the library. I'd rather have tooling that works. Right now, cabal-install has so many broken commands that I can't really justify not doing this. cabal-install is at 27% top-level coverage. That is abysmal for a production executable. Getting this up is a high priority.
You are effectively lying as the distributor of the executable when you hand people the source dist with the prod cabal file and say "yes this is definitely cabal-install". You're not testing with the same data you're telling me is relevant for the package. Tests are an important part of the spec! This is actually a problem from an audit standpoint.
The calculus is pretty clear. I'll be merging it asap.
@phadej no, I'm considering just cabal-install, masking coverage for everything else. I do agree that Cabal seems to be well-covered with the cabal-testsuite, but it would take more follow-up work to get cabal-testsuite into modern shape (a test framework, not using the executable approach etc) so that we could actually generate reports for it as well.
Activity
phadej commentedon Jun 19, 2019
Note: since
cabal-install-2.4there are no such thing ascabal-installlib component.I'm not saying that there couldn't be some small specific independent library, but that library ought to have well-designed API (i.e. not everything
cabal-installuses internally).23Skidoo commentedon Jun 19, 2019
This has been discussed previously, see #5476. I think that perfect is the enemy of good enough here, so personally am +1 on following the GHC API approach and exposing the existing internals with no guarantees of stability between major releases. Though I'd like to do this in gradual fashion and expose the solver lib first.
phadej commentedon Jun 19, 2019
The #5476 already mentioned the fact which is worth repeating:
If we don't care about minor releases breaking stuff, than having a public library is ok. But in that case
cabal-installwould be a PITA library to depend upon.An alternative is to be very strict of which patches to let in / backport.
E.g. http://hdiff.luite.com/cgit/cabal-install/diff?id=2.4.1.0&id2=2.4.0.0 has a breaking API change right at the top of the diff.
23Skidoo commentedon Jun 19, 2019
Right. I think that we can live with the latter if major
cabal-installreleases are frequent (every six months or so).hvr commentedon Jun 23, 2019
If for one strongly care about this; and this would effectively mean that we won't be able to fix some things within a patch-level or minor-release, except with high costs, due to the hard requirement to not break the API contract; and fixes might be delayed by ~6 months because of this. Are we sure we want to incur that cost?
phadej commentedon Jun 23, 2019
@hvr, I don't think having a major release of
cabal-installwithout correspondingCabalmajor is a biggie.E.g.
cabal-install-3.0usesCabal-3.0cabal-install-3.2has a "breaking" fix, still usesCabal-3.0cabal-install-3.4usesCabal-3.4So
Cabal-3.2won't ever exist.I actually don't care whether
cabal-installandCabalversions are in sync.23Skidoo commentedon Jun 23, 2019
On a related note, we should start date-versioning WIP
lib:Cabalsnapshots. So e.g. when a breaking change is added toCabal-3.1, the version is bumped toCabal-3.1.20190624andcabal-install-3.1's dependency onlib:Cabalgets bumped toCabal >= 3.1.20190624. Same forfilterConfigureFlags. We can date-versioncabal-installitself as well.ekmett commentedon Jun 28, 2019
@phadej> But in that case cabal-install would be a PITA library to depend upon.
It isn't already? Almost every piece of code that I have that depends on
Cabal/cabal-installinternals breaks with each new release already. I don't see this as making that any worse.hvr commentedon Jun 28, 2019
We can do that at some additional cost (note that we currently rely on the versions being synced to simplify some of the codepaths -- those will become harder to maintain when this symmetric simplificiation doesn't hold anymore); and it's just kinda ironic since we intentionally made lib:Cabal and exe:cabal sync up their major versions starting with cabal-install-1.16, and now you've basically saying that it was pointless to do so in the first place...
emilypi commentedon Apr 20, 2021
I'm implemented this in #7358 after considering this discussion. The PR deals with a few knock-on effects of the decision to not expose the
cabal-installlibrary coming from a different angle: coverage is broken. This is particularly egregious for several reasons:The dogfooding effort required to test the
cabal-installinternals becomes a circus exercise for the user and the devs. Users must jump through Makefile hoops and lousy tooling support as a result of library and doc definitions not being immediately available. This incentivizes fewer tests, infrequent contributions, and poor coverage, as well as poor code hygiene because discoverability is low. I also notice we are constantly re-exporting the same shit in many different modules, and we have like, 3 different differentPreludesworking redundantly.The devs need to maintain this dogfooding nonsense which bleeds from the project right up into the CI practice. I just went through this. It sucks. Don't make me do that again. It's unnecessary. We're already PVP compliant. Like @ekmett said, the API breaks and is broken in fun ways all over the place, and we do a major version bump every release except on very rare occasions. I would rather converge on correctness than stay in this broken state.
Until HPC manages to adequately support sublibrary components and multiproject builds, the lesser sin is exposing the library. I'd rather have tooling that works. Right now,
cabal-installhas so many broken commands that I can't really justify not doing this.cabal-installis at 27% top-level coverage. That is abysmal for a production executable. Getting this up is a high priority.You are effectively lying as the distributor of the executable when you hand people the source dist with the prod cabal file and say "yes this is definitely
cabal-install". You're not testing with the same data you're telling me is relevant for the package. Tests are an important part of the spec! This is actually a problem from an audit standpoint.The calculus is pretty clear. I'll be merging it asap.
phadej commentedon Apr 20, 2021
@emilypi are you including
cabal-testsuitetests in your coverage calculations? That's is where the most testing is happening.emilypi commentedon Apr 20, 2021
@phadej no, I'm considering just
cabal-install, masking coverage for everything else. I do agree thatCabalseems to be well-covered with thecabal-testsuite, but it would take more follow-up work to getcabal-testsuiteinto modern shape (a test framework, not using the executable approach etc) so that we could actually generate reports for it as well.