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
[WIP] Python language server provider #31180
Conversation
I've cleaned up the PR. I think it's ready with the exception of python-language-server which requires even more new packages. I've thus disabled the tests. I've tested the language server which works fine. |
Sorry I had pushed the clean version to the wrong branch. Fixed now. |
my only concern is how I dealt with configparser (which is an external library in python 2 but in the batteries for python3) but when testing locally, it seemed ok and tests pass. So I marked it ready. |
bump ? |
rebased |
@GrahamcOfBorg build python-language-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failure for system: x86_64-linux
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7ffff0dfaf28>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/snowballstemmer/
Could not find a version that satisfies the requirement snowballstemmer (from pydocstyle==2.1.1) (from versions: )
No matching distribution found for snowballstemmer (from pydocstyle==2.1.1)
python installed: The directory '/homeless-shelter/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
___________________________________ summary ____________________________________
ERROR: python: InvocationError: /tmp/nix-build-pydocstyle-2.1.1.drv-0/pydocstyle-2.1.1/.tox/python/bin/pip install /tmp/nix-build-pydocstyle-2.1.1.drv-0/pydocstyle-2.1.1/.tox/dist/pydocstyle-2.1.1.zip (see /tmp/nix-build-pydocstyle-2.1.1.drv-0/pydocstyle-2.1.1/.tox/python/log/python-1.log)
builder for ‘/nix/store/6add2im972kc596r4f01bsya6ml7kixz-pydocstyle-2.1.1.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/9hf7aql4rwxjjdi7pfp7414j7kzl9jd8-python-language-server-0.10.0.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/9hf7aql4rwxjjdi7pfp7414j7kzl9jd8-python-language-server-0.10.0.drv’ failed
Not sure if it's a temporary (DNS) failure ? What GrahamcOfBorg does that the CI doesn't ? |
Please test with sandboxing enabled. There are some dependencies missing which pip will try to fetch via network. We generally don't want that in our packages and if it is really necessary, the expression should be a fixed-output derivation. Shouldn't be needed in this case, though. |
Thanks for the help !
Now I pushed the result but the CI has "Failed to enumerate outputs of master" which I don't know how to fix. |
rebased. (Don't think it will succeed but @GrahamcOfBorg build python-language-server) |
thanks for the review, I fixed the commit message too so that it reflects the 0.13 version. |
bumped language server to 0.15. Should be ready. |
sha256 = "1al97fc27fjnd7h6wvx0kk0lr3iygbqwmb1fsx81252sqgw1knxl"; | ||
}; | ||
|
||
postPatch = stdenv.lib.optionalString (!pythonOlder "3.0") '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed since python3Packages.callPackage
is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LanguageServerProtocol says "A Python 2.7 and 3.4+ implementation of the Language Server Protocol." so some people might want to use it with python2. So even if it is an application. maybe I should implement it as a python-module ?
pyflakes | ||
pluggy | ||
rope | ||
] ++ stdenv.lib.optionals (pythonOlder "3.0") [ configparser ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
rope | ||
] ++ stdenv.lib.optionals (pythonOlder "3.0") [ configparser ]; | ||
|
||
# Enabling tests require porting these extra packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which packages now?
I updated the commit message to reflect the bump to 15 (forgotten) and moved the program to python packages so that one can install the server for python2 and 3. I also fixed the tests that were not running and doing so realized a problem with upstream archive I notified here palantir/python-language-server#269 |
Provides a server implementing the LSP (Language Server Protocol) to provide editors with IDE-like capabilities. See https://langserver.org/
bumping LSP to 0.18. HAve a problem with some tests not being imported, README https://github.com/palantir/python-language-server/tree/0.18.0 says to run |
see #41061 instead |
Motivation for this change
LSP (Language Service Protocol) is the current big thing in IDEs https://langserver.org/ .
You can try on vim with for instance https://github.com/autozimu/LanguageClient-neovim .
This should work (the pyls binary is made available) but needs some cleaning.
I have a few other PRs I would like to clean first so feel free to takeover. I opened the PR to prevent duplicate work.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)