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

Fix requirements.txt export for git dependencies #3089

Merged
merged 1 commit into from Oct 6, 2020
Merged

Fix requirements.txt export for git dependencies #3089

merged 1 commit into from Oct 6, 2020

Conversation

zyv
Copy link
Contributor

@zyv zyv commented Oct 5, 2020

After #2662 was merged, exporting requirements with git dependencies triggers an exception due to accessing the first element of an empty list:

[tool.poetry.dependencies]
foo = { git = "ssh://git@github.com/foo/bar.git", rev = "301c6cb9f06ab071da7cb942060c64bdf59cd40a" }

This commit adds an empty check to avoid the exception.

Pull Request Check List

Resolves: moneymeets/python-poetry-buildpack#13

After #2662 was merged, exporting requirements with git dependencies triggers an exception due to accessing the first element of an empty list:

```toml
[tool.poetry.dependencies]
foo = { git = "ssh://git@github.com/foo/bar.git", rev = "301c6cb9f06ab071da7cb942060c64bdf59cd40a" }
```

This commit adds an empty check to avoid the exception.
@zyv
Copy link
Contributor Author

zyv commented Oct 5, 2020

Hey @abn, could you please be so kind to have a look? I understand that you were the last one to work on this piece of code. I'm not sure if my fix is any good, and maybe one needs to add a test to prevent this from breaking in the future? Sorry, but I can't help much beyond pointing the problem out due to my present workload...

@abn
Copy link
Member

abn commented Oct 5, 2020

@zyv can you try with1.1.1 first please? There was already a fix related to this. I didn't check with vcs deps, so might still be broken. Will check when i get a chance.

@zyv
Copy link
Contributor Author

zyv commented Oct 5, 2020

@abn thanks for the quick reaction, but the problem is still present for me in 1.1.1.

@finswimmer finswimmer requested a review from a team October 5, 2020 19:20
@abn
Copy link
Member

abn commented Oct 5, 2020

@zyv I am unable to reproduce this.

$ cat pyproject.toml 
[tool.poetry]
name = "foobar"
version = "0.1.0"
description = ""
authors = ["Your Name <your.name@example.com>"]

[tool.poetry.dependencies]
python = "^3.8"
sampleproject = {git = "https://github.com/pypa/sampleproject.git", rev = "52966defd6a61e97295b0bb82cd3474ac3e11c7a"}

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
$ poetry@1.1.1 export -f requirements.txt --without-hashes
peppercorn==0.6
sampleproject @ git+https://github.com/pypa/sampleproject.git@52966defd6a61e97295b0bb82cd3474ac3e11c7a

@marns93
Copy link

marns93 commented Oct 6, 2020

@abn It seems to me, that the error occurs if there is a git dependency within the dependency.
I can reproduce the problem with the following pyproject.toml

[tool.poetry]
name = "foobar"
version = "0.1.0"
description = ""
authors = ["Your Name <your.name@example.com>"]

[tool.poetry.dependencies]
python = "3.8.3"
sampleproject-mm = { git = "ssh://git@github.com/moneymeets/sampleproject.git", rev = "83068b995c2f94b0d51333b932b1a939084e9ef7" }

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

@abn abn merged commit 27858e8 into python-poetry:master Oct 6, 2020
@abn abn added the kind/bug Something isn't working as expected label Oct 6, 2020
@abn abn added this to the 1.2 milestone Oct 6, 2020
Copy link

github-actions bot commented Mar 1, 2024

This pull request 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 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error after Poetry v1.1.0 update as default version
3 participants