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

add pipx plugin #28

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions plugins/pipx/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "pipx",
"version": "0.1.0",
"description": "Installs Pipx and makes it available",
"packages": ["pipx@latest"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be our first plugin that includes a package, up until a few months ago devbox plugins only supported config.

I think this is a good use case for bundling a package in a plugin, but just keep an eye out for surprising behaviour - i.e. I'm not sure how the version of pipx is set and updated.

Copy link
Contributor Author

@admackin admackin Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good call. I think it might make sense to at least pin to a pipx version so that it's repeatable (my guess would be otherwise this is resolved at the app level meaning you could run it twice with different results as it stands although presumably the app's devbox.lock would make it a little more repeatable at least)

"env": {
"PIPX_HOME": "{{ .Virtenv }}",
"PIPX_BIN_DIR": "{{ .Virtenv }}/bin"
},
"shell": {
"init_hook": [
"export PATH=\"{{ .Virtenv }}/bin:$PATH\""
]
}
Comment on lines +8 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion]: you can update the path without an init_hook

Suggested change
"PIPX_BIN_DIR": "{{ .Virtenv }}/bin"
},
"shell": {
"init_hook": [
"export PATH=\"{{ .Virtenv }}/bin:$PATH\""
]
}
"PIPX_BIN_DIR": "{{ .Virtenv }}/bin",
"PATH": "{{ .Virtenv }}/bin:$PATH"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I already tried this – you can see that I changed it here when pulling out the local versions of the plugins. This was presumably because something didn't work with setting in the path directly (but this is what I was doing before using plugins). I can't remember what didn't work though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jay-aye-see-kay ☝️ I just checked, and I can confirm that it doesn't get added to path by direct manipulation when the app's devbox.json (or maybe another plugin?) also manipulates $PATH – it seems the app one takes precedence, rather than both being run.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh gross, I hadn't seen that issue before - IMO that's a bug in devbox, I'll make some time this week to raise that with them. That's likely an issue for some of the built in plugins, i.e. the ruby plugin uses this approach https://github.com/jetify-com/devbox/blob/main/plugins/ruby.json

Let's leave it as is, it works and there's no downside the the init_hook approach (aside from being a little verbose).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug report here: jetify-com/devbox#2138

}
Loading