Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

It's not possible to install ansible-lint 6.9.0 using poetry #2730

Closed
KamilaBorowska opened this issue Nov 24, 2022 · 6 comments
Closed

It's not possible to install ansible-lint 6.9.0 using poetry #2730

KamilaBorowska opened this issue Nov 24, 2022 · 6 comments
Labels

Comments

@KamilaBorowska
Copy link
Contributor

Summary

Installing ansible-lint using poetry add ansible-lint@latest is not possible.

Issue Type
  • Bug Report
STEPS TO REPRODUCE

Create a new project with poetry init and then run poetry add ansible-lint@latest

Desired Behavior

ansible-lint should be installed.

Actual Behavior
$ poetry add ansible-lint@latest
Using version ^6.9.0 for ansible-lint

Updating dependencies
Resolving dependencies... (0.1s)

Because no versions of ansible-lint match >6.9.0,<7.0.0
 and ansible-lint (6.9.0) depends on will-not-work-on-windows-try-from-wsl-instead (*), ansible-lint (>=6.9.0,<7.0.0) requires will-not-work-on-windows-try-from-wsl-instead (*).
So, because no versions of will-not-work-on-windows-try-from-wsl-instead match *
 and project depends on ansible-lint (>=6.9.0,<7.0.0), version solving failed.
@KamilaBorowska KamilaBorowska added bug new Triage required labels Nov 24, 2022
@ssbarnea
Copy link
Member

ssbarnea commented Nov 24, 2022

Sorry but this is a bug belonging poetry, not ansible-lint. Our dependencies are declared like this on purpose.

See https://github.com/ansible/ansible-lint/blob/main/setup.cfg#L74

PS. You might want to see why others dislike poetry

@ssbarnea ssbarnea closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
@ssbarnea ssbarnea removed the new Triage required label Nov 24, 2022
@finswimmer
Copy link

Hello @ssbarnea,

unfortunately defining a non-existing dependency for a specific platform is problematic in multiple cases:

  • Any tool that is doing a universal locking like Poetry or PDM will raise an error because it cannot find this dependency. Universal locking means, that the dependency resolution is done independently of the current platform and Python version, by only looking at the constraints. Thus the lock file can be used with any Python version that the project aims to be compatible.
  • Someone can register this non-existing dependency and suddenly this is pulled into the environment. That's a potential security issue.

The hint in the documentation about the fact, that ansible-lint cannot be installed on Windows, should be sufficient. Maybe put it into the README of this repo as well?

Best regards,
fin swimmer

@KamilaBorowska
Copy link
Contributor Author

KamilaBorowska commented Nov 29, 2022

For reference to anyone who finds this ticket, this issue can be workarounded by using markers:

ansible-lint = { version = "^6.9.0", markers = "platform_system != 'Windows'" }

@ssbarnea
Copy link
Member

ssbarnea commented Dec 8, 2022

@finswimmer pip-tools compile does not suffer from the same limitations, we use it without problems. You cannot expect that all the dependencies to be always available and I am sure that there are other packages on pypi with similar issues.

I also doubt poetry looks at trove metadata lists only POSIX and not Windows as a supported platform. That is a poetry implementation bug that it fails to evaluate the condition before starts looking for the dependency. I supposed it would also fail if the marker is True is False.

@xfix Thanks for providing a workaround. Feel free to make a PR to add a section for poetry in installation section, so others might find your valuable workaround.

@KamilaBorowska
Copy link
Contributor Author

My personal opinion is that ansible-lint abuses the requirements system, and this work-around is non-ideal because it would break if ansible-lint were to add a similar hack for some other platform.

@gtirloni
Copy link

@xfix thanks for the workaround. I hope ansible-lint re-thinks this.

@ansible ansible locked and limited conversation to collaborators Dec 14, 2022
@ssbarnea ssbarnea converted this issue into discussion #2820 Dec 14, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

4 participants