Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry add git+ does not respect git repos default branch. Assumes master is default branch. #4167

Closed
3 tasks done
avnes opened this issue Jun 10, 2021 · 3 comments
Closed
3 tasks done
Labels
status/duplicate Duplicate issues

Comments

@avnes
Copy link

avnes commented Jun 10, 2021

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: macOS Big Sur 11.4. Darwin Kernel Version 20.5.0
  • Poetry version: 1.1.6
  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

According to the https://python-poetry.org/docs/cli/ you can use poetry add with a git repo. I know it is possible to specify a branch or a tag in the call, but I had assumed that would not be needed if the default branch was something other than master.

poetry add git+https://github.com/avnes/python-template-project.git


CalledProcessError

  Command '['git', '--git-dir', '/var/folders/x8/yxw7dnh10z57gqjpzr4bm55m0000gn/T/pypoetry-git-python-template-projecavjjt1j2/.git', '--work-tree', '/var/folders/x8/yxw7dnh10z57gqjpzr4bm55m0000gn/T/pypoetry-git-python-template-projecavjjt1j2', 'checkout', 'master']' returned non-zero exit status 1.

  at ~/.poetry/lib/poetry/utils/_compat.py:217 in run
      213│                 process.wait()
      214│                 raise
      215│             retcode = process.poll()
      216│             if check and retcode:
    → 217│                 raise CalledProcessError(
      218│                     retcode, process.args, output=stdout, stderr=stderr
      219│                 )
      220│         finally:
      221│             # None because our context manager __exit__ does not use them.

Steps to reproduce:

  1. poetry add git+https://github.com/avnes/python-template-project.git (will fail becase the default branch is main instead of master)
  2. poetry add git+https://github.com/avnes/python-template-project.git#main works fine. So minor issue, but a bit annoying.
@avnes avnes added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 10, 2021
@kyleflan
Copy link

The workaround above is fine for a single dependency, but in the event where a dependency itself has a dependency on a project in e.g. GitHub, there's not a straightforward solution to specify the branch for the sub-dependency.

In my situation, the sub-dependency has the dependency defined in setup.py so I would have to modify that project's setup.py to use poetry.

Attempting to specify and install the dependencies separately, e.g define the sub-dependency first in pyproject.toml, install, then define the dependency in pyproject.toml fails with the following:

  SolverProblemError

  Because car (rev master) depends on engine (branch master)
   and poetry-demo depends on engine (branch main), car is forbidden.
  So, because poetry-demo depends on car (branch master), version solving failed.

@finswimmer
Copy link
Member

Hello,

this is a duplicate of #3366

fin swimmer

@finswimmer finswimmer added status/duplicate Duplicate issues and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 23, 2021
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

3 participants