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

Hide banner message from python plugin #1823

Closed
kadaan opened this issue Feb 21, 2024 · 7 comments · May be fixed by #1830
Closed

Hide banner message from python plugin #1823

kadaan opened this issue Feb 21, 2024 · 7 comments · May be fixed by #1830
Labels
feature New feature or request

Comments

@kadaan
Copy link
Contributor

kadaan commented Feb 21, 2024

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.

@gcurtis
Copy link
Collaborator

gcurtis commented Feb 27, 2024

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 .devbox directory of messages we've already shown.
  • Detect a DEVBOX_NO_HINTS environment variable (similar to brew's HOMEBREW_NO_ENV_HINTS) that suppresses plugin hints globally.
  • Now that devbox.json allows 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?

@gcurtis gcurtis removed the triage Issue needs triage label Feb 27, 2024
@kadaan
Copy link
Contributor Author

kadaan commented Feb 27, 2024

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.

@Lagoja
Copy link
Contributor

Lagoja commented Feb 28, 2024

@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?

@kadaan
Copy link
Contributor Author

kadaan commented Feb 28, 2024

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.

@JtMotoX
Copy link

JtMotoX commented Apr 1, 2024

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.

@glennpratt
Copy link

I'd prefer the banner not be used, you can show notes on first install / add, that's enough.

@Lagoja
Copy link
Contributor

Lagoja commented May 31, 2024

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.

@Lagoja Lagoja closed this as completed May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Development

Successfully merging a pull request may close this issue.

5 participants