I'm developing a Python module which would be pip installed into end user's environment. For part of my module, I would like to let the user override with some functions so that the system would be tailored to specific end-user's infrastructure.
For example, we might want users to specific some rule to determine the name of an s3 bucket. Basically somehow, let user define a function like the following:
def determine_s3(var1: str, var2: str) -> str:
if var1 == "banana":
return "fruits_s3_bucket"
if var2 == "dog":
return "animals_s3_bucket"
return "others_bucket"
So different users of my module might have different aforementioned rules. They would have the same input arguments though (i.e. in this example, var1 and var2).
I also don't want to pass var1 and var2 everywhere when I need to use s3 because this is kinda static.
How can I setup my module to implement this in Python appropriately? Thanks.
P.S. In Java, I would probably let the user pass in a class name like "com.example.SomeClass" as a config and as long as the corresponding jar is on the classpath, it should work, but I'm not sure how to do that in Python.