osqp / osqp-python

Python interface for OSQP

Home Page:https://osqp.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Circular test dependency on cvxpy

drewrisinger opened this issue · comments

Anything that uses module/tests/utils.py depends on cvxpy. However, cvxpy requires osqp to build, causing a circular dependency: https://github.com/cvxgrp/cvxpy/blob/b5b0f8b15b1f10106301d2b921ccfc6cbbbaf044/setup.py#L72.

I can work around this by disabling tests that use cvxpy for now, but this is still not ideal.

Can you please post an example or CI where it fails?

CVXPY does not import OSQP unless you specify to use it. We use CVXPY to solve the test problems with ECOS and double check the results. It is not a problem on our CI.

@bstellato it's an issue in Nix (nixos.org), where you're building all python packages from source, so you can't rely on pre-compiled wheels like cibuildwheel presumably does for cvxpy in your CI.

The dependency goes something like

  • Build osqp -> requires cvxpy (for tests) -> requires osqp
  • Build cvxpy -> requires osqp (b/c the setup.py has it as required install) -> requires cvxpy to complete tests

This problem could presumably be resolved by disabling tests on osqp, but that comes with its own problems.

We have the same problem in conda-forge. I now need to skip the whole test suite for the python 3.9 build to be able to unbreak the cycle.

CVXPY does not import OSQP unless you specify to use it

CVXPY specifies OSQP as a hard dependency. I agree with @drewrisinger that this is circular.

At a minimum (to fly a bit less blindly when having to break the cycle in conda-forge e.g. for a new python version), it would be good to have a way (e.g. a pytest-tag) to easily skip all tests that require cvxpy.

@h-vetinari @bstellato it may be possible to resolve the circular dependency by having OSQP's recipe require cvxpy-base (the version Michael Grant set up a while back) rather than cvxpy.

@rileyjmurray: @h-vetinari @bstellato it may be possible to resolve the circular dependency by having OSQP's recipe require cvxpy-base (the version Michael Grant set up a while back) rather than cvxpy.

Since cvxpy-base is built concurrently with cvxpy in the cvxpy-feedstock, that would unfortunately not make a difference for conda-forge.