I have a Python library I am trying to package for PyPi which contains several git submodules pointing to external repositories. Something like:
MyLibrary
- setup.py
- MyLibrary
- __init__.py
- my_code1.py
- my_code2.py
- submodules
- __init__.py
- git submodule https://www.github.com/external/repository1
- repository1_code.py
- git submodule https://www.github.com/external/repository2
- repository2_code.py
My setup.py
file looks something like:
from setuptools import setup, find_packages
setup(
name='MyLibrary',
...
packages=find_packages(),
...,
install_requires=["numpy", "scipy"]
)
The problem I am having is when I use pip to install this library, all my code and subfolders get installed fine, but the submodules are missing; they are not initialized/pulled in and don't appear inside the installed folder, neither the submodule folders nor the inner code (e.g repository1_code.py
).
Is there some way to instruct setup.py
to expand the submodules, i.e. git submodule update --init --recursive
before installing the code?