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

25.1.0: generate completion files without installed keyring now fails #675

Open
kloczek opened this issue Apr 6, 2024 · 2 comments
Open

Comments

@kloczek
Copy link

kloczek commented Apr 6, 2024

Describe the bug
Up to now as possible to generate completion files without installing keyring after build by

for sh in bash zsh; do
        PYTHONPATH=$PWD/build/lib \
        python3 -m keyring --print-completion ${sh} > keyring.${sh}
done

Now above fails with

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILD/keyring-25.1.0/build/lib
+ /usr/bin/python3 -m keyring --print-completion bash
Install keyring[completion] for completion support.

It was especially useful on packaging.

BTW: Currently code generating those completion files is part od the installed by modules files.
If it not would be better to remove that code and maintain just static completion files? 🤔

@jaraco
Copy link
Owner

jaraco commented Apr 7, 2024

In #671 - and the 25.0.1 release (and subsequent 25.1.10 release), keyring was enhanced to return a non-zero exit status if completion generation was failing. It has always required the [completion] extra. Prior to 25.0.1, if you'd executed that command but the requisite dependencies weren't present, you'd get the error message in your keyring.{sh} file (and you probably were). It's probably the case that when the completion was run before, shtab happened to be installed, but along the way, shtab was removed causing the generation to fail quietly.

You should make sure that the dependencies declared in the completion extra are present (currently shtab).

BTW: Currently code generating those completion files is part od the installed by modules files.
If it not would be better to remove that code and maintain just static completion files? 🤔

I'm not sure the best practice here. I'd like for the completion files to be derived from the implementation, as the --print-completion tool generates. I'd like to avoid creating a manual process that could cause the completion files to become out of sync with the implementation. I'd also be a little reluctant to add another build step to the keyring build process, mainly because I'm not aware of any good way to have Python generate artifacts during the build, though I wouldn't be opposed to some build-time generation in theory.

@kloczek
Copy link
Author

kloczek commented Apr 8, 2024

I'm not sure the best practice here. I'd like for the completion files to be derived from the implementation, as the --print-completion tool generates. I'd like to avoid creating a manual process that could cause the completion files to become out of sync with the implementation. I'd also be a little reluctant to add another build step to the keyring build process, mainly because I'm not aware of any good way to have Python generate artifacts during the build, though I wouldn't be opposed to some build-time generation in theory.

Generally speaking I'm not against generate completion files however IMO those files/scripts used to generate completion files should not be installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants