Closed jalving closed 2 years ago
Merging #97 (0f55ad2) into main (d688364) will decrease coverage by
0.11%
. The diff coverage is77.77%
.
@@ Coverage Diff @@
## main #97 +/- ##
==========================================
- Coverage 95.08% 94.97% -0.12%
==========================================
Files 25 26 +1
Lines 1364 1372 +8
Branches 189 191 +2
==========================================
+ Hits 1297 1303 +6
Misses 37 37
- Partials 30 32 +2
Impacted Files | Coverage Δ | |
---|---|---|
src/omlt/io/__init__.py | 60.00% <60.00%> (-40.00%) |
:arrow_down: |
src/omlt/dependencies.py | 100.00% <100.00%> (ø) |
|
src/omlt/formulation.py | 92.64% <100.00%> (+0.10%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
a couple quick notes:
@abstractmethod
was not defined on the __init__
method in _PyomoFormulationInterface
. I am testing with the same flake8 version locally which did not error. I have not found why it happens on Github. attempt_import
for the case where we don't have tensorflow or onnx. Those tests might be more cumbersome to write. @carldlaird do you have any ideas?
This PR uses the pyomo
attempt_import
to defer the import of dependent packages until they are used (or to check if the package exists). See src/omlt/dependencies.py. This should address issue #96.The function
attempt_import
offers a lot of extra functionality - not sure whether we need to use all of it.E.g., to check if keras (or onnx) is available, use:
from omlt.dependencies import keras_available
E.g., to import keras (or onnx) use:
from omlt.dependencies import keras
If you then try to use keras and it is not installed, Pyomo's attempt import will throw an exception.
Legal Acknowledgement\ By contributing to this software project, I agree my contributions are submitted under the BSD license. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.