Frappe-Manager icon indicating copy to clipboard operation
Frappe-Manager copied to clipboard

[Question] Development setup for other editor than code

Open hffmnn opened this issue 2 months ago • 4 comments

Hi,

I would like to use another editor than code, potentially one that can't connect to a container. Is there any info. what needs to be set? I guess something like the python path? And is there some documentation about what the code command actually does to maybe adapt it to some other editor?

Thanks

hffmnn avatar Oct 10 '25 13:10 hffmnn

Hi,

I personally use Emacs. The main idea is to create a Python virtual environment (venv) that contains all the required dependencies, and then configure your editor or LSP to use the Python interpreter from that venv.

For example, in Emacs I point my LSP, linters, and formatters to the venv/bin/python path, and everything works seamlessly without needing to connect to a container.

The only real limitation you’ll face with this approach is debugging — since the debugger usually expects to run inside the same environment as the application (e.g. the container), it might not work properly unless you replicate that setup locally or attach remotely. You can also run a VS Code instance as primarily debugger while still your my main editor to edit files, which gives me the best of both worlds.

So yes, as long as your editor is using the same Python path as the containerized environment, things should work fine for editing, linting, and type checking. Debugging just needs a bit of extra setup.

Xieyt avatar Oct 11 '25 08:10 Xieyt

Hi @Xieyt and thanks a lot for your reply.

To recap: lets say I created a site via Frappe-Manager and added my custom app I want to develop a new feature for. Then I do a cd ~/frappe/sites/<site>workspace/frappe-bench/apps/<app-name> Or is it in the subfolder of a typical frappe app layout cd ~/frappe/sites/<site>workspace/frappe-bench/apps/<app-name>/<app_name>. In there I would add a new python virtual environment (e.g. via uv venv --python 3.11 venv) and then... i have a question: how to install the dependencies without bench? And how to add frappe or e.g. erpnext dependencies that usually get provided by the bench?

If I managed to install the dependencies, I then would point my editors python interpreter to the newly created venv?

hffmnn avatar Oct 11 '25 11:10 hffmnn

Let’s say you’re developing a custom app named app-name.
On your host machine, it will be located at: ~/frappe/sites/<benchname>/workspace/frappe-bench/apps/app-name

Steps to set up the virtual environment

cd ~/frappe/sites/<benchname>/workspace/frappe-bench/apps/app-name

# Create a virtual environment using uv
uv venv

# Install app-name in editable mode
uv venv pip install -U -e .

# Install frappe in editable mode
uv venv pip install -U -e ../frappe

# Install erpnext in editable mode
uv venv pip install -U -e ../erpnext

# (Optional) Install any other required apps
uv venv pip install -U -e ../<other-app>

Once everything is installed,you can use the Python executable from your virtual environment in your editor.

Xieyt avatar Oct 12 '25 09:10 Xieyt

@Xieyt Thanks a lot! That was exactly what I needed! 👍

hffmnn avatar Oct 20 '25 10:10 hffmnn