plone / guillotina

Python AsyncIO data API to manage billions of resources
https://guillotina.readthedocs.io/en/latest/
Other
187 stars 51 forks source link

mailer: import 'aiosmtplib' and 'html2text' lazily #1007

Closed masipcat closed 3 years ago

masipcat commented 3 years ago

I'm using a custom MailerEndpoint based on aiobotocore so I don't need the aiosmtp and I don't use the html2text as well

codecov-commenter commented 3 years ago

Codecov Report

Merging #1007 into master will decrease coverage by 0.1%. The diff coverage is 50.0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1007     +/-   ##
========================================
- Coverage    94.7%   94.6%   -0.0%     
========================================
  Files         316     316             
  Lines       28065   28071      +6     
========================================
- Hits        26550   26547      -3     
- Misses       1515    1524      +9     
Impacted Files Coverage Δ
guillotina/contrib/mailer/utility.py 58.4% <50.0%> (-1.0%) :arrow_down:
guillotina/contrib/redis/driver.py 83.1% <0.0%> (-2.6%) :arrow_down:
guillotina/contrib/pubsub/utility.py 84.8% <0.0%> (-2.1%) :arrow_down:
bloodbare commented 3 years ago

@masipcat would not be better to define a try except of import modules. They way its implemented each time you go on that code will load the library

masipcat commented 3 years ago

I think it's only imported the first time is called, not at every function call, but I can change it