Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: palantir/python-language-server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.21.4
Choose a base ref
...
head repository: palantir/python-language-server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: develop
Choose a head ref
Loading
Showing with 3,498 additions and 564 deletions.
  1. +60 −0 .circleci/config.yml
  2. +44 −0 .github/workflows/release.yml
  3. +52 −0 .github/workflows/test-linux.yml
  4. +43 −0 .github/workflows/test-mac.yml
  5. +38 −0 .github/workflows/test-win.yml
  6. +3 −0 .gitignore
  7. +5 −2 .pylintrc
  8. +2 −0 MANIFEST.in
  9. +14 −8 README.rst
  10. +11 −0 RELEASE.md
  11. +0 −19 appveyor.yml
  12. +0 −14 circle.yml
  13. +5 −2 pyls/__init__.py
  14. +12 −4 pyls/__main__.py
  15. +110 −16 pyls/_utils.py
  16. +25 −11 pyls/config/config.py
  17. +7 −0 pyls/config/flake8_conf.py
  18. +1 −0 pyls/config/pycodestyle_conf.py
  19. +5 −17 pyls/config/source.py
  20. +11 −1 pyls/hookspecs.py
  21. +12 −0 pyls/lsp.py
  22. +15 −4 pyls/plugins/autopep8_format.py
  23. +23 −14 pyls/plugins/definition.py
  24. +169 −0 pyls/plugins/flake8_lint.py
  25. +203 −0 pyls/plugins/folding.py
  26. +4 −3 pyls/plugins/highlight.py
  27. +34 −6 pyls/plugins/hover.py
  28. +173 −47 pyls/plugins/jedi_completion.py
  29. +47 −0 pyls/plugins/jedi_rename.py
  30. +3 −3 pyls/plugins/mccabe_lint.py
  31. +4 −1 pyls/plugins/preload_imports.py
  32. +24 −3 pyls/plugins/pycodestyle_lint.py
  33. +1 −1 pyls/plugins/pydocstyle_lint.py
  34. +304 −0 pyls/plugins/pylint_lint.py
  35. +6 −5 pyls/plugins/references.py
  36. +27 −16 pyls/plugins/rope_rename.py
  37. +7 −2 pyls/plugins/signature.py
  38. +116 −53 pyls/plugins/symbols.py
  39. +1 −1 pyls/plugins/yapf_format.py
  40. +175 −39 pyls/python_ls.py
  41. +98 −20 pyls/workspace.py
  42. +1 −1 scripts/circle/pypi.sh
  43. +11 −0 setup.cfg
  44. +35 −17 setup.py
  45. +5 −0 test/__init__.py
  46. +36 −4 test/fixtures.py
  47. +33 −6 test/plugins/test_autopep8_format.py
  48. +304 −11 test/plugins/test_completion.py
  49. +8 −7 test/plugins/test_definitions.py
  50. +86 −0 test/plugins/test_flake8_lint.py
  51. +168 −0 test/plugins/test_folding.py
  52. +4 −4 test/plugins/test_highlight.py
  53. +44 −3 test/plugins/test_hover.py
  54. +77 −0 test/plugins/test_jedi_rename.py
  55. +6 −6 test/plugins/test_mccabe_lint.py
  56. +22 −12 test/plugins/test_pycodestyle_lint.py
  57. +8 −8 test/plugins/test_pydocstyle_lint.py
  58. +8 −8 test/plugins/test_pyflakes_lint.py
  59. +140 −0 test/plugins/test_pylint_lint.py
  60. +32 −15 test/plugins/test_references.py
  61. +44 −0 test/plugins/test_rope_rename.py
  62. +43 −4 test/plugins/test_signature.py
  63. +41 −16 test/plugins/test_symbols.py
  64. +17 −6 test/plugins/test_yapf_format.py
  65. +11 −11 test/test_document.py
  66. +36 −13 test/test_language_server.py
  67. +5 −0 test/test_utils.py
  68. +217 −3 test/test_workspace.py
  69. +0 −35 tox.ini
  70. +7 −8 vscode-client/README.md
  71. +58 −4 vscode-client/package.json
  72. +2 −1 vscode-client/src/extension.ts
  73. +95 −49 vscode-client/yarn.lock
