I can’t imagine this is an original question, but I can’t seem to find an answer. I must be using the wrong search terms.
Our team is developing a Python utility package. We’ll call it “tools”. Various classes in “tools” require other packages and modules.
“tools” has several classes, with names like:
- Parser
- Logger
- FooTester
- BarTester
There are 2 other packages. One is called “foo”, and the other is “bar”. Some teams only use the “foo” package, some teams only use “bar” package. It is a requirement that teams that only use the “foo” package don’t install the “bar” package.
The “FooTester” class requires the “foo” package, as it has a “import foo” in it. The “BarTester” class requires the “bar” package, as it has a “import bar” in it.
Both teams want to put the following at the top of their script: “import tools”, then use their respective Tester class.
As we have it right now, you can’t do that unless you have the “bar” and the “foo” package installed.
What is the standard way of doing this? Is there?