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 does not resolve dependencies correctly for fastdiff #3140

Closed
2 of 3 tasks
sobolevn opened this issue Oct 8, 2020 · 8 comments
Closed
2 of 3 tasks

poetry does not resolve dependencies correctly for fastdiff #3140

sobolevn opened this issue Oct 8, 2020 · 8 comments
Labels
kind/bug Something isn't working as expected

Comments

@sobolevn
Copy link
Contributor

sobolevn commented Oct 8, 2020

  • 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 10.14
  • Poetry version: 1.1.2
  • Link of a Gist with the contents of your pyproject.toml file:
[tool.poetry]
name = "code6"
version = "0.1.0"
description = ""
authors = ["sobolevn <mail@sobolevn.me>"]

[tool.poetry.dependencies]
python = "^3.7"
fastdiff = "0.2.0"

[tool.poetry.dev-dependencies]

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

Issue

Here's a lock file for this project:

[[package]]
name = "fastdiff"
version = "0.2.0"
description = "A fast native implementation of diff algorithm with a pure python fallback"
category = "main"
optional = false
python-versions = "*"

[package.dependencies]
wasmer = {version = ">=0.3.0", markers = "python_version >= \"3.5\" and platform_machine == \"x86_64\" and sys_platform == \"darwin\""}

[[package]]
name = "wasmer"
version = "0.4.1"
description = "Python extension to run WebAssembly binaries"
category = "main"
optional = false
python-versions = "*"

[metadata]
lock-version = "1.1"
python-versions = "^3.7"
content-hash = "f0c632f74d4c742bb9b222cea08f50aaf6dfea9eaea54ebb0fcedf7bc101b8d5"

[metadata.files]
fastdiff = [
    {file = "fastdiff-0.2.0.tar.gz", hash = "sha256:623ad3d9055ab78e014d0d10767cb033d98d5d4f66052abf498350c8e42e29aa"},
]
wasmer = [
    {file = "wasmer-0.4.1-cp36-cp36m-macosx_10_7_x86_64.whl", hash = "sha256:519d9f7a33f0dc28498edf8d074944df1cfda3f4d56a6b0a9dc606e99f230c07"},
    {file = "wasmer-0.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:c36c6c7a3582c0467ea76c5b86a5a25c2e1a713669ebf8fc6511b26f30828ed7"},
    {file = "wasmer-0.4.1-cp37-cp37m-macosx_10_7_x86_64.whl", hash = "sha256:6e37fd76931da954d12f7708e7fc790c479e17ea6dfe54bb4f1403d6fe919c62"},
    {file = "wasmer-0.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d5a58b318628bd48605a4810ee9ba030ec4423dee730d45f031bd082cf36ad8b"},
    {file = "wasmer-0.4.1-cp38-cp38-macosx_10_7_x86_64.whl", hash = "sha256:f864b1e910e6803aa8f3ed9c371b145f0b6fd191f5fbefea011ac7ed4258734d"},
    {file = "wasmer-0.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:fa1c8479781c91e6b814ef006f6e099b6550eba12601a8617475fb514fc09365"},
    {file = "wasmer-0.4.1-py3-none-any.whl", hash = "sha256:92aee4b3994735f72e27c9deaca36d063781ddfd1068756bf63509288c1a2c14"},
]

Take a look at this part:

[[package]]
name = "fastdiff"
version = "0.2.0"
python-versions = "*"

[package.dependencies]
wasmer = {version = ">=0.3.0", markers = "python_version >= \"3.5\" and platform_machine == \"x86_64\" and sys_platform == \"darwin\""}

That's how poetry resolves deps for fastdiff. And there's how they are defined:

requirements = [
    # wasmer, if we are in Linux x86_64
    'wasmer>=0.3.0; python_version>="3.5" and platform_machine=="x86_64" and sys_platform=="linux"',
    # wasmer, if we are in macOS x86_64
    'wasmer>=0.3.0; python_version>="3.5" and platform_machine=="x86_64" and sys_platform=="darwin"'
]

Source: https://github.com/syrusakbary/fastdiff/blob/master/python/setup.py

So, I end up with a missing wasmer package on linux. PR with reproduction: wemake-services/wemake-python-styleguide#1655

@sobolevn sobolevn added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 8, 2020
@sobolevn
Copy link
Contributor Author

sobolevn commented Oct 8, 2020

On previous version of poetry (1.0.x) it was:

[[package]]
category = "dev"
description = "A fast native implementation of diff algorithm with a pure python fallback"
name = "fastdiff"
optional = false
python-versions = "*"
version = "0.2.0"

[package.dependencies]
[package.dependencies.wasmer]
python = ">=3.5"
version = ">=0.3.0"

sobolevn added a commit to sobolevn/fastdiff that referenced this issue Oct 8, 2020
@sobolevn
Copy link
Contributor Author

sobolevn commented Oct 8, 2020

This commit fixed this for my repo: wemake-services/wemake-python-styleguide@22f9873

But, this was my manual hack 🙂

@abn
Copy link
Member

abn commented Oct 8, 2020

Can you please try the fix at #3147.

Using pipx

pipx install --suffix=@3147 'poetry @git+https://github.com/python-poetry/poetry.git@refs/pull/3147/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/3147/head
python -m poetry new foobar
pushd foobar
sed -i /pytest/d pyproject.toml
python -m poetry add fastdiff
EOF

@abn abn removed the status/triage This issue needs to be triaged label Oct 8, 2020
@sobolevn
Copy link
Contributor Author

sobolevn commented Oct 8, 2020

It now generates:

wasmer = {version = ">=0.3.0", markers = "python_version >= \"3.5\" and platform_machine == \"x86_64\" and sys_platform == \"darwin\" or python_version >= \"3.5\" and platform_machine == \"x86_64\" and sys_platform == \"linux\""}

@sobolevn
Copy link
Contributor Author

sobolevn commented Oct 8, 2020

@sobolevn
Copy link
Contributor Author

sobolevn commented Oct 8, 2020

Looks like it works! Thanks a lot @abn!

@intgr
Copy link
Contributor

intgr commented Nov 17, 2020

If I understand correctly, the fix for this bug in #3147 was released in Poetry 1.1.3?

If yes, please close this bug.

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
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants