0

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.

tsybaya
  • 117
  • 1
  • 7
  • 1
    add common repo as submodule ? – rasjani Jan 14 '21 at 13:47
  • @rasjani is it any other way? It is gonna be used as a third-party without contributing to it. – tsybaya Jan 14 '21 at 13:52
  • 1
    if the files from the submodule are included as part of the source distribution or wheel (for example, included via MANIFEST.in file), there's nothing wrong with the approach. Relying on some external service at install time *is not a good idea* and will cause issues for random people. – rasjani Jan 14 '21 at 13:56
  • 1
    Any chance you can contribute a setup.py to the other repository? If not, I also recommend the submodule approach. – joanis Jan 14 '21 at 14:03

1 Answers1

0

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.
tsybaya
  • 117
  • 1
  • 7