emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eglot, project.el, and python virtual environments


From: North Year
Subject: Re: Eglot, project.el, and python virtual environments
Date: Thu, 17 Nov 2022 01:47:08 -0500
User-agent: mu4e 1.8.10; emacs 28.2

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Hi,
>
> Here’s another issue that’s technically a emacs.help question, but might
> result in some code/documentation updates, so I’m sending it here.
>
> My main day-job code base is an AWS CloudFormation monstrosity involving
> several Python Lambdas, among other things. Basic project structure
> looks like:
>
> project_root
> ├── .git
> ├── src
> │   └── python
> │       ├── VeryImportantLambda
> │       │   └── .venv
> │       ├── MoreImportance
> │       │   └── .venv
> │       ├── RunInCaseOfEmergency
> │       │   └── .venv
>
> I’m using the python-lsp-server python package in each Python
> subdirectory, and the key is that each of those directories is a virtual
> environment that needs to stay isolated from the others. Each has
> different packages installed, and in some cases even the Python versions
> are different (though I’m trying to get rid of that).

Maybe I have a silly solution,

Since you are using .git, then maybe you can create a .hg, .svn,
or what ever CVS tools other than svn,
in VeryImportantLambda folder, MoreImportance folder, and RunInCaseOfEmergency 
folder.

Then when you visit files in VeryImportantLambda folder,
then project.el will set the project root at VeryImportantLambda,
I think everything would just be fine there.
As long as you don’t launch eglot python lsp in the “actual” project (which is 
.git),
which for example is project_root/src/python/main.py
then everything should be fine.

Just have a try
where test is a .git folder and test/test2 and test/test3 are two .hg folder,
then eglot will launch two lsps at test2 and test3 folder.

You can just add .hg to your .gitignore and magit can used as usual with no 
pain.

This is a really stupid but I think with not too much effort try.

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[eglot] Connected! Server `EGLOT (test3/python-mode)’ now managing 
`python-mode’ buffers in project `test3’.
[eglot] (warning) Server tried to register unsupported capability 
`workspace/didChangeWorkspaceFolders’
Wrote /Users/me/Downloads/test/test3/cat.py
“test3/cat.py” 1L, 23C written
dog.py has auto save data; consider M-x recover-this-file
[eglot] Connected! Server `EGLOT (test2/python-mode)’ now managing 
`python-mode’ buffers in project `test2’.
[eglot] (warning) Server tried to register unsupported capability 
`workspace/didChangeWorkspaceFolders’
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

reply via email to

[Prev in Thread] Current Thread [Next in Thread]