[Top][All Lists]

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

Re: How to use project.el

From: excalamus
Subject: Re: How to use project.el
Date: Tue, 24 Nov 2020 04:54:17 +0100 (CET)

23 nov. 2020 à 17:19 de

> On 23.11.2020 18:22, excalamus--- via Users list for the GNU Emacs text 
> editor wrote:
>> 21 nov. 2020 à 21:55 de
>>>  For instance, if you are working on a Python project, shouldn't there be 
>>> some file in the project root directory which will indicate which 
>>> virtualenv to use?
>> Maybe? I've never heard of such a file being used with the venv module or 
>> conda environments.
> OK, I'm not well-versed in Python ecosystem
I sadly am (it's my day job). "Should" is a dangerous assumption for Python. As 
far as I'm aware there's no unit of project nor standard way to indicate which 
environment to use or what packages are in that environment. Some people put a 
bajillion packages into a giant catch all environment to "reduce duplication", 
others have a 1:1 project to virtual environment relationship. 
In practice, a project and virtual environment are separate, although each are 
determined by a directory (maybe the virtual environment is a subdirectory of 
the project directory; maybe virtual environments are all co-located in a 
separate envs/ directory). The user has to remember which virtual environment 
to activate and where that environment is located.

The virtual environment is activated by running some script which sets 
environment variables for the current shell instance. 
> I think the general idea could be implemented in Emacs Lisp: you call 
> (project-root (project-current)) and see if there is a file with a 
> predetermined name inside that root. That file could point to a specific 
> virtualenv which you would then switch to.
I could create my own project indicator file, I suppose.  I'm not sure how that 
would help.  But I'm getting (myself) lost. I may be stuck in my own pattern of 
solving things. What problem are we trying to solve here?

My project workflow is:
1. Create a shell2. Activate a virtual environment
3. Assign some commonly used commands based on the project (e.g. run this entry 
point, build according to this spec, etc.)
The trouble is managing several of these simultaneously (e.g. "Hey can you 
quickly fix this thing in this other project?") while maintaining the state of 

reply via email to

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