Skip to content

Commit 5859ba9

Browse files
authored
Merge d6931c1 into f67414a
2 parents f67414a + d6931c1 commit 5859ba9

26 files changed

+141
-48
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ubuntu-build:
7+
name: ${{ matrix.python-version }} on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
matrix:
12+
python-version: [3.6, 3.7]
13+
os: [ubuntu-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v1
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
28+
- name: Lint with flake8
29+
run: |
30+
pip install flake8
31+
# stop the build if there are Python syntax errors or undefined names
32+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
36+
- name: Python Style Checker
37+
uses: andymckay/pycodestyle-action@0.1.3
38+
39+
- name: Test with pytest
40+
run: |
41+
pip install pytest pytest-cov coveralls coverage==4.5.4
42+
pytest tests/unit --cov=tabpy --cov-append
43+
pytest tests/integration --cov=tabpy --cov-append
44+
coveralls
45+
env:
46+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
47+
48+
- name: Markdownlint
49+
uses: nosborn/github-action-markdown-cli@v1.1.1
50+
with:
51+
files: .
52+
53+
windows-build:
54+
name: ${{ matrix.python-version }} on ${{ matrix.os }}
55+
runs-on: ${{ matrix.os }}
56+
57+
strategy:
58+
matrix:
59+
python-version: [3.7]
60+
os: [windows-latest]
61+
62+
steps:
63+
- uses: actions/checkout@v1
64+
65+
- name: Set up Python ${{ matrix.python-version }}
66+
uses: actions/setup-python@v1
67+
with:
68+
python-version: ${{ matrix.python-version }}
69+
70+
- name: Install dependencies
71+
run: |
72+
python -m pip install --upgrade pip
73+
pip install -r requirements.txt
74+
75+
- name: Test with pytest
76+
run: |
77+
pip install pytest pytest-cov coveralls
78+
pytest tests/unit
79+
pytest tests/integration
80+
81+
mac-build:
82+
name: ${{ matrix.python-version }} on ${{ matrix.os }}
83+
runs-on: ${{ matrix.os }}
84+
85+
strategy:
86+
matrix:
87+
python-version: [3.7]
88+
os: [macos-latest]
89+
90+
steps:
91+
- uses: actions/checkout@v1
92+
93+
- name: Set up Python ${{ matrix.python-version }}
94+
uses: actions/setup-python@v1
95+
with:
96+
python-version: ${{ matrix.python-version }}
97+
98+
- name: Install dependencies
99+
run: |
100+
python -m pip install --upgrade pip
101+
pip install -r requirements.txt
102+
103+
- name: Test with pytest
104+
run: |
105+
pip install pytest pytest-cov coveralls
106+
pytest tests/unit
107+
pytest tests/integration
108+

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ os: linux
22
language: python
33
python: 3.6
44
install:
5+
- python -m pip install --upgrade pip
56
- pip install pytest pytest-cov coveralls
67
- npm install -g markdownlint-cli
78
script:

CONTRIBUTING.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ and run it locally.
3131
These are prerequisites for an environment required for a contributor to
3232
be able to work on TabPy changes:
3333

34-
- Python 3.6.5:
34+
- Python 3.6 or 3.7:
3535
- To see which version of Python you have installed, run `python --version`.
3636
- git
3737
- TabPy repo:
@@ -57,16 +57,10 @@ be able to work on TabPy changes:
5757
cd TabPy
5858
```
5959

60-
4. Register TabPy repo as a pip package:
61-
62-
```sh
63-
pip install -e .
64-
```
65-
66-
5. Install all dependencies:
60+
4. Install all dependencies:
6761

6862
```sh
69-
python setup.py install
63+
pip install -r requirements.txt
7064
```
7165

7266
## Tests

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tableau/TabPy/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/tableau/TabPy/?branch=master)
88

99
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)
10+
[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)
1011

1112
![Release](https://img.shields.io/github/release/tableau/TabPy.svg)
1213

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# installs dependencies from ./setup.py, and the package itself,
2+
# in editable mode
3+
-e .

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pycodestyle]
2+
max-line-length = 88

tabpy/models/deploy_models.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99

1010
def install_dependencies(packages):
1111
pip_arg = ["install"] + packages + ["--no-cache-dir"]
12-
if hasattr(pip, "main"):
13-
pip.main(pip_arg)
14-
else:
15-
from pip._internal import main
16-
pip._internal.main(pip_arg)
12+
from pip._internal import main
13+
pip._internal.main.main(pip_arg)
1714

1815

1916
def main():

tabpy/tabpy_server/handlers/base_handler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,7 @@ def _get_credentials(self, method) -> bool:
311311
# No known methods were found
312312
self.logger.log(
313313
logging.CRITICAL,
314-
f'Unknown authentication method(s) "{method}" are configured '
315-
f'for API "{api_version}"',
314+
f'Unknown authentication method(s) "{method}" are configured ',
316315
)
317316
return False
318317

@@ -368,8 +367,7 @@ def _validate_credentials(self, method) -> bool:
368367
# No known methods were found
369368
self.logger.log(
370369
logging.CRITICAL,
371-
f'Unknown authentication method(s) "{method}" are configured '
372-
f'for API "{api_version}"',
370+
f'Unknown authentication method(s) "{method}" are configured ',
373371
)
374372
return False
375373

tabpy/tabpy_server/handlers/endpoints_handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from tabpy.tabpy_server.common.util import format_exception
1212
from tabpy.tabpy_server.handlers import ManagementHandler
1313
from tornado import gen
14-
import tornado.web
1514

1615

1716
class EndpointsHandler(ManagementHandler):

tabpy/tabpy_server/handlers/evaluation_plane_handler.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,16 @@ def _call_subprocess(self, function_to_evaluate, arguments):
127127
# Exec does not run the function, so it does not block.
128128
exec(function_to_evaluate, globals())
129129

130+
# 'noqa' comments below tell flake8 to ignore undefined _user_script
131+
# name - the name is actually defined with user script being wrapped
132+
# in _user_script function (constructed as a striong) and then executed
133+
# with exec() call above.
130134
if arguments is None:
131-
future = self.executor.submit(_user_script, restricted_tabpy)
135+
future = self.executor.submit(_user_script, # noqa: F821
136+
restricted_tabpy)
132137
else:
133-
future = self.executor.submit(_user_script, restricted_tabpy, **arguments)
138+
future = self.executor.submit(_user_script, # noqa: F821
139+
restricted_tabpy, **arguments)
134140

135141
ret = yield gen.with_timeout(timedelta(seconds=self.eval_timeout), future)
136142
raise gen.Return(ret)

0 commit comments

Comments
 (0)