Search code examples
pythongitpython-importsetuptoolsinstall-requires

Python setup.py clone the subfolder and use it as source code


The Python project intensively uses common declaration from another repository.

from *another_repository*.common import *class1*, *class2*.

How to properly integrate such folder within own repository, without copying it itself into the current project? In setuptools.setup there is a field like install_requires. I have tried the next option:

install_requires = [..., 'another_repository @ git+ssh://git@gitlab.com/another_repository@master&subdirectory=common', ...]

But it does not work, since common folder does not contain any setup.py module.


Solution

  • As mentioned in the comments and by thinking about the problem, I have found the next possible solutions:

    1. Migrate all common code from the another_repository/common (dataclasses, routines, etc) to the other repository common_repository, and use it as a dependency.
    2. Use a repo as a submodule it the current project.
    3. Contribute a setup.py to the another_repository/common, to make it installable.