Open wimglenn opened 1 month ago
We have renamed this and changed it to a feature request, as it is not something currently possible with ansible-lint.
@alisonlhart I am confused by the rename / change to a feature request.
Distributing rules as Python packages is already possible, and it is even officially documented at Creating Custom Rules for Ansible Lint, section Packaging Custom Rules. I am using custom rules packages in production already. It's only editable installations which aren’t discovered, and that is clearly a bug. Could you undo this change, or explain what I'm missing here?
@wimglenn You are right, misssed https://www.ansible.com/blog/creating-custom-rules-for-ansible-lint/ as is not part of upstream docs. In fact the way is documented is not really what I would do these days. Instead I would fully switch to pluggy instead and deprecated the old method. This should sort the problem of editable and many other problems.
Thank you @ssbarnea, that makes more sense. I agree that a switch to pluggy would be a good idea here.
When developing a custom lint rule as described in Packaging Custom Rules, the lint is not available if installed with
pip install -e ./my-custom-lint
. The same lint is available (and appears inansible-lint --list-rules
) when doingpip install ./my-custom-lint
.I'm using setuptools and the editable installation mode is the thing with an
__editable__
.pth file in site-packages which installs a meta-path finder. Trying all modes with--config-settings editable_mode=compat
,--config-settings editable_mode=strict
,--config-settings editable_mode=lenient
, none of them works.Maybe relevant: unlike the "normal" install, an editable install doesn't create files under
.../site-packages/ansiblelint/rules/custom/
. I didn't check how ansible-lint discovers custom rules, but perhaps an entry-point group would be worth considering.