python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.73k stars 2.27k forks source link

`recursive` flag for git based dependencies #8300

Open mflova opened 1 year ago

mflova commented 1 year ago

Feature Request

When poetry install a dependency from git, let's say:

requests = { git = "https://github.com/kennethreitz/requests.git", branch = "develop" }

There is no control over the clone command that is being applied when poetry clones this repo. Since poetry supports dependencies from different sources (from local folders, from git repos, from pypi...) there is a specific combination that is not working to me.

Let's say that we have our main repo A. This one depends on a private git repo called B. So far, the pyproject.toml file from A would look like:

# A.pyproject.toml
B = { git = <URL_TO_B>, branch = "develop" }

When we do so, B will be cloned with no --recursive flag. At the same time, if B depends on any git submodules, let's say C, its pyproject.toml would look like this:

# B.pyproject.toml
C = { path = "submodules/C", develop = true }

However, when we perform poetry install on A repository, poetry will clone B in a non recursive way. Therefore B will not be able to install its dependencies as the submodule C will be missing.

As a solution, I would propose two alternative solutions:

dimbleby commented 1 year ago

poetry is already trying to clone submodules - see https://github.com/python-poetry/poetry/blob/2b16b2fcf15da2a69e118a637ab4ee4fcb6a234c/src/poetry/vcs/git/system.py#L21 or https://github.com/python-poetry/poetry/blob/2b16b2fcf15da2a69e118a637ab4ee4fcb6a234c/src/poetry/vcs/git/backend.py#L435, depending on which git client you are using

you'll want to investigate what's going wrong with that