What are the best practices for setting compat entries?


When creating packages, I have consistently found it hard to set the compat entries for my dependencies. On one hand, one would like to use the least restrictive compat entries possible, in order do be able to satisfy the requirements for the largest amount of packages. On the other hand, it is very hard to actually find this optimality, because I see no way of checking this other then by exhaustive trial and error.

For packages which have already surpassed a v1.0.0 release, this is more straightforward, because, in theory, you could just set the compat as the major version (1 in this case), and everything should work more or less. My main problem is for packages which are still in a 0.* release, as it is now not very clear which versions should one support. Recently, I developed a package that relied on StatsBase.jl, which is in version 0.34.3. I set the compat entry to 0.34, and thought that it would work. Then, in the first time that I used my package in a larger environment, I got ERROR: Unsatisfiable requirements detected. In this type of cases, how should I know which versions to support? Is there a good rule of thumb?

I am aware of julia-downgrade-compat, but it only tests your lowest compats one you already have a candidate version. My main concern is how to choose this candidate.


It doesn’t really answer your questions but GitHub - GunnarFarneback/PackageCompatUI.jl: Terminal UI for [compat] section of Julia Project.toml files. tries to help you a little bit to make an informed decision by providing a full list of package versions and their registration dates for all dependencies.

If there has been a recent breaking release in some dependency I try to find out if those changes might affect my code and add both versions to compat if they pass review/tests.

It’s somewhat risky in case you’re using features that have been introduced in some recent minor version. Usually it turns out fine but it could happen that some other package in an environment holds it back to a too low minor version.