-
Notifications
You must be signed in to change notification settings - Fork 872
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
keep can't init when howdoi is installed via pipx #425
Comments
whyThis happens because bad workaroundexposes $ pipx install --include-deps howdoi
$ pipx list
# ...
package howdoi 2.0.18, Python 3.9.7
- howdoi
- keep
- normalizer
- pygmentize better workaroundonly adds keep $ pipx install howdoi
$ pipx inject howdoi keep --include-apps
$ pipx list
# ...
package howdoi 2.0.18, Python 3.9.7
- howdoi
- keep |
Hmm - I had not tried an install with |
I think there are a couple of ways to resolve this:
I lean toward (3). Staying inside of the python interpreter is more predictable than issuing commands to an unknown shell- not to mention the security implications/greater attack surface such calls create. I tried invoking keep's init cmd from within howdoi, but for some reason this didn't work (maybe something to do with click, I'm not super familiar). We could do the check for the keep directory ourselves but, unfortunately, the ~/.keep directory is hard-coded everywhere in keeps src code (not to mention polluting users' home directories, being unconfigurable, ignoring XDG). so, if we do check for and create the path, our implementation would break if keep ever changes the path. thoughts? |
Same problem when howdoi is installed via Homebrew. |
I'm surprised to see that homebrew has been keeping their howdoi package up to date. If we fix this issue then I could add homebrew (and pipx) as a supported method of installation. I'd be happy to accept a pull request to fix this. I'd also like to understand the core issue a bit better. Going by @justin-f-perez's original submission, I see the output:
This suggests that keep does indeed get installed, but some internal workings of keep are broken when installed via Looking at the keep repo, I see that the howdoi attempts to call So:
|
attempt to make `keep` an extra to put it on the PATH when installing via pipx/homebrew related: gleitz#425
Hi meant to respond sooner, been slammed
yes, but it's not so much that any 'internal workings' are broken as it is the command simply cannot be found by the shell because it's not in any directory in the
This is also correct. Additionally, note that:
The preferred method, for security reasons, when calling system commands where an exception should be raised on a non-zero exit code, and which don't require the shell (as would be the case here if subprocess.check_output(['keep', 'init'], shell=False) To keep, keep, or not to keep, keep?
I recall having similar questions/thoughts when I examined the source. It didn't appear that the author had designed it in a way that was very flexible or re-usable. I believe also that the path to the Furthermore, in https://github.com/OrkoHunter/keep/blob/master/keep/utils.py#L53-L63 ... why sleep? It looks to me like a poor attempt at pretending to do work and adds an extra 1 second to initialization- not a huge deal for end users, but it means every unit test that needs to exercise OK, done ranting. Just pointing out (for future design consideration) that keep should be treated with a little bit of caution (i.e., should design howdoi in such a way that swapping out keep if things go sideways in the future won't be too painful). Additionally, it might be a good idea to pin a specific version. If Getting back on track- er, I mean PATHYou might be able to put keep on the path by making it an "extra" with a |
Thanks for this! I think we may be able to bring some of these issues up with keep. A basic init function without a sleep would be a great start. |
What happened:
What you expected to happen:
The command to be saved without error
Output with
--explain
N/A
The text was updated successfully, but these errors were encountered: