One more question for today - is it possible to ha...
# ask-community
One more question for today - is it possible to have a python package expose a repository factory? I've been able to get a package to expose multiple repositories, but only if they are explicitly configured. I was hoping to generate multiple repositories in code, but can't quite figure out the cleanest way to do that.
I don’t believe theres an official sanctioned way to do that. Historically we’ve only had people with factories at the repository level instead of the package level. Encourage you to file an issue with some context on your use case. In the mean time, I bet there is some whacky python shenanigans you can do by running code at module definition time that tacks on properties to the instantiating module.
setattr(sys.modules[__name__], 'repo_name', repo)
. Not “clean” but might work.
I've thought about this some more, and it might actually be cleaner to not do this and to clearly define each individual repository. I haven't gotten a chance to experiment more with this yet, so just wanted to know what the landscape looked like for my options