python-poetry / poetry

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

Poetry 1.1.2 does not export dependency url for nested git dependencies #3115

Closed marns93 closed 3 years ago

marns93 commented 3 years ago

Issue

Regarding to the PR https://github.com/python-poetry/poetry/pull/3089 the dependencies are not exported correctly. The exception does not occur anymore, but the git url of the nested git dependency is missing in the requirements.txt.

$ poetry export -f requirements.txt --without-hashes
flake8==3.8.4
mccabe==0.6.1
peppercorn==0.6
pycodestyle==2.6.0
pyflakes==2.2.0
sampleproject-mm @ git+ssh://git@github.com/moneymeets/sampleproject.git@83068b995c2f94b0d51333b932b1a939084e9ef7
sampleproject==2.0.0

The output of the export command in the sampleproject repository is as expected.

poetry export -f requirements.txt --without-hashes
flake8==3.8.4
mccabe==0.6.1
peppercorn==0.6
pycodestyle==2.6.0
pyflakes==2.2.0
sampleproject @ git+ssh://git@github.com/pypa/sampleproject.git@52966defd6a61e97295b0bb82cd3474ac3e11c7a

You can reproduce this issue with the linked pyproject.toml.

marns93 commented 3 years ago

@abn Could you please have a look?

rugleb commented 3 years ago

I have a similar problem in version 1.1.2.

In ad_strategies project I have next dependencies:

[tool.poetry.dependencies]
python = "^3.8"
ad_ml = { git = "ssh://git@git.ucb.local:7999/ad/ad_ml.git", tag = "v0.6.0" }

In ad_scores package I need ad_strategies package:

[tool.poetry.dependencies]
python = "^3.8"
ad_strategies = { git = "ssh://git@git.ucb.local:7999/ad/ad_strategies.git", tag = "v0.3.0" }

Result of poetry export -f requirements.txt --without-hashes command in ad_scores package is:

ad-ml==0.6.0
ad_strategies @ git+ssh://git@git.ucb.local:7999/ad/ad_strategies.git@v0.3.0

and it wrong, I expect:

ad-ml @ git+ssh://git@git.ucb.local:7999/ad/ad_ml.git@v0.6.0
ad_strategies @ git+ssh://git@git.ucb.local:7999/ad/ad_strategies.git@v0.3.0

Sorry for my English

abn commented 3 years ago

Can you please try the fix at #3119.

Using pipx

pipx install --suffix=@3119 'poetry @ git+https://github.com/python-poetry/poetry.git@refs/pull/3119/head'

Using a container (podman | docker)

podman run --rm -i --entrypoint bash python:3.8 <<EOF
set -e
python -m pip install -q git+https://github.com/python-poetry/poetry.git@refs/pull/3119/head
python -m poetry new foobar
pushd foobar
sed -i /pytest/d pyproject.toml
python -m poetry add 'git+ssh://git@github.com/moneymeets/sampleproject.git#83068b995c2f94b0d51333b932b1a939084e9ef7'
python -m poetry export -f requirements.txt --without-hashes
EOF

Note: The container example will require authorised pubkeys or the dependency references to be updated to anonymous ssh urls or https urls.

johnpaulett commented 3 years ago

I'm having a similar issue with nested relative path local dependencies on poetry 1.1.2:

...
mypkg.common==0.0.1
mypkg.sdk @ ../../libs/sdk
mypkg.logger==0.0.1
...

It appears that poetry@3119 fixes it:

...
mypkg.common @ /tmp/mypkg/libs/py/common; python_version >= "3.8" and python_version < "3.9"
mypkg.sdk @ /tmp/mypkg/libs/py/sdk; python_version >= "3.8" and python_version < "3.9"
mypkg.logger @ /tmp/mypkg/libs/py/logger; python_version >= "3.8" and python_version < "3.9"
...

Not a problem, but interestingly, many lines now include the python_version restrictions (all of my internal dependencies and many third party libraries).

zyv commented 3 years ago

Closing this, since the problem is finally resolved in #3119.

github-actions[bot] commented 7 months ago

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.