60 changes: 60 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: 2

jobs:
python2-test:
docker:
- image: "python:2.7-stretch"
steps:
- checkout
- run: pip install -e .[all] .[test]
- run: py.test -v test/
- run: pylint pyls test
- run: pycodestyle pyls test
- run: pyflakes pyls test

python3-test:
docker:
- image: "python:3.6-stretch"
steps:
- checkout
# To test Jedi environments
- run: python3 -m venv /tmp/pyenv
- run: /tmp/pyenv/bin/python -m pip install loghub
- run: pip install -e .[all] .[test]
- run: py.test -v test/

lint:
docker:
- image: "python:2.7-stretch"
steps:
- checkout
- run: pip install -e .[all] .[test]
- run: pylint pyls test
- run: pycodestyle pyls test
- run: pyflakes pyls test

publish:
docker:
- image: "python:3.6-stretch"
steps:
- checkout
- run: ./scripts/circle/pypi.sh


workflows:
version: 2
build:
jobs:
- python2-test:
filters: { tags: { only: /.*/ } }
- python3-test:
filters: { tags: { only: /.*/ } }
- publish:
filters:
tags:
only: /[0-9]+(\.[0-9]+)+((-(beta|rc)[0-9]{1,2})(\.[0-9])?)?/
branches:
ignore: /.*/
requires:
- python2-test
- python3-test
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PyLS Release

on:
release:
types:
- created


jobs:
build:
name: Linux Py${{ matrix.PYTHON_VERSION }}
runs-on: ubuntu-latest
env:
CI: 'true'
OS: 'linux'
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.8']
timeout-minutes: 10
steps:
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION }}
architecture: 'x64'
- run: python -m pip install --upgrade pip setuptools wheel twine
- name: Build and publish python-language-server
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PYLS_TOKEN }}
run: |
python setup.py bdist_wheel --universal
python setup.py sdist
python -m twine check dist/*
python -m twine upload dist/*
52 changes: 52 additions & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Linux tests

on:
push:
branches:
- develop

pull_request:
branches:
- '*'

jobs:
build:
name: Linux Py${{ matrix.PYTHON_VERSION }}
runs-on: ubuntu-latest
env:
CI: 'true'
OS: 'linux'
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
timeout-minutes: 10
steps:
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION }}
architecture: 'x64'
- name: Create Jedi environment for testing
if: matrix.PYTHON_VERSION != '2.7'
run: |
python3 -m venv /tmp/pyenv
/tmp/pyenv/bin/python -m pip install loghub
- run: python -m pip install --upgrade pip setuptools
- run: pip install -e .[all,test]
- run: py.test -v test/
- name: Pylint checks
if: matrix.PYTHON_VERSION == '2.7'
run: pylint pyls test
- name: Code style checks
if: matrix.PYTHON_VERSION == '2.7'
run: pycodestyle pyls test
- name: Pyflakes checks
if: matrix.PYTHON_VERSION == '2.7'
run: pyflakes pyls test
43 changes: 43 additions & 0 deletions .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Mac tests

on:
push:
branches:
- develop

pull_request:
branches:
- '*'

jobs:
build:
name: Mac Py${{ matrix.PYTHON_VERSION }}
runs-on: macos-latest
env:
CI: 'true'
OS: 'macos'
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
timeout-minutes: 10
steps:
- uses: actions/cache@v1
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION }}
architecture: 'x64'
- name: Create Jedi environment for testing
if: matrix.PYTHON_VERSION != '2.7'
run: |
python3 -m venv /tmp/pyenv
/tmp/pyenv/bin/python -m pip install loghub
- run: python -m pip install --upgrade pip setuptools
- run: pip install -e .[all,test]
- run: py.test -v test/
38 changes: 38 additions & 0 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Windows tests

on:
push:
branches:
- develop

pull_request:
branches:
- '*'

jobs:
build:
name: Win Py${{ matrix.PYTHON_VERSION }}
runs-on: windows-latest
env:
CI: 'true'
OS: 'win'
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
timeout-minutes: 10
steps:
- uses: actions/cache@v1
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION }}
architecture: 'x64'
- run: python -m pip install --upgrade pip setuptools
- run: pip install -e .[all,test]
- run: py.test -v test/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -109,3 +109,6 @@ ENV/

# Merge orig files
*.orig

# Special files
.DS_Store
7 changes: 5 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -15,12 +15,15 @@ disable =
protected-access,
too-few-public-methods,
too-many-arguments,
too-many-instance-attributes
too-many-instance-attributes,
import-error

[REPORTS]

reports = no

[TYPECHECK]

generated-members = pyls_*
generated-members =
pyls_*
cache_clear
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -2,3 +2,5 @@ include README.rst
include versioneer.py
include pyls/_version.py
include LICENSE
include .pylintrc
recursive-include test *.py
22 changes: 14 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
Python Language Server
======================

.. image:: https://circleci.com/gh/palantir/python-language-server.svg?style=shield
:target: https://circleci.com/gh/palantir/python-language-server
.. image:: https://github.com/palantir/python-language-server/workflows/Linux%20tests/badge.svg
:target: https://github.com/palantir/python-language-server/actions?query=workflow%3A%22Linux+tests%22

.. image:: https://ci.appveyor.com/api/projects/status/mdacv6fnif7wonl0?svg=true
:target: https://ci.appveyor.com/project/gatesn/python-language-server
.. image:: https://github.com/palantir/python-language-server/workflows/Mac%20tests/badge.svg
:target: https://github.com/palantir/python-language-server/actions?query=workflow%3A%22Mac+tests%22

.. image:: https://github.com/palantir/python-language-server/workflows/Windows%20tests/badge.svg
:target: https://github.com/palantir/python-language-server/actions?query=workflow%3A%22Windows+tests%22

.. image:: https://img.shields.io/github/license/palantir/python-language-server.svg
:target: https://github.com/palantir/python-language-server/blob/master/LICENSE

A Python 2.7 and 3.4+ implementation of the `Language Server Protocol`_.
A Python 2.7 and 3.5+ implementation of the `Language Server Protocol`_.

Installation
------------
@@ -72,6 +75,10 @@ To enable pydocstyle for linting docstrings add the following setting in your LS
"pyls.plugins.pydocstyle.enabled": true
```

See `vscode-client/package.json`_ for the full set of supported configuration options.

.. _vscode-client/package.json: vscode-client/package.json

Language Server Features
------------------------

@@ -112,15 +119,14 @@ Development

To run the test suite:

``pip install .[test] && tox``
``pip install .[test] && pytest``

Develop against VS Code
=======================

The Python language server can be developed against a local instance of Visual Studio Code.

1. Install `VSCode for Mac <http://code.visualstudio.com/docs/?dv=osx>`_
2. From within VSCode View -> Command Palette, then type *shell* and run ``install 'code' command in PATH``
Install `VSCode <https://code.visualstudio.com/download>`_

.. code-block:: bash
11 changes: 11 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
To release a new version of the PyLS you need to follow these steps:

* Close the current milestone on Github

* git pull or git fetch/merge

* git tag -a X.X.X -m 'Release X.X.X'

* git push upstream --tags

* Publish release in our Github Releases page
19 changes: 0 additions & 19 deletions appveyor.yml

This file was deleted.

14 changes: 0 additions & 14 deletions circle.yml

This file was deleted.

7 changes: 5 additions & 2 deletions pyls/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Copyright 2017 Palantir Technologies, Inc.
import os
from future.standard_library import install_aliases
import sys
import pluggy
from ._version import get_versions

install_aliases()
if sys.version_info[0] < 3:
from future.standard_library import install_aliases
install_aliases()

__version__ = get_versions()['version']
del get_versions

Loading