Remove import side effect
Would there be any interest in removing this line from problem.py:
https://github.com/cvxgrp/dccp/blob/c94aba9881e9f39119c1a693a5a752f23cf0d403/dccp/problem.py#L334
It would be cleaner to have a separate function called dccp.register() you could call after import.
The current version is throwing off the linter: https://www.flake8rules.com/rules/F401.html
Hello, I think the current solution is nicer from a user perspective, you only have to import the DCCP package and it will 'just work'. I do agree the current setup is annoying if you use a linter. There's just not really a good solution to this problem, you have to call something in the package to pass the check.
Therefore I recommend to adopt one of the following patterns:
import cvxpy as cp
from dccp import is_dccp
# define your problem
prob = cp.Problem(...)
# verify it's DCCP (linter will probably complain about print statements)
print("The problem is DCCP compliant:", is_dccp(prob))
# or use assert (linter might also complain about asserts in user code)
assert is_dccp(prob)
# or use an exception (this should pass without any issues)
if not is_dccp(prob):
raise ValueError("The problem is not DCCP compliant.")
In the upcoming rewrite PR you will also see that this pattern is used in the example notebooks.