-
Notifications
You must be signed in to change notification settings - Fork 699
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
Teach cabal.project
about "dev dependencies"
#6952
Comments
I realised it's worth saying something about why consistency matters. Some people like to format their codebase with Just being able to write |
To be clear what I meant about the command, I imagine something like |
I think this can be implemented as out-of-cabal-install prototype first to figure out the details. |
In general I guess this is fine, yet why don't you use Nix? what if there is some dev-dependency which is not on Hackage, or not written in Haskell at all? For |
I do use Nix! However:
For sure, you're still on the hook for non-Haskell dev dependencies, which is why I think this isn't a compelling feature if we're I wouldn't mind compiling multiple versions of OOI, how would you go about solving this out-of-cabal-install? Don't you need access to the solver etc.? |
I think
|
I will believe when I see a PoC. And as I see it, it can be done as an external |
Side note: I really hope that GitHub discussions will soon be available for everyone. This is not an issue, this is an open-ended discussion.
This is wrong place for this kind of discussions. But we don't have better one. |
Happy to close and take it elsewhere, but I do think it's useful to have something for people to find if they have a similar idea and I don't know where they would look except here. |
See #6445 (comment)
|
FWIW we have extra-packages in the cabal.project file. In principle it'd allow you to do |
I traced the target selector code and found that if you use fully qualified syntax like
It happily starts building stylish-haskell but fails with
So I guess we might want to
|
Yes, I tried However, I've realised that I can do what I want by wrapping
I'm going to try out a little tool based around this idea. |
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan.
I had a quick look and the selector problems seem to be solved in HEAD and I whipped up a quick patch in #6972 to make |
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan.
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan.
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan.
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan. Includes some changes to OutputNormalizer
I was just asking on reddit about the same feature for Haskell projects, basically what @michaelpj what is your current solution right now? For the Stack project I am working on, I wanted to have this experience with Then, to install any of these tools, e.g. ormolu, I use
which installs it into project-local Now I can use From what I understood, similar thing can be achieved for
To make these tools even easier to install and use, I also implemented a How this looks right now:
Does this count as a kind of an external prototype? I understand that it takes some time for these tools to build per-project, but I don't mind as I find it very valuable to have this super simple process of just calling What I find really valuable with |
@Martinsos Have you tried using extra-packages with a recent cabal release? I think it does exactly what you are after: Try putting
into your cabal.project file. You can then use |
Hm this indeed looks like a solution (for cabal), thank you!! I haven't found much documentation on this, so couple of questions:
|
Right, the feature only started to work since I put a small patch in last year. And as such documentation is still quite a bit lacking.
Yes, with-compiler will do the right thing.
Great point! The cabal solver does have a notion of solving exes from packages differently. We should make use of that for extra-packages. But for the time being I think it's not going to work unfortunately. |
Thanks for putting in the work! with-compiler sounds great then -> I think the only thing missing is getting cabal solver to understand it is executables. But that is problem only when one of the executables is somewhat older I guess / unmaintained. |
Then I guess we can close this in favor of a new "independent goals in extra-packages" ticket. I'll do that in a few days if nobody objects. |
@fgaz feel like getting around to the above? :-) |
/me vehemently refuses to object |
Alright, here it is: #7865 |
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan. Includes some changes to OutputNormalizer
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan. Includes some changes to OutputNormalizer
Many build tools have the concept of a "dev dependency". These are dependencies which are managed by the build tool, but which are not used by any of the actual build products. Instead, they are there to provide tools that developers of the project will use.
Why have such things managed by the build tool? Can't users just install them separately? There are a few advantages, such as convenience and consistency between developers, but I think there is one that is very important in our case: the build tool may have information that makes it much easier for it to get the "right" tool. For example, many development tools themselves expect to interact with the language toolchain and build tool. It can therefore be important to pick a tool version that's compatible with the toolchain that you're using.
This is becoming very pertinent in the Haskell tooling ecosystem as more things depend on the
ghc
library. A tool which depends onghc
, likehaskell-language-server
, must be built with a version ofghc
that exactly matches the compiler the user is using for a particular project (which may indeed differ between projects!). As it stands, this creates a lot of work for users and developers. Users must carefully manage their tool installations to make sure they have precisely the right version of the tool installed for the project in question.But we already have a tool that has all the information about what version of
ghc
you are using and how that affects what versions ofhaskell-language-server
you can use: namelycabal
!So much for the motivation, what am I concretely suggesting?
cabal.project
learns a new field:dev-tools
, which is a list of component specifications a labuild-tool-depends
.cabal
command will build all thedev-tools
and install them into some project-local location.I don't think the
dev-tools
build should include constraints from the components in the project - the implicit constraints onghc
,Cabal
etc. should be enough.Partial duplicate of #5588, but I'm making quite a different case, which I think is much more compelling than just convenience.
Many of the other build tools which have "dev dependencies" also use them for things that have better solutions in
cabal
, e.g. for build tools, test dependencies etc. I think there's still a useful role for dev dependencies that are really for developers only.A short list of things I expect people might want to put into
dev-tools
:haskell-language-server
/ghcide
etc.ormoulu
/stylish-haskell
/brittany
etc.hlint
/stan
(stan
does actually rely on.hie
files and hence depends onghc
!)One could even imagine people who build their Haskell with alternative systems like
shake
might use acabal.project
to get theshake
binaries in the first place.The text was updated successfully, but these errors were encountered: