Skip to content

Commit

Permalink
Merge from 5.x: PR #16565
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Oct 15, 2021
2 parents 99ec511 + bf5d7a7 commit 5581ddc
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 39 deletions.
7 changes: 6 additions & 1 deletion .github/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ if [ "$USE_CONDA" = "true" ]; then
conda remove spyder-kernels --force -q -y
conda remove python-lsp-server --force -q -y
conda remove qdarkstyle --force -q -y

# Note: Remove this when PyLSP 1.3.0 is released
mamba install 'pylint >=2.10' -c conda-forge -q -y
else
# Update pip and setuptools
pip install -U pip setuptools
Expand All @@ -52,6 +55,9 @@ else
pip uninstall spyder-kernels -q -y
pip uninstall python-lsp-server -q -y
pip uninstall qdarkstyle -q -y

# Remove Spyder to properly install it below
pip uninstall spyder -q -y
fi

# Install subrepos in development mode
Expand All @@ -70,7 +76,6 @@ popd
# Install Spyder to test it as if it was properly installed.
# Note: `python setup.py egg_info` doesn't work here but it
# does locally.
pip uninstall spyder -q -y
python setup.py -q bdist_wheel
pip install --no-deps -q dist/spyder*.whl

Expand Down
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
- pickleshare >=0.4
- psutil >=5.3
- pygments >=2.0
- pylint >=2.5.0,<2.10.0
- pylint >=2.5.0
- pyls-spyder >=0.4.0
- pyqt <5.13
- python-lsp-black >=1.0.0
Expand Down
4 changes: 2 additions & 2 deletions external-deps/python-lsp-server/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/python-lsp/python-lsp-server.git
branch = develop
commit = b2bdeeac5c90924b2028f9a24317c94675073355
parent = 2863683dd16b6aefec5412c2a213b8d9cf9a2f2d
commit = e8cf8e5b160f227550574cba480e276a98248d44
parent = b168e3445bbfbcb03aa04967668a2087a238f8a5
method = merge
cmdver = 0.4.3
3 changes: 2 additions & 1 deletion external-deps/python-lsp-server/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ disable =
too-few-public-methods,
too-many-arguments,
too-many-instance-attributes,
import-error
import-error,
consider-using-f-string,

[REPORTS]

Expand Down
22 changes: 21 additions & 1 deletion external-deps/python-lsp-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
# History of changes

## Version 1.2.2 (2021-09-01)
## Version 1.2.4 (2021-10-11)

### Pull Requests Merged

* [PR 96](https://github.com/python-lsp/python-lsp-server/pull/96) - Pin flake8 to be less than version 4, by [@ccordoba12](https://github.com/ccordoba12)

In this release 1 pull request was closed.

----

## Version 1.2.3 (2021-10-04)

### Pull Requests Merged

* [PR 93](https://github.com/python-lsp/python-lsp-server/pull/93) - Document how to write python-lsp-server plugin + add pylsp-rope to Readme, by [@lieryan](https://github.com/lieryan)
* [PR 88](https://github.com/python-lsp/python-lsp-server/pull/88) - Fix pylint test without pylsp installed, by [@jspricke](https://github.com/jspricke)

In this release 2 pull requests were closed.

----

## Version 1.2.2 (2021-09-01)

### Pull Requests Merged

Expand Down
7 changes: 6 additions & 1 deletion external-deps/python-lsp-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ Installing these plugins will add extra functionality to the language server:
- [pyls-isort](https://github.com/paradoxxxzero/pyls-isort): code formatting using [isort](https://github.com/PyCQA/isort) (automatic import sorting).
- [python-lsp-black](https://github.com/python-lsp/python-lsp-black): code formatting using [Black](https://github.com/psf/black).
- [pyls-memestra](https://github.com/QuantStack/pyls-memestra): detecting the use of deprecated APIs.
- [pylsp-rope](https://github.com/python-rope/pylsp-rope): Extended refactoring capabilities using [Rope](https://github.com/python-rope/rope).

Please see the above repositories for examples on how to write plugins for the Python LSP Server. Please file an issue if you require assistance writing a plugin.
Please see the above repositories for examples on how to write plugins for the Python LSP Server.

[cookiecutter-pylsp-plugin](https://github.com/python-lsp/cookiecutter-pylsp-plugin) is a [cookiecutter](https://cookiecutter.readthedocs.io/) template for setting up a basic plugin project for python-lsp-server. It documents all the essentials you need to know to kick start your own plugin project.

Please file an issue if you require assistance writing a plugin.

## Configuration

Expand Down
2 changes: 1 addition & 1 deletion external-deps/python-lsp-server/pylsp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _configure_logger(verbose=0, log_config=None, log_file=None):
root_logger = logging.root

if log_config:
with open(log_config, 'r') as f:
with open(log_config, 'r', encoding='utf-8') as f:
logging.config.dictConfig(json.load(f))
else:
formatter = logging.Formatter(LOG_FORMAT)
Expand Down
4 changes: 2 additions & 2 deletions external-deps/python-lsp-server/pylsp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def format_docstring(contents):
Until we can find a fast enough way of discovering and parsing each format,
we can do a little better by at least preserving indentation.
"""
contents = contents.replace('\t', u'\u00A0' * 4)
contents = contents.replace(' ', u'\u00A0' * 2)
contents = contents.replace('\t', '\u00A0' * 4)
contents = contents.replace(' ', '\u00A0' * 2)
return contents


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def run_flake8(flake8_executable, args, document):
try:
cmd = [flake8_executable]
cmd.extend(args)
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
except IOError:
log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable)
cmd = ['python', '-m', 'flake8']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _run_pylint_stdio(pylint_executable, document, flags):
cmd = [pylint_executable]
cmd.extend(flags)
cmd.extend(['--from-stdin', document.path])
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
except IOError:
log.debug("Can't execute %s. Trying with 'python -m pylint'", pylint_executable)
cmd = ['python', '-m', 'pylint']
Expand Down
2 changes: 1 addition & 1 deletion external-deps/python-lsp-server/pylsp/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def root_uri(self):
return self._root_uri

def is_local(self):
return (self._root_uri_scheme == '' or self._root_uri_scheme == 'file') and os.path.exists(self._root_path)
return (self._root_uri_scheme in ['', 'file']) and os.path.exists(self._root_path)

def get_document(self, doc_uri):
"""Return a managed document if-present, else create one pointing at disk.
Expand Down
10 changes: 5 additions & 5 deletions external-deps/python-lsp-server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,25 @@ def get_version(module='pylsp'):
extras_require={
'all': [
'autopep8',
'flake8>=3.8.0',
'flake8>=3.8.0,<4.0.0',
'mccabe>=0.6.0,<0.7.0',
'pycodestyle>=2.7.0',
'pydocstyle>=2.0.0',
'pyflakes>=2.3.0,<2.4.0',
'pylint>=2.5.0,<2.10.0',
'pylint>=2.5.0',
'rope>=0.10.5',
'yapf',
],
'autopep8': ['autopep8'],
'flake8': ['flake8>=3.8.0'],
'flake8': ['flake8>=3.8.0,<4.0.0'],
'mccabe': ['mccabe>=0.6.0,<0.7.0'],
'pycodestyle': ['pycodestyle>=2.7.0'],
'pydocstyle': ['pydocstyle>=2.0.0'],
'pyflakes': ['pyflakes>=2.3.0,<2.4.0'],
'pylint': ['pylint>=2.5.0,<2.10.0'],
'pylint': ['pylint>=2.5.0'],
'rope': ['rope>0.10.5'],
'yapf': ['yapf'],
'test': ['pylint>=2.5.0,<2.10.0', 'pytest', 'pytest-cov', 'coverage',
'test': ['pylint>=2.5.0', 'pytest', 'pytest-cov', 'coverage',
'numpy', 'pandas', 'matplotlib', 'pyqt5', 'flaky'],
},
entry_points={
Expand Down
6 changes: 4 additions & 2 deletions external-deps/python-lsp-server/test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def workspace_other_root_path(tmpdir):
@pytest.fixture
def config(workspace): # pylint: disable=redefined-outer-name
"""Return a config object."""
return Config(workspace.root_uri, {}, 0, {})
cfg = Config(workspace.root_uri, {}, 0, {})
cfg._plugin_settings = {'plugins': {'pylint': {'enabled': False, 'args': [], 'executable': None}}}
return cfg


@pytest.fixture
Expand All @@ -99,7 +101,7 @@ def temp_workspace_factory(workspace): # pylint: disable=redefined-outer-name
def fn(files):
def create_file(name, content):
fn = os.path.join(workspace.root_path, name)
with open(fn, 'w') as f:
with open(fn, 'w', encoding='utf-8') as f:
f.write(content)
workspace.put_document(uris.from_fs_path(fn), content)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_flake8_cfg_settings(workspace, config_str):
This function creates a ``setup.cfg``; you'll have to delete it yourself.
"""

with open(os.path.join(workspace.root_path, "setup.cfg"), "w+") as f:
with open(os.path.join(workspace.root_path, "setup.cfg"), "w+", encoding='utf-8') as f:
f.write(config_str)

workspace.update_config({"pylsp": {"configurationSources": ["flake8"]}})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_pycodestyle_config(workspace):

for conf_file, (content, working) in list(content.items()):
# Now we'll add config file to ignore it
with open(os.path.join(workspace.root_path, conf_file), 'w+') as f:
with open(os.path.join(workspace.root_path, conf_file), 'w+', encoding='utf-8') as f:
f.write(content)
workspace._config.settings.cache_clear()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def hello():
DOC_UNDEFINED_NAME_ERR = "a = b"


DOC_ENCODING = u"""# encoding=utf-8
DOC_ENCODING = """# encoding=utf-8
import sys
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def temp_document(doc_text, workspace):


def write_temp_doc(document, contents):
with open(document.path, 'w') as temp_file:
with open(document.path, 'w', encoding='utf-8') as temp_file:
temp_file.write(contents)


Expand Down
22 changes: 11 additions & 11 deletions external-deps/python-lsp-server/test/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_document_lines(doc):


def test_document_source_unicode(workspace):
document_mem = Document(DOC_URI, workspace, u'my source')
document_mem = Document(DOC_URI, workspace, 'my source')
document_disk = Document(DOC_URI, workspace)
assert isinstance(document_mem.source, type(document_disk.source))

Expand Down Expand Up @@ -44,27 +44,27 @@ def test_word_at_position(doc):


def test_document_empty_edit(workspace):
doc = Document('file:///uri', workspace, u'')
doc = Document('file:///uri', workspace, '')
doc.apply_change({
'range': {
'start': {'line': 0, 'character': 0},
'end': {'line': 0, 'character': 0}
},
'text': u'f'
'text': 'f'
})
assert doc.source == u'f'
assert doc.source == 'f'


def test_document_line_edit(workspace):
doc = Document('file:///uri', workspace, u'itshelloworld')
doc = Document('file:///uri', workspace, 'itshelloworld')
doc.apply_change({
'text': u'goodbye',
'text': 'goodbye',
'range': {
'start': {'line': 0, 'character': 3},
'end': {'line': 0, 'character': 8}
}
})
assert doc.source == u'itsgoodbyeworld'
assert doc.source == 'itsgoodbyeworld'


def test_document_multiline_edit(workspace):
Expand All @@ -73,8 +73,8 @@ def test_document_multiline_edit(workspace):
" print a\n",
" print b\n"
]
doc = Document('file:///uri', workspace, u''.join(old))
doc.apply_change({'text': u'print a, b', 'range': {
doc = Document('file:///uri', workspace, ''.join(old))
doc.apply_change({'text': 'print a, b', 'range': {
'start': {'line': 1, 'character': 4},
'end': {'line': 2, 'character': 11}
}})
Expand All @@ -89,8 +89,8 @@ def test_document_end_of_file_edit(workspace):
"print 'a'\n",
"print 'b'\n"
]
doc = Document('file:///uri', workspace, u''.join(old))
doc.apply_change({'text': u'o', 'range': {
doc = Document('file:///uri', workspace, ''.join(old))
doc.apply_change({'text': 'o', 'range': {
'start': {'line': 2, 'character': 0},
'end': {'line': 2, 'character': 0}
}})
Expand Down
2 changes: 1 addition & 1 deletion external-deps/python-lsp-server/test/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_non_root_project(pylsp, metafiles):
os.mkdir(project_root)

for metafile in metafiles:
with open(os.path.join(project_root, metafile), 'w+') as f:
with open(os.path.join(project_root, metafile), 'w+', encoding='utf-8') as f:
f.write('# ' + metafile)

test_uri = uris.from_fs_path(os.path.join(project_root, 'hello/test.py'))
Expand Down
2 changes: 1 addition & 1 deletion requirements/conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pexpect >=4.4.0
pickleshare >=0.4
psutil >=5.3
pygments >=2.0
pylint >=2.5.0,<2.10.0
pylint >=2.5.0
pyls-spyder >=0.4.0
pyqt <5.13
python-lsp-black >=1.0.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def run(self):
'pickleshare>=0.4',
'psutil>=5.3',
'pygments>=2.0',
'pylint>=2.5.0,<2.10.0',
'pylint>=2.5.0',
'python-lsp-black>=1.0.0',
'pyls-spyder>=0.4.0',
'pyqt5<5.13',
Expand Down
2 changes: 1 addition & 1 deletion spyder/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
PICKLESHARE_REQVER = '>=0.4'
PSUTIL_REQVER = '>=5.3'
PYGMENTS_REQVER = '>=2.0'
PYLINT_REQVER = '>=2.5.0;<2.10.0'
PYLINT_REQVER = '>=2.5.0'
PYLSP_REQVER = '>=1.2.2;<1.3.0'
PYLSP_BLACK_REQVER = '>=1.0.0'
PYLS_SPYDER_REQVER = '>=0.4.0'
Expand Down

0 comments on commit 5581ddc

Please sign in to comment.