Kami opened a new pull request #1519: URL: https://github.com/apache/libcloud/pull/1519
This pull request updates EC2 driver and moves all the various constants from ``libcloud/compute/constants.py`` module into three different files / modules in ``libcloud/compute/constants/`` directory / package. Only the relatively small ``ec2_region_details_partial`` module is imported directly when importing EC2 driver module. Other two modules are imported lazily when needed (aka when calling ``list_sizes()`` methods). ## Background, Context I was doing some import time and memory profiling and noticed that importing some of that Libcloud modules is relatively small and also has relatively large memory footprint. After digging in, I found that one of the main culprits was ``libcloud.compute.constants`` module. ## Open Questions I also removed existing ``libcloud/compute/constants.py`` file. If someone feels strongly about it, I can leave it in place for a while longer for backward compatibility reasons. It's also worth noting that this module also had a bad name since it only contained EC2 related constant and that was not obvious from the module name. ## TODO - [ ] Add some tests and instrumentation which ensures we don't (accidentally) introduce slow or large imports ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
