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

Enable using custom esbonio python package #924

Open
AlexanderLanin opened this issue Nov 16, 2024 · 3 comments
Open

Enable using custom esbonio python package #924

AlexanderLanin opened this issue Nov 16, 2024 · 3 comments
Labels
enhancement New feature or request ide:vscode Issues that relate to the Esbonio vscode extension
Milestone

Comments

@AlexanderLanin
Copy link
Contributor

What would you like to see

I'm not sure if an option is missing or simply not documented. What I would usually want to do (unfortunately) is debug into the python part of esbonio. Not all of esbonio. I don't know TypeScript, I don't know how extensions in VS Code work. Just the python part...

However, as far as I can tell the VS Code extension will always use the bundled python module for the server.
The server loads sphinx_agent also from the bundled python module (which I don't quite understand since bundled is appended, I thought it would prefer the one from the python environment).

So what seems to be missing is a config option like use_host_esbonio_python_package, use_bundled_esbonio_python_package or some sort of custom_esbonio_python_package.

@AlexanderLanin AlexanderLanin added enhancement New feature or request triage Issues needing triage labels Nov 16, 2024
@alcarney alcarney added ide:vscode Issues that relate to the Esbonio vscode extension and removed triage Issues needing triage labels Nov 16, 2024
@alcarney alcarney added this to Esbonio Nov 16, 2024
@github-project-automation github-project-automation bot moved this to Todo in Esbonio Nov 16, 2024
@alcarney alcarney added this to the 1.0 milestone Nov 16, 2024
@alcarney
Copy link
Member

The server loads sphinx_agent also from the bundled python module (which I don't quite understand since bundled is appended, I thought it would prefer the one from the python environment).

The design of the 1.0 version of esbonio is meant to remove the need to install it into every environment you wish to use it with. Instead you can install it once and can use it across all of your projects - which is much closer to how other language servers work.

When launching a Sphinx subprocess esbonio will manipulate the PYTHONPATH environment variable to inject the sphinx_agent module into the target environment. By making it so that the bundled sphinx_agent is always used, there's no risk that the server side code and the sphinx side code fall out of sync with each other.

What I would usually want to do (unfortunately) is debug into the python part of esbonio. Not all of esbonio.

From an end user point of view, I think having the extension always use the bundled version of esbonio simplifies things. However, I think for your use case I think it definitely makes sense to have a developer option where you can point the extension at a different version of the package.

@AlexanderLanin
Copy link
Contributor Author

In the meantime I figured out I can modify /home/alex/.vscode-server/extensions/swyddfa.esbonio-0.96.0/bundled/libs/esbonio/. That's actually sufficient for me at the moment.

But this option would still make sense for folks wanting to create PRs. It's just easier when you can point it to e.g. your editable pip esbonio installation.

@alcarney
Copy link
Member

I haven't got around to documenting this yet, but another option might be to clone this repo and run

$ cd code/
$ make install

It will build the extension in such a way you can install it as a local workspace extension and it will use the version of esbonio from the lib/esbonio folder.

$ ls -l .vscode/extensions/esbonio/bundled/libs/
...
lrwxrwxrwx@    - alex 21 Oct 20:23 esbonio -> /workspaces/develop/code/../lib/esbonio/esbonio
...

Then by enabling the esbonio.server.debug option, it should be possible to debug the server process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ide:vscode Issues that relate to the Esbonio vscode extension
Projects
Status: Todo
Development

No branches or pull requests

2 participants