devbox
devbox copied to clipboard
Hide banner message from python plugin
What problem are you trying to solve?
The python plugin logs a banner message no matter what.. https://github.com/jetpack-io/devbox/blob/7f1633f6834f8772d31b06588c637b8f12cbe7c7/plugins/pip/venvShellHook.sh#L8
If you use the shell init_hook to enter the virtual env it would be nice to suppress this message. This is especially important when scripts are execute via devbox run ..., because the message ends up just being cruft.
What solution would you like?
Create a environment variable set automatically by devbox: DEVBOX_ENTRYPOINT=run:<script_name> or DEVBOX_ENTRYPOINT=shell.
Then the python plugin could not print the banner if DEVBOX_ENTRYPOINT=run:*. This would solve the run case.
Optionally, change the python plugin to not log the banner if a specific environment variable is present (ie. DEVBOX_PLYTHON_PLUGIN_HIDE_BANNER
Alternatives you've considered
Writing a wrapper around devbox would be another way to solve this, but that seems like more maintenance in the long run.
I agree this is an annoying message. I'm not sure about adding a DEVBOX_ENTRYPOINT environment variable, but we could add a more general version of DEVBOX_PLYTHON_PLUGIN_HIDE_BANNER.
A few ideas:
- Only show the message once. We could achieve this by saving a list in the
.devboxdirectory of messages we've already shown. - Detect a
DEVBOX_NO_HINTSenvironment variable (similar to brew'sHOMEBREW_NO_ENV_HINTS) that suppresses plugin hints globally. - Now that
devbox.jsonallows comments, we could add the message as a comment above packages that trigger plugins. This might be annoying if it messes up strict JSON syntax highlighting in editors though.
@Lagoja @mikeland73 any thoughts on this?
Mind explaining the issue with allowing the plunging to know the entrypoint to them being called? Seems like a useful and generic way of solving the problem that could enable other scenarios.
@gcurtis For this message in particular, maybe we move it into the plugin README and out of the script itself. The README would show when you install Python, but not on subsequent runs?
I feel like you want to see the message if you are not already in the virtual env. I would prefer that there was a way to let the banner be logged after the unit hook ran. That way people could configure the unit hook to enter the virtual env and then the banner could be suppressed. In the case where you enter a shell, and the virtual environment is not active, the banner is useful. I still feel that being able to suppress logging during script runs could be very useful and generic.
The youtuber DevOps Toolkit just released an Unleash Devbox video so decided to try it out and this is the 1st issue/annoyance that I am running into with devbox. Would be great to suppress this so I don't have to see this when I cd (direnv) into each of my project directories every time.
I'd prefer the banner not be used, you can show notes on first install / add, that's enough.
Banner has been moved out of shell, and will only show the first time that the Virtualenv is setup. This should be ~once per project.