-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy reader imports #4337
Lazy reader imports #4337
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm +1 on overall intent and am fine for this limited implementation. Possibly future looking comment: if we are going forward with lazy importing everything, or importing at point of use, then we should think about helper functions that avoid having this boilerplate for each reader.
Codecov Report
@@ Coverage Diff @@
## main #4337 +/- ##
=======================================
Coverage 95.78% 95.78%
=======================================
Files 97 97
Lines 20773 20800 +27
=======================================
+ Hits 19897 19924 +27
Misses 876 876 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment, otherwise LGTM
We did an OSS scan within pyansys/pyfluent and discovered a few vulnerabilities. One of those was a TIFF reader from VTK, and it's entirely possible to simply remove the offending library from
vtk
.The only issue with this is that we import the library on import, which inspired me to consider if we can just lazy import most, if not all, of our libraries since we now require VTK v9 or greater.
For now, this PR just lazy importsThis has several advantages:vtkmodules.vtkIOImage.vtkTIFFReader
, but is there any reason why we can't just do it for all the modules?As such, I'd suggest that we rethink our imports and actually get away from using
_vtk
and simply import directly fromvtkmodules
. This was only really implemented to support backwards compatibility between vtk v8 and v9 and we can now get rid of this technical debt.