martius-lab / cluster_utils

https://cluster-utils.readthedocs.io/stable/
Other
12 stars 0 forks source link

Make server-dependencies optional #120

Closed luator closed 3 months ago

luator commented 4 months ago

Move all the dependencies that are only needed for running the main (aka server) process but not for the job scripts into an optional dependencies group "server". This dramatically reduces dependencies for the user code, making installation faster and reducing potential version conflicts.

So now, user code which only needs the client API can simply depend on "cluster_utils" as before, but for running the cluster_utils applications (grid_search/hp_optimization), one needs to install "cluster_utils[server]".

Imports of these applications are wrapped with OptionalDependencyImport("server"), to give the user a useful error message in case the necessary dependencies have not been installed. For this, OptionalDependencyImport has been moved to base.utils, so it can be imported without triggering any server dependency imports.

Also added a new integration test which uses a venv, for verifying that the client API is actually working with the provided dependencies.

Closes #83.

@mseitzer I'm not really happy with the name "server" for the dependency group but couldn't come up with a better one. It makes sense from a technical point of view, as it contains the dependencies for the "server" sub-package but is maybe not super intuitive for the user. Please let me know in case you have a good idea.

luator commented 3 months ago

Thanks, I think "cli" is much better than "server". I actually like "runner" even more, though. It is relatively clear from the user point of view ("needed to run things") and also describes the actual functionality better than "cli" (which sounds a bit like it's just a frontend, e.g. as an alternative to some "gui"). That said, I'm also happy with "cli", so if you prefer that, I'll use it.

mseitzer commented 3 months ago

We can go with "runner" for the dependency group. At first I thought it's too narrow in scope, as the CLI encompasses other things as well. But the main functionality is still to run things, and in the end, everything it does can be seen as "running things".