-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Defer import of matplotlib until needed #3579
Conversation
67b2c95
to
29cc627
Compare
matplotlib has a heavy dep chain Fixes secdev#3578
Codecov Report
@@ Coverage Diff @@
## master #3579 +/- ##
===========================================
+ Coverage 50.80% 86.18% +35.38%
===========================================
Files 171 285 +114
Lines 40155 64883 +24728
===========================================
+ Hits 20399 55922 +35523
+ Misses 19756 8961 -10795
|
Thanks ! |
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.
Sorry for the delay.
- Could you move the new file to
scapy/libs/
? - Would you mind doing the same for PYX to remove
extlib
the remaining entirely?
Would be awesome, thanks a lot
Retested to make sure I could still generate a plot with |
I've tried so many incantations with py27 but haven't been able to get it to patch correctly |
Should be good now. There was a name collision in the first refactor that py27 couldn't handle since it like has |
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.
Thanks for the PR !
changelog: secdev/scapy@v2.4.5...v2.5.0 Reduces memory overhead via secdev/scapy#3579
changelog: secdev/scapy@v2.4.5...v2.5.0 Reduces memory overhead via secdev/scapy#3579
changelog: secdev/scapy@v2.4.5...v2.5.0 Reduces memory overhead via secdev/scapy#3579
Similar to how
cartopy
andgeoip2
are handled, defer import of matplotlib until needed.Testing with
import scapy.packet
Before:
bdraco 52845 0.0 0.2 409457040 61264 s004 T 10:00AM 0:00.22 /opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
After:
bdraco 52900 0.0 0.1 409195664 46368 s004 T 10:01AM 0:00.17 /opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
fixes #3578
matplotlib has a heavy dep chain
I did manual testing to make sure I could still generate images when
matplotlib
installed, and verified the warning at-H
startup still works when its not