It's not possible to install ansible-lint 6.9.0 using poetry #2820
-
SummaryInstalling ansible-lint using Issue Type
STEPS TO REPRODUCECreate a new project with Desired Behavior
Actual Behavior
|
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 9 replies
-
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 |
Beta Was this translation helpful? Give feedback.
-
Hello @ssbarnea, unfortunately defining a non-existing dependency for a specific platform is problematic in multiple cases:
The hint in the documentation about the fact, that Best regards, |
Beta Was this translation helpful? Give feedback.
-
For reference to anyone who finds this ticket, this issue can be workarounded by using ansible-lint = { version = "^6.9.0", markers = "platform_system != 'Windows'" } |
Beta Was this translation helpful? Give feedback.
-
@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 @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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
@xfix thanks for the workaround. I hope ansible-lint re-thinks this. |
Beta Was this translation helpful? Give feedback.
-
Agree that Poetry is widely used, and I usually keep even my Ansible environments managed by Poetry, so not having |
Beta Was this translation helpful? Give feedback.
-
Following the setup tools specific configuration in the guide. And doing the two following changes: diff --git a/.config/requirements.in b/.config/requirements.in
index 94585501..5e3b3150 100644
--- a/.config/requirements.in
+++ b/.config/requirements.in
@@ -1,5 +1,4 @@
# Special order section for helping pip:
-will-not-work-on-windows-try-from-wsl-instead; platform_system=='Windows'
ansible-core>=2.12.0,<2.14.0; python_version<'3.9' # GPLv3
ansible-core>=2.12.0; python_version>='3.9' # GPLv3
ansible-compat>=2.2.7 # GPLv3
diff --git a/pyproject.toml b/pyproject.toml
index 7e250c2f..41edf4a3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -210,3 +210,8 @@ dependencies = { file = [".config/requirements.in"] }
[tool.setuptools_scm]
local_scheme = "no-local-version"
write_to = "src/ansiblelint/_version.py"
+
+[tool.setuptools]
+platforms = [
+ "posix",
+] Allows the install to proceed in a modern dependency management tool like
or adding it manually [tool.pdm]
[tool.pdm.dev-dependencies]
dev = [
# "ansible-lint>=6.0.0",
"-e file:///home/****/ansible-lint#egg=ansible-lint",
] and doing $ pdm update
🔒 Lock successful
Changes are written to pdm.lock.
Synchronizing working set with lock file: 0 to add, 2 to update, 0 to remove
✔ Update ansible-lint 6.10.3.dev0 -> 6.10.3.dev0 successful
... seems to work. The only question is if pip, poetry and pdm (and pip-tools, and pipenv) on windows sends an error message on install or update. |
Beta Was this translation helpful? Give feedback.
-
I find it slightly amusing that the error still occurs when on wsl2. But I'm in agreement with the idea that this is a bit of an abuse of the dependency system. I find that installing ansible itself with poetry does work - as the required files in 'bin' such as ansible-playbook aren't there. |
Beta Was this translation helpful? Give feedback.
-
I came across using pdm
dependencies = [
"ansible-lint>=24.2.0", # manually added
] then use pdm lock --strategy no_cross_platform ref: https://pdm-project.org/latest/usage/dependency/#cross-platform |
Beta Was this translation helpful? Give feedback.
For reference to anyone who finds this ticket, this issue can be workarounded by using
markers
: