Don't use valid_uri method. Instead let factory take hints, and only if hint fails then check valid uris. i.e. vcs_factory('git', _args, *_kwargs) Additionally, delay any instantiation of repos until needed. Perhaps even set_config call.