Closed chriscroome closed 1 year ago
Unfortunately the DEB package I generate only includes the jc
binary compiled with pyoxidizer
. The DEB package maintained by the Debian/Ubuntu folks is using some special tooling that I'm not really up to speed on.
Here is some info on the current maintainer - he may have some ideas of how to create an up-to-date package that works with the Debian system python. http://deb.debian.org/debian/pool/main/j/jc/jc_1.22.4-1.dsc
I'm curious if there is a way to get the pipx
install method to work with Ansible. I guess it makes sense that Ansible running system python would not have visibility into another virtual python environment.
Is it possible to just remove that EXTERNALLY-MANAGED
file described in the PEP to allow installation via pip
?
Another option might be to pip
install Ansible, but that might be easier said than done. Sounds like this could affect other Ansible plugins, too, not just jc
.
FYI, orthogonal to this I have submitted a pull request with Ansible Community General to support plugin parsers for the JC Filter Plugin:
https://github.com/ansible-collections/community.general/pull/6043
Installing ansible
with pipx
and then injecting other packages into the same venv
seems to work, for example:
pipx install ansible
pipx inject ansible ansible-core jc jmespath
However it doesn't automatically add a symlink from a directory in the $PATH
, so that needs to be done manually, for example:
ln -s ~/.local/pipx/venvs/ansible/bin/jc ~/.local/bin/jc
Or you can use pip3
with the --break-system-packages
flag:
pip3 install --break-system-packages --user jc
I think it is fine doing this as a regular user as it'll just install things into ~/.local
, but when running as root
it does make sense to use pipx
, to make things available for all users you can set these two env vars first:
export PIPX_HOME=/opt/pipx
export PIPX_BIN_DIR=/usr/local/bin
pipx install jc
Nice finds! Maybe I'll add this to a Wiki page?
Was just thinking when Ansible community.general ships the latest version of the jc
filter plugin you will be able to update any broken parsers via jc
plugin parsers. This would not take new features into consideration, but normally new features are really cli-specific these days
The latest community.general update includes the jc filter plugin update that allows you to use jc parser plugins.
Would a jc
parser plugin for use by Ansible be installed the same way as Custom Parsers?
Yep, should be in the plugin directory as outlined above of the process owner that is running jc
.
On Debian Bookworm
pip
can no longer be used to install Python packages since the latest version, 23.0.1, includes support for PEP-668, the suggestion is to use pipx to install packages and while this is fine for thejc
command line it doesn't providejc
as a Python library and this is required when using the jc Ansible filter.So that leaves Debian Bookworm Ansible users stuck on the
jc
version Debian provides, currently 1.22.4, so I was wondering if there is any chance that the.deb
you are building @kellyjonbrazil could potentially be updated in the future so that it also providesjc
as a Python library, as the Debian packaged version does?I'm afraid that I'm not sure what exactly this would involve, however the files that the GitHub version installs:
Are clearly far fewer than the Debian version: