I wrote a Python package pack
that can perform a set of related tasks, taskA
, taskB
, ..., taskZ
. Each of them has its own module file, e.g. taskN.py
.
Now say in taskN.py
I import a third party package evilpack
. It Works On My Machine™, but a coworker of mine (a) can't install evilpack
, but (b) does not even need that module taskN
.
My goal is to structure my package so that we can choose at import time whether we want to load the module taskN
or ignore it.
What's the most elegant way to solve this? I'm sensing it has something to do with the directories' __init__.py
files.