I have a submodule I'm vendoring in which is poorly written (it does not use relative imports but has two packages. To be clear, I'm not installing these packages (because they don't have well maintained packages on pypi, just including the source code.)
So the layout looks like the following:
root
|
|-code
| |-file.py
|
|-vendor
|-submodule
|-package_1
| |-alpha.py
|-package_2
|-beta.py
Unfortunately, beta.py
tries to import package_1
which doesn't work because there's no __init__.py
. Because I'm pulling all submodules fresh during CI/CD, this lack of relative imports breaks my tests.
This would work if everything is at the root directory, but I can't control the submodules. I also don't want to change alpha.py or beta.py because I don't want to deal with forks.
Is there any way to have a universal __init__.py
or some equivalent so that when beta.py imports, it sees package_1 and alpha.py?