cabal-bounds: A command line program for managing the dependency versions in a cabal file.

[ bsd3, development, library, program, utils ] [ Propose Tags ] [ Report a vulnerability ]

A command line program for managing the bounds/versions of the dependencies in a cabal file.

'cabal-bounds' is able to do these things with the bounds of the dependencies in the cabal file:

  • drop them

  • update them by the library versions of the current cabal build

  • update them by the library versions of a haskell platform release

  • update them by the library versions specified by a file

  • dump the libraries/dependencies and their lower bound versions from the cabal file(s) into a file

For further details please consult the README.

Issues

Perhaps the currently most annoying thing is, that you have to live with the reformating of your cabal file done by the pretty printer of the Cabal library.

To only reformat your cabal file you can call `cabal-bounds format`.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.1.16, 0.2, 0.2.1, 0.3, 0.4, 0.4.1, 0.5, 0.6, 0.7, 0.8, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 0.8.6, 0.8.7, 0.8.8, 0.8.9, 0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 2.0.0, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0 (info)
Change log CHANGELOG
Dependencies aeson (>=1.2.3.0 && <2.3), base (>=4.6.0.0 && <5), bytestring (>=0.10.8.2 && <1.0), Cabal (>=3.14 && <4.0), cabal-bounds, cabal-lenses (>=0.15.0 && <1.0), cmdargs (>=0.10.5 && <0.11), directory (>=1.2 && <1.4), filepath (>=1.3 && <1.6), lens (>=4.0.1 && <6.0), lens-aeson (>=1.0.2 && <1.3), strict (>=0.3.2 && <0.6), text (>=1.1.0.1 && <2.2), transformers (>=0.3.0.0 && <0.7), unordered-containers (>=0.2.3.3 && <0.3) [details]
Tested with ghc ==7.6.2, ghc ==7.6.3, ghc ==7.8.3, ghc ==7.10.1, ghc ==8.0.1, ghc ==8.2.1, ghc ==8.4.2, ghc ==8.6.3, ghc ==8.10.1, ghc ==9.4.7, ghc ==9.8.2
License BSD-3-Clause
Author Daniel Trstenjak
Maintainer daniel.trstenjak@gmail.com
Category Utils, Development
Source repo head: git clone https://github.com/dan-t/cabal-bounds
Uploaded by DanielTrstenjak at 2024-09-29T11:04:38Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables cabal-bounds
Downloads 42571 total (11 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-09-29 [all 1 reports]

Readme for cabal-bounds-2.6.0

[back to package description]

cabal-bounds

A command line program for managing the bounds/versions of the dependencies in a cabal file.

cabal-bounds is able to do these things with the bounds of the dependencies in the cabal file:

  • drop them
  • update them by the library versions of the current cabal build
  • update them by the library versions of a haskell platform release
  • update them by the library versions specified by a file
  • dump the libraries/dependencies and their lower bound versions from the cabal file(s) into a file

Example: Initialize Bounds

If you have started a new project, created a cabal file, added dependencies to it, build it, and now want to set the lower and upper bounds of the dependencies according to the currently used versions of the build, then you can just call:

$> cabal-bounds update

This call will update the bounds of the dependencies of the cabal file in the working directory.

Example: Raise the Upper Bounds

If you have several cabalized projects, then it can be quite time consuming to keep the bounds of your dependencies up to date. Especially if you're following the package versioning policy, then you want to raise your upper bounds from time to time, to allow the building with newer versions of the dependencies.

cabal-bounds tries to automate this update process to some degree. So a typical update process might look like:

# update the version infos of all packages
$> cabal update
  
# build the project and allow newer versions of the dependencies as specified in the cabal file
$> cabal build --allow-newer='THE_PROJECT_NAME:*'

# update the upper bound of all dependencies in the cabal file, if their upper bound is lower
# than the version used by the build
$> cabal-bounds update --upper

If you're leaving out the --upper flag then update will widen the bounds on both directions. So the upper bound will only be updated it it's lower and the lower bound only if it's greater.

Example: Update Bounds by Haskell Platform

Ensuring that your project builds with the current haskell platform - or perhaps the last two ones - can make it, especially for beginners, a lot easier to build your project.

cabal-bounds supports the updating of the bounds by the library versions of a specific haskell platform release.

To update the bounds to the haskell platform 2013.2.0.0:

$> cabal-bounds update --haskell-platform=2013.2.0.0

There're two additional symbolic names for specifying a haskell platform release: current and previous.

So one use case might be to initialize the bounds to library versions used by a haskell platform release, test if your project builds and works with these, and then raise the upper bounds to the newest available versions:

# intialize the bounds to the previous haskell platform release
$> cabal-bounds update --haskell-platform=previous

# build and test the project

# initialize the bounds not present in the haskell platform
$> cabal-bounds update

Example: Update Bounds by File

It's also possible to update the bounds by library versions specified in a file:

$> cabal-bounds update --fromfile=libs.hs

The libs.hs file has to be of the format:

[ ("libA", [0,2,1]), ("libB", [2,1]), ("libC", [1]) ]

If you specify a library file and a haskell platform release at once, then first the haskell platform libraries and versions are considered and then the library file.

The library file can be created by the dump command:

$> cabal-bounds dump --output=libs.hs

The dump command will dump dependencies with their lower bound version. The command can take multiple cabal files. If the same dependencies is present in multiple files, then the lowest lower bound version is taken.

Example: Bound Changes

The => shows what the result is of the operation for every dependency. Left is the dependency before calling the command, right the one after calling.

$> cabal-bounds drop
lens >=4.0.1 && <4.1   =>   lens

$> cabal-bounds drop --upper
lens >=4.0.1 && <4.1   =>   lens >=4.0.1

If the cabal build (the setup-config) uses lens 4.1.2, then the results of the update command would be:

$> cabal-bounds update
lens >=4.0.1 && <4.1   =>   lens >=4.0.1 && <4.2
lens                   =>   lens >=4.1.2 && <4.2

$> cabal-bounds update --lower
lens >=4.0.1 && <5     =>   lens >=4.0.1 && <5
lens >=4.0.1 && <4.1   =>   lens >=4.0.1 && <4.1
lens <4.1              =>   lens >=4.1.2
lens                   =>   lens >=4.1.2

$> cabal-bounds update --upper
lens >=4.0.1 && <4.1   =>   lens >=4.0.1 && <4.2
lens >=4.0.1           =>   lens >=4.0.1 && <4.2
lens                   =>   lens <4.2

You can also specify which component of the version number should be updated:

$> cabal-bounds update --lowercomp=major1
lens >=4.0.1 && <4.1   =>   lens >=4 && <4.1

$> cabal-bounds update --uppercomp=minor
lens >=4.0.1 && <4.1   =>   lens >=4.0.1 && <4.1.3

$> cabal-bounds update --uppercomp=major2
lens >=4.0.1 && <4.1   =>   lens >=4.0.1 && <4.2

$> cabal-bounds update --uppercomp=major1
lens >=4.0.1 && <4.1   =>   lens >=4.0.1 && <5

Options

You can restrict the modification to certain sections in the cabal file by specifing the type and the name of the section:

  • --library
  • --executable=name
  • --testsuite=name
  • --benchmark=name

If you omit these options, then all sections are considered and modified.

You can also restrict the modification of dependencies by specifing which dependencies should only or shouldn't be modified:

  • --only=name
  • --ignore=name

You can also only update the dependencies without a bound by specifying the --missing flag. If you omit these options, then all dependencies are considered and modified.

All options taking a name can be specified multiple times: e.g. --executable=exe1 --executable=exe2 or --ignore=base --ignore=whatever

Please consult cabal-bounds --help for a complete list of options.

Issues

Perhaps the currently most annoying thing is, that you have to live with the reformating of your cabal file done by the pretty printer of the Cabal library.

To only reformat your cabal file you can call cabal-bounds format.