Skip to content
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

Allow --pvp-bounds to use multiple stack.yaml configurations #2262

Open
mgsloan opened this issue Jun 9, 2016 · 7 comments
Open

Allow --pvp-bounds to use multiple stack.yaml configurations #2262

mgsloan opened this issue Jun 9, 2016 · 7 comments
Assignees
Milestone

Comments

@mgsloan
Copy link
Contributor

mgsloan commented Jun 9, 2016

This is split off from #1568, which focused on having multiple configurations in a single stack.yaml file.

As @sjakobi suggests, it's quite reasonable to still have a --pvp-bounds flag which uses multiple configs:

How about specifying the extra stack.yamls to consider with an optional flag to --pvp-bounds, e.g. --also-considering?
Example command: stack sdist --pvp-bounds both --also-considering stack-7.8.yaml stack-8.0.yaml.

Folks would probably want to automate this via a Makefile or script.

@borsboom
Copy link
Contributor

borsboom commented Jun 9, 2016

I'm very much in favour of this. It'd be super useful when uploading stack itself to Hackage.

wincent added a commit to wincent/docvim that referenced this issue Jun 18, 2016
Squash of `bounds` branch:

- https://github.com/wincent/docvim/tree/bounds
  (commit 22e92335248334b33d791c179b25fc53a16aafb2)

Based on discussion here:

  http://stackoverflow.com/a/37876041/2103996

Trying this:

- (Almost) no constraints in docvim.cabal file.
- Upload using --pvp-bounds, which produces a docvim.cabal file something like
  this: https://gist.github.com/wincent/145d35bbc75cff2a491fd33fe81d39b0

This effectively means we'll upload something more constrained than what we
tested in Travis, and that is probably OK.

Note that I had to add base upper bounds as noted here:

  https://travis-ci.org/wincent/docvim/jobs/138374403

> ++cabal check
> The following errors will cause portability problems on other environments: *
> The dependency 'build-depends: base' does not specify an upper bound on the
> version number. Each major release of the 'base' package changes the API in
> various ways and most packages will need some changes to compile with it. The
> recommended practise is to specify an upper bound on the version of the 'base'
> package. This ensures your package will continue to build when a new major
> version of the 'base' package is released. If you are not sure what upper
> bound to use then use the next major version. For example if you have tested
> your package with 'base' version 2 and 3 then use 'build-depends: base
> >= 2 && < 4'.
>
> Hackage would reject this package.

See also:

  commercialhaskell/stack#2262
@DanBurton
Copy link
Contributor

+1 looks like a very sensible user interface to add needed flexibility to --pvp-bounds.

@sjakobi
Copy link
Member

sjakobi commented Jun 20, 2016

I'm wondering if we could get away without having a separate stack.yaml for each dependency configuration that should be considered.

With the current feature idea, if I had a simple library, I'd create a directory other-stack-yamls that contains a bunch of stack-lts-X.yaml files containing only the resolver line with one X for each lts generation that I want to support and then run stack sdist --pvp-bounds both --also-considering other-stack-yamls/stack*.yaml when making a release.

So what I'm currently thinking, is that it should be possible to pass both stack.yaml file names and snapshot names to --also-considering, so you could say e.g.

stack sdist --pvp-bounds both --also-considering stack-7.8.yaml lts-4 nightly-2016-06-19

Thoughts on that, anyone?

Ideally it would also be easy to run tests with the same list of dependency configurations.

@mgsloan
Copy link
Contributor Author

mgsloan commented Jun 24, 2016

@sjakobi Seems like a good approach to me! Perhaps we should allow stack.yaml filepaths in generaal for --resolver? I do not see a downside. It is shorter and easier to type than --stack-yaml.

@DanBurton
Copy link
Contributor

Well, there can be a lot more config than just the resolver in the stack.yaml file; it doesn't make sense to me to allow a file for the --resolver flag.

@sjakobi sjakobi self-assigned this Jun 25, 2016
@sjakobi
Copy link
Member

sjakobi commented Jun 25, 2016

Perhaps we should allow stack.yaml filepaths in generaal for --resolver? I do not see a downside. It is shorter and easier to type than --stack-yaml.

Assume that there's a file stack.yaml:

packages:
- pkg1
- pkg2
resolver: lts-6.4

and a file stack-8.0-testing.yaml:

packages:
- pkg1
resolver: nightly-2016-06-24

Which packages would stack --resolver stack-8.0-testing.yaml build build?

I think I agree with @DanBurton that you sometimes want to use the standard config (stack.yaml) with a different resolver and sometimes want to use an entirely different config, in which case it's clearest to specify it with the --stack-yaml option.

As I've written in #2238 I would though like to be able to specify a resolver manually and ignore any extra-deps that are specified in the stack.yaml. I think I'm even in favor of changing the semantics of --resolver for this.

BTW, I've started implementing this issue. In this context --also-considering lts-6.4 will mean "use the versions from lts-6.4 for all non-local dependencies, ignoring any extra-deps listed in the stack.yaml".

@sjakobi
Copy link
Member

sjakobi commented Jul 22, 2016

Right now I'm thinking that this could be the basis for a "test-driven version bounds" style of package management.

What's missing is a command stack gen-lower-bounds-config that generates a stack config stack-lower-bounds.yaml from the given lower bounds in a .cabal file. The resolver could simply be the oldest snapshot that uses a compatible GHC version. The lower bounds from the .cabal file should go into the extra-deps. The package author would probably have to edit the stack-lower-bounds.yaml a bit to make it buildable and could then delete the lower bounds in their .cabal file.

If the stack-lower-bounds.yaml is used for CI it will always inform the package author when they lose compatibility with a dependency version so they can either regain compatibility or adjust the stack-lower-bounds.yaml.

If the author then creates their sdist with stack sdist --pvp-bounds both --also-considering stack-lower-bounds.yaml they can be reasonably confident that the package will indeed build with all admissible dependency versions.

Thoughts?

You may BTW chime in on the various open design issues in my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants