Skip to content

Commit 1dccd30

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents 53eafb5 + cf59b8f commit 1dccd30

34 files changed

+811
-144
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PyLS Release
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
9+
jobs:
10+
build:
11+
name: Linux Py${{ matrix.PYTHON_VERSION }}
12+
runs-on: ubuntu-latest
13+
env:
14+
CI: 'true'
15+
OS: 'linux'
16+
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
PYTHON_VERSION: ['3.8']
21+
timeout-minutes: 10
22+
steps:
23+
- uses: actions/cache@v1
24+
with:
25+
path: ~/.cache/pip
26+
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
27+
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
28+
- uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0
31+
- uses: actions/setup-python@v2
32+
with:
33+
python-version: ${{ matrix.PYTHON_VERSION }}
34+
architecture: 'x64'
35+
- run: python -m pip install --upgrade pip setuptools wheel twine
36+
- name: Build and publish python-language-server
37+
env:
38+
TWINE_USERNAME: __token__
39+
TWINE_PASSWORD: ${{ secrets.PYPI_PYLS_TOKEN }}
40+
run: |
41+
python setup.py bdist_wheel --universal
42+
python setup.py sdist
43+
python -m twine check dist/*
44+
python -m twine upload dist/*

.github/workflows/test-linux.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Linux tests
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
pull_request:
9+
branches:
10+
- '*'
11+
12+
jobs:
13+
build:
14+
name: Linux Py${{ matrix.PYTHON_VERSION }}
15+
runs-on: ubuntu-latest
16+
env:
17+
CI: 'true'
18+
OS: 'linux'
19+
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
24+
timeout-minutes: 10
25+
steps:
26+
- uses: actions/cache@v1
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
30+
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
31+
- uses: actions/checkout@v2
32+
- uses: actions/setup-python@v2
33+
with:
34+
python-version: ${{ matrix.PYTHON_VERSION }}
35+
architecture: 'x64'
36+
- name: Create Jedi environment for testing
37+
if: matrix.PYTHON_VERSION != '2.7'
38+
run: |
39+
python3 -m venv /tmp/pyenv
40+
/tmp/pyenv/bin/python -m pip install loghub
41+
- run: python -m pip install --upgrade pip setuptools
42+
- run: pip install -e .[all] .[test]
43+
- run: py.test -v test/
44+
- name: Pylint checks
45+
if: matrix.PYTHON_VERSION == '2.7'
46+
run: pylint pyls test
47+
- name: Code style checks
48+
if: matrix.PYTHON_VERSION == '2.7'
49+
run: pycodestyle pyls test
50+
- name: Pyflakes checks
51+
if: matrix.PYTHON_VERSION == '2.7'
52+
run: pyflakes pyls test

.github/workflows/test-mac.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Mac tests
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
pull_request:
9+
branches:
10+
- '*'
11+
12+
jobs:
13+
build:
14+
name: Mac Py${{ matrix.PYTHON_VERSION }}
15+
runs-on: macos-latest
16+
env:
17+
CI: 'true'
18+
OS: 'macos'
19+
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
24+
timeout-minutes: 10
25+
steps:
26+
- uses: actions/cache@v1
27+
with:
28+
path: ~/Library/Caches/pip
29+
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
30+
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
31+
- uses: actions/checkout@v2
32+
- uses: actions/setup-python@v2
33+
with:
34+
python-version: ${{ matrix.PYTHON_VERSION }}
35+
architecture: 'x64'
36+
- name: Create Jedi environment for testing
37+
if: matrix.PYTHON_VERSION != '2.7'
38+
run: |
39+
python3 -m venv /tmp/pyenv
40+
/tmp/pyenv/bin/python -m pip install loghub
41+
- run: python -m pip install --upgrade pip setuptools
42+
- run: pip install -e .[all] .[test]
43+
- run: py.test -v test/

.github/workflows/test-win.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Windows tests
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
pull_request:
9+
branches:
10+
- '*'
11+
12+
jobs:
13+
build:
14+
name: Win Py${{ matrix.PYTHON_VERSION }}
15+
runs-on: windows-latest
16+
env:
17+
CI: 'true'
18+
OS: 'win'
19+
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
24+
timeout-minutes: 10
25+
steps:
26+
- uses: actions/cache@v1
27+
with:
28+
path: ~\AppData\Local\pip\Cache
29+
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
30+
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
31+
- uses: actions/checkout@v2
32+
- uses: actions/setup-python@v2
33+
with:
34+
python-version: ${{ matrix.PYTHON_VERSION }}
35+
architecture: 'x64'
36+
- run: python -m pip install --upgrade pip setuptools
37+
- run: pip install -e .[all] .[test]
38+
- run: py.test -v test/

.policy.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Excavator auto-updates this file. Please contribute improvements to the central template.
2+
3+
policy:
4+
approval:
5+
- or:
6+
- one admin or contributor has approved
7+
- two admins have approved
8+
- changelog only and contributor approval
9+
- fixing excavator
10+
- excavator only touched baseline, circle, gradle files, godel files, docker-compose-rule config or versions.props
11+
- excavator only touched config files
12+
- bots updated package.json and lock files
13+
disapproval:
14+
requires:
15+
organizations: [ "palantir" ]
16+
17+
approval_rules:
18+
- name: one admin or contributor has approved
19+
options:
20+
allow_contributor: true
21+
requires:
22+
count: 1
23+
admins: true
24+
25+
- name: two admins have approved
26+
options:
27+
allow_contributor: true
28+
requires:
29+
count: 2
30+
admins: true
31+
32+
- name: changelog only and contributor approval
33+
options:
34+
allow_contributor: true
35+
requires:
36+
count: 1
37+
admins: true
38+
if:
39+
only_changed_files:
40+
paths:
41+
- "changelog/@unreleased/.*\\.yml"
42+
43+
- name: fixing excavator
44+
options:
45+
allow_contributor: true
46+
requires:
47+
count: 1
48+
admins: true
49+
if:
50+
has_author_in:
51+
users: [ "svc-excavator-bot" ]
52+
53+
- name: excavator only touched baseline, circle, gradle files, godel files, docker-compose-rule config or versions.props
54+
requires:
55+
count: 0
56+
if:
57+
has_author_in:
58+
users: [ "svc-excavator-bot" ]
59+
only_changed_files:
60+
# product-dependencies.lock should never go here, to force review of all product (SLS) dependency changes
61+
# this way excavator cannot change the deployability of a service or product via auto-merge
62+
paths:
63+
- "changelog/@unreleased/.*\\.yml"
64+
- "^\\.baseline/.*$"
65+
- "^\\.circleci/.*$"
66+
- "^\\.docker-compose-rule\\.yml$"
67+
- "^.*gradle$"
68+
- "^gradle/wrapper/.*"
69+
- "^gradlew$"
70+
- "^gradlew.bat$"
71+
- "^gradle.properties$"
72+
- "^settings.gradle$"
73+
- "^godelw$"
74+
- "^godel/config/godel.properties$"
75+
- "^versions.props$"
76+
- "^versions.lock$"
77+
78+
- name: excavator only touched config files
79+
requires:
80+
count: 0
81+
if:
82+
has_author_in:
83+
users: [ "svc-excavator-bot" ]
84+
only_changed_files:
85+
paths:
86+
- "^\\..*.yml$"
87+
- "^\\.github/.*$"
88+
89+
- name: bots updated package.json and lock files
90+
requires:
91+
count: 0
92+
if:
93+
has_author_in:
94+
users:
95+
- "svc-excavator-bot"
96+
- "dependabot[bot]"
97+
only_changed_files:
98+
paths:
99+
- "^.*yarn.lock$"
100+
- "^.*package.json$"

README.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
Python Language Server
22
======================
33

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

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

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

appveyor.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

pyls/_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ def find_parents(root, path, names):
8282
return []
8383

8484

85+
def path_to_dot_name(path):
86+
"""Given a path to a module, derive its dot-separated full name."""
87+
directory = os.path.dirname(path)
88+
module_name, _ = os.path.splitext(os.path.basename(path))
89+
full_name = [module_name]
90+
while os.path.exists(os.path.join(directory, '__init__.py')):
91+
this_directory = os.path.basename(directory)
92+
directory = os.path.dirname(directory)
93+
full_name = [this_directory] + full_name
94+
return '.'.join(full_name)
95+
96+
8597
def match_uri_to_workspace(uri, workspaces):
8698
if uri is None:
8799
return None

pyls/plugins/autopep8_format.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def pyls_format_range(config, document, range): # pylint: disable=redefined-bui
2828

2929

3030
def _format(config, document, line_range=None):
31-
options = _autopep8_config(config)
31+
options = _autopep8_config(config, document)
3232
if line_range:
3333
options['line_range'] = list(line_range)
3434

@@ -57,9 +57,10 @@ def _format(config, document, line_range=None):
5757
}]
5858

5959

60-
def _autopep8_config(config):
60+
def _autopep8_config(config, document=None):
6161
# We user pycodestyle settings to avoid redefining things
62-
settings = config.plugin_settings('pycodestyle')
62+
path = document.path if document is not None else None
63+
settings = config.plugin_settings('pycodestyle', document_path=path)
6364
options = {
6465
'exclude': settings.get('exclude'),
6566
'hang_closing': settings.get('hangClosing'),

pyls/plugins/definition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def pyls_definitions(config, document, position):
1616

1717
return [
1818
{
19-
'uri': uris.uri_with(document.uri, path=d.module_path),
19+
'uri': uris.uri_with(document.uri, path=str(d.module_path)),
2020
'range': {
2121
'start': {'line': d.line - 1, 'character': d.column},
2222
'end': {'line': d.line - 1, 'character': d.column + len(d.name)},

0 commit comments

Comments
 (0)