PetrochukM / HParams

Configure Python functions explicitly and safely
MIT License
126 stars 8 forks source link

Add lazy loading to `add_config` #3

Closed PetrochukM closed 4 years ago

PetrochukM commented 4 years ago

At the moment, add_config imports every module that is referenced in the configuration in order to check the function signature and path. With this PR, we add an option to lazily import modules only if they are already in sys.modules.

This optionality should increase initialization speed but it potentially leaves room for some configurations to not be checked because they are never run during runtime.

Finally:

codecov-io commented 4 years ago

Codecov Report

Merging #3 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #3   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines         226    247   +21     
=====================================
+ Hits          226    247   +21
Impacted Files Coverage Δ
hparams/__init__.py 100% <100%> (ø) :arrow_up:
hparams/hparams.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e32dd4b...68b1865. Read the comment docs.