Skip to content

Commit 6b94656

Browse files
SvenSerneelsclaude
andcommitted
make cyipopt/sudire optional dependency
- Default install: pip install direpack (without cyipopt/sudire) - Full install: pip install direpack[ipopt] (includes cyipopt for sudire) - sudire and ipopt_temp modules are conditionally imported Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent cd80295 commit 6b94656

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ def get_metadata():
7777
'scikit-learn>=0.18.0',
7878
'pandas>=0.19.0',
7979
'statsmodels>=0.8.0',
80-
# 'ipopt>=0.1.5',
81-
'dcor>=0.3'
82-
]
80+
'dcor>=0.3',
81+
'sympy>=1.0'
82+
],
83+
extras_require={
84+
'ipopt': ['cyipopt>=1.0.0'],
85+
}
8386
)
8487

src/direpack/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
__version__ = "1.1.3"
1313
__date__ = "2024-05-23"
1414

15-
# The commented lines can be uncommented if IPOPT has been installed independently.
16-
1715
from .preprocessing.robcent import (
1816
VersatileScaler,
1917
versatile_scale,
@@ -32,9 +30,15 @@
3230
from .ppdire.ppdire import ppdire
3331
from .ppdire.capi import capi
3432
from .dicomo.dicomo import dicomo
35-
from .sudire.sudire import sudire, estimate_structural_dim
36-
from .plot.sudire_plot import sudire_plot
3733
from .plot.ppdire_plot import ppdire_plot
3834
from .plot.sprm_plot import sprm_plot, sprm_plot_cv
39-
from .ipopt_temp.ipopt_wrapper import minimize_ipopt
40-
from .ipopt_temp.jacobian import *
35+
36+
# Optional imports requiring cyipopt (install with: pip install direpack[ipopt])
37+
try:
38+
from .sudire.sudire import sudire, estimate_structural_dim
39+
from .plot.sudire_plot import sudire_plot
40+
from .ipopt_temp.ipopt_wrapper import minimize_ipopt
41+
from .ipopt_temp.jacobian import *
42+
IPOPT_AVAILABLE = True
43+
except ImportError:
44+
IPOPT_AVAILABLE = False

0 commit comments

Comments
 (0)