Skip to content

Commit

Permalink
Merge 98935fc into ddabcc4
Browse files Browse the repository at this point in the history
  • Loading branch information
0golovatyi committed Jan 11, 2020
2 parents ddabcc4 + 98935fc commit 49e5b62
Show file tree
Hide file tree
Showing 15 changed files with 167 additions and 68 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/pull_request.yml
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
python-version: [3.6, 3.7]
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest]

steps:
Expand All @@ -24,22 +24,21 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install -r requirements_dev.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest pytest-cov coveralls coverage==4.5.4
pytest tests/unit --cov=tabpy --cov-append
pytest tests/integration --cov=tabpy --cov-append
pytest tests --cov=tabpy
coveralls
env:
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

- name: Markdownlint
Expand All @@ -53,7 +52,7 @@ jobs:

strategy:
matrix:
python-version: [3.7]
python-version: [3.7, 3.8]
os: [windows-latest]

steps:
Expand All @@ -68,20 +67,19 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
- name: Test with pytest
run: |
pip install pytest pytest-cov coveralls
pytest tests/unit
pytest tests/integration
pytest tests
mac-build:
name: ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
python-version: [3.7]
python-version: [3.7, 3.8]
os: [macos-latest]

steps:
Expand All @@ -96,10 +94,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
- name: Test with pytest
run: |
pip install pytest pytest-cov coveralls
pytest tests/unit
pytest tests/integration
pytest tests
25 changes: 11 additions & 14 deletions .github/workflows/push.yml
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
python-version: [3.6, 3.7]
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest]

steps:
Expand All @@ -24,22 +24,21 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install -r requirements_dev.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest pytest-cov coveralls coverage==4.5.4
pytest tests/unit --cov=tabpy --cov-append
pytest tests/integration --cov=tabpy --cov-append
pytest tests --cov=tabpy
coveralls
env:
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

- name: Markdownlint
Expand All @@ -53,7 +52,7 @@ jobs:

strategy:
matrix:
python-version: [3.7]
python-version: [3.7, 3.8]
os: [windows-latest]

steps:
Expand All @@ -68,20 +67,19 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
- name: Test with pytest
run: |
pip install pytest pytest-cov coveralls
pytest tests/unit
pytest tests/integration
pytest tests
mac-build:
name: ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
python-version: [3.7]
python-version: [3.7, 3.8]
os: [macos-latest]

steps:
Expand All @@ -96,10 +94,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
- name: Test with pytest
run: |
pip install pytest pytest-cov coveralls
pytest tests/unit
pytest tests/integration
pytest tests
41 changes: 27 additions & 14 deletions .scrutinizer.yml
@@ -1,18 +1,31 @@
build:
environment:
python: 3.6
nodes:
analysis:
project_setup:
override:
- pip install sklearn pandas numpy textblob nltk scipy
tests:
override:
- py-scrutinizer-run
-
command: pylint-run
use_website_config: true
tests: true
environment:
python: 3.6
tests:
before:
- pip install pytest pytest-cov coverage
- pip install -r requirements.txt
nodes:
analysis:
project_setup:
override:
- pip install sklearn pandas numpy textblob nltk scipy
tests:
override:
- py-scrutinizer-run
- command: pylint-run
use_website_config: true
coverage:
tests:
before:
- pip install pytest pytest-cov coverage coveralls
- pip install -r requirements.txt
override:
- command: pytest tests --cov=tabpy
coverage:
file: '.coverage'
config_file: '.coveragerc'
format: 'py-cc'
checks:
python:
code_rating: true
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG
@@ -1,19 +1,21 @@
# Changelog

## v0.8.9
## v0.8.10

### Improvements

- Minor code improvements.
- TabPy works with Python 3.8 now.
- Documentation updates with referencing Tableau Help pages.
- Added Client.remove() method for deleting deployed models.


### Bug Fixes

- Fixed failing Ctrl+C handler.
- Fixed query_timeout bug.
- Fixed None in result collection bug.
- Fixed script evaluation with missing result/return bug.
- Fixed startup failure on Windows for Python 3.8.

