Split out of #16 (item 2) so it can be decided on its own.
Problem
get_config, FuncBasedGettableContainer, gettable_containers, sources_chainmap and user_gettable (all in config2py/base.py) default config_not_found_exceptions to (Exception,). Any error raised by a callable source (network blip, bug, missing import, bad credentials) is treated as "not found", and the lookup silently falls through to the next, often less trusted, source (ending at the user prompt).
Why this was not changed unattended
Narrowing the default changes which errors propagate for every existing caller, and config2py has ~30 fleet dependents. For example oa builds get_config(sources=[store, os.environ, user_gettable(store)]) and relies on the fall-through. The docstring of get_config now warns about the broad default (cloud-sweep PR); the behaviour is unchanged.
Proposed plan (for a local session with the full dependents set)
- Add a module constant
DFLT_CONFIG_NOT_FOUND_EXCEPTIONS = (KeyError, LookupError, FileNotFoundError, ConfigNotFound) but keep (Exception,) as the effective default for one release, emitting a DeprecationWarning when a non-lookup exception is swallowed.
- Flip the default the next release, after running every dependent listed in
fleet_dependents.json.
- Test: a callable source raising
RuntimeError must propagate under the new default and fall through when config_not_found_exceptions=(Exception,) is passed explicitly.
Split out of #16 (item 2) so it can be decided on its own.
Problem
get_config,FuncBasedGettableContainer,gettable_containers,sources_chainmapanduser_gettable(all inconfig2py/base.py) defaultconfig_not_found_exceptionsto(Exception,). Any error raised by a callable source (network blip, bug, missing import, bad credentials) is treated as "not found", and the lookup silently falls through to the next, often less trusted, source (ending at the user prompt).Why this was not changed unattended
Narrowing the default changes which errors propagate for every existing caller, and config2py has ~30 fleet dependents. For example
oabuildsget_config(sources=[store, os.environ, user_gettable(store)])and relies on the fall-through. The docstring ofget_confignow warns about the broad default (cloud-sweep PR); the behaviour is unchanged.Proposed plan (for a local session with the full dependents set)
DFLT_CONFIG_NOT_FOUND_EXCEPTIONS = (KeyError, LookupError, FileNotFoundError, ConfigNotFound)but keep(Exception,)as the effective default for one release, emitting aDeprecationWarningwhen a non-lookup exception is swallowed.fleet_dependents.json.RuntimeErrormust propagate under the new default and fall through whenconfig_not_found_exceptions=(Exception,)is passed explicitly.