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

Integrate pet-mode and remove other venv management packages #16867

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

smile13241324
Copy link
Collaborator

@smile13241324 smile13241324 commented Mar 6, 2025

This PR tries to integrate pet-mode to detect and setup python virtual environments.

I have tried to remove alternative venv management packages as well. However I am unsure if this has broken someones setup, so some testing is in order :).

Should fix #16855 and #16841.

@smile13241324
Copy link
Collaborator Author

@sunlin7 @RaghuNaik @fnussbaum @bcc32 care to review?

@bcc32
Copy link
Collaborator

bcc32 commented Mar 6, 2025

My site definitely uses pyvenv directly (we have both Spacemacs and non-Spacemacs users), so I would be sad to see this suddenly removed without a good migration path. Is pet-mode a drop-in replacement? Can it be programmatically configured?

@sunlin7
Copy link
Contributor

sunlin7 commented Mar 6, 2025

@smile13241324 Thanks for the PR, I test it on my local and some feedback here:

  1. the pet-mode dose not auto start with the python-base-mode, should move the :config to :init for pet package?
  2. the pet-mode dose not select the ipython3 if there are both python3 and ipython3 exists, it select python3 (pet-mode issue)
  3. I found a lot of vfork attemptions from pet-mode by linux strace tool. (pet-mode issue)

@smile13241324
Copy link
Collaborator Author

Looks like this is not ready to be merged.
@bcc32 the idea of pet is that it detects active venv environments automatically and setups all packages accordingly. I have had hoped this would turn into a drop in replacement for our own venv detection and setup code. Would this replace venv's functionality for you? If not I can add them back and add pet mode behind a setting to make it opt in instead.

@sunlin7 thanks for testing, I will fix the setup and will have a look at the pet package to fix the bugs you have found.

I'll put this branch to draft state until it is in a better state.

@smile13241324 smile13241324 self-assigned this Mar 8, 2025
@smile13241324 smile13241324 changed the title Integrate pet-mode and remove other venv management packages Draft: Integrate pet-mode and remove other venv management packages Mar 8, 2025
@smile13241324 smile13241324 changed the title Draft: Integrate pet-mode and remove other venv management packages Integrate pet-mode and remove other venv management packages Mar 8, 2025
@bcc32
Copy link
Collaborator

bcc32 commented Mar 8, 2025

@smile13241324 thanks for taking a look at this. For context, my site uses pyvenv with a default, hard-coded environment for most users (distributed via NFS or similar), and also some users require the ability to manually set the environment to something specific depending on their team or deployment environment (however, we use a monorepo and therefore having the virtualenv path for all parts of the tree be determined by a single file in the project would not be viable).

I took a brief look at pet-mode and it seems it might be able to support this, but maybe not in an especially obvious way (it seems designed to be zero-configuration and doesn't have any interactive commands to support changing the virtual environment).

I will consult with some users when I'm back at work on Monday. I am hopeful this will not be a problem, and in the "worst case" we can obviously just still use the pyvenv package and maintain our own key bindings internally if needed, so you don't need to consider this concern a hard blocker for the PR.

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

Successfully merging this pull request may close these issues.

using uv package / virtual environment manager with Python layer
3 participants