carsonyl / pypac

Find and use proxy auto-config (PAC) files with Python and Requests.
https://pypac.readthedocs.io
Apache License 2.0
71 stars 19 forks source link

Defer js2py import until it's needed, to conserve memory. #21

Closed carsonyl closed 6 years ago

carsonyl commented 6 years ago

As noted in #20, importing js2py will immediately consume upwards of 120MB of memory. This change defers such an import until necessary, i.e. when we have a PAC file to parse.

This only helps the scenario where PyPAC is imported but doesn't end up finding/using any PAC.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.008%) to 96.421% when pulling b450254d8f24954ba1f8b5980f9ce2ae68b98dae on defer-js2py into 19697f1b24a2e6399f0d3220be1b51ea99082b73 on master.