## v0.8.9

Expand Down
11 changes: 3 additions & 8 deletions CONTRIBUTING.md
Expand Up @@ -34,13 +34,6 @@ be able to work on TabPy changes:
- Python 3.6 or 3.7:
- To see which version of Python you have installed, run `python --version`.
- git
- TabPy repo:
- Get the latest TabPy repository with
`git clone https://github.com/tableau/TabPy.git`.
- Create a new branch for your changes.
- When changes are ready push them on github and create merge request.
- PIP packages - install all with
`pip install pytest flake8 twine coverage --upgrade` command
- Node.js for npm packages - install from <https://nodejs.org>.
- NPM packages - install all with
`npm install markdown-toc markdownlint` command.
Expand All @@ -62,6 +55,8 @@ be able to work on TabPy changes:
```sh
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -r requirements_test.txt
```

## Tests
Expand Down Expand Up @@ -94,7 +89,7 @@ You can run unit tests to collect code coverage data. To do so run `pytest`
either for server or tools test, or even combined:

```sh
pytest tests --cov=tabpy-server/tabpy_server --cov=tabpy-tools/tabpy_tools --cov-append
pytest tests --cov=tabpy
```

## TabPy in Python Virtual Environment
Expand Down
1 change: 1 addition & 0 deletions requirements_dev.txt
@@ -0,0 +1 @@
flake8
3 changes: 3 additions & 0 deletions requirements_test.txt
@@ -0,0 +1,3 @@
coveralls
pytest
pytest-cov
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -79,7 +79,7 @@ def read(fname):
"singledispatch",
"six",
"tornado",
"urllib3<1.25,>=1.21.1",
"urllib3",
],
entry_points={
"console_scripts": [
Expand Down
24 changes: 23 additions & 1 deletion tabpy/tabpy_server/app/app.py
Expand Up @@ -6,6 +6,7 @@
import os
import shutil
import signal
import sys
import tabpy.tabpy_server
from tabpy.tabpy import __version__
from tabpy.tabpy_server.app.ConfigParameters import ConfigParameters
Expand All @@ -30,6 +31,25 @@
logger = logging.getLogger(__name__)


def _init_asyncio_patch():
"""
Select compatible event loop for Tornado 5+.
As of Python 3.8, the default event loop on Windows is `proactor`,
however Tornado requires the old default "selector" event loop.
As Tornado has decided to leave this to users to set, MkDocs needs
to set it. See https://github.com/tornadoweb/tornado/issues/2608.
"""
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
import asyncio
try:
from asyncio import WindowsSelectorEventLoopPolicy
except ImportError:
pass # Can't assign a policy which doesn't exist.
else:
if not isinstance(asyncio.get_event_loop_policy(), WindowsSelectorEventLoopPolicy):
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())


class TabPyApp:
"""
TabPy application class for keeping context like settings, state, etc.
Expand Down Expand Up @@ -113,6 +133,7 @@ def try_exit(self):
)

# initialize Tornado application
_init_asyncio_patch()
application = TabPyTornadoApp(
[
# skip MainHandler to use StaticFileHandler .* page requests and
Expand Down Expand Up @@ -243,7 +264,8 @@ def _parse_config(self, config_file):
(SettingsParameters.KeyFile, ConfigParameters.TABPY_KEY_FILE, None),
(SettingsParameters.StateFilePath, ConfigParameters.TABPY_STATE_PATH,
os.path.join(pkg_path, "tabpy_server")),
(SettingsParameters.StaticPath, ConfigParameters.TABPY_STATIC_PATH, "./"),
(SettingsParameters.StaticPath, ConfigParameters.TABPY_STATIC_PATH,
os.path.join(pkg_path, "tabpy_server", "static")),
(ConfigParameters.TABPY_PWD_FILE, ConfigParameters.TABPY_PWD_FILE, None),
(SettingsParameters.LogRequestContext, ConfigParameters.TABPY_LOG_DETAILS,
"false"),
Expand Down

0 comments on commit 49e5b62

Please sign in to comment.