Specifying Dependencies Correctly for ppx_sexp_conv

Specifying dependencies correctly for packages that depend on a ppx can be a little tricky. The common mistakes are usually:

  • forgetting to mark pure preprocessing packages as {build}

  • forgetting to add the runtime as a regular dependency.

Well, now we have a new situation in our hands! Different versions of a ppx might change where their runtime comes from. In particular, ppx_sexp_conv has a runtime dependency on the sexplib package for versions below 0.11.0. While version 0.11.0 (and onwards) already contains the runtime as a subpackage: ppx_sexp_conv.runtime-lib. This is quite annoying as it means that we can’t specify the dependencies accurately for both versions of this ppx.

So we have 2 options from here:

  • Over approximate the dependencies and treat ppx_sexp_conv as a regular dependency. Additionally, add sexpib as a dependency when older versions of the preprocessors are selected

  • Drop sexplib and add a >= v0.11.0 constraint on ppx_sexp_conv.

Hopefully you found this useful. Please don’t forget to update your packages.

What about (ppx_sexp_conv {< "0.11"} && sexplib) || ppx_sexp_conv {>= "0.11"}) ? Opam support disjunctions.

1 Like

Yeah that should work. Is this suntax supported by 1.2?