Skip to content

Commit

Permalink
Fix scrutinizer (#454)
Browse files Browse the repository at this point in the history
* Simplify scrutinizer config

* Specify tests step for scrutinizer

* Specify tests step for scrutinizer

* Delete spelling fix step

* Delete requirements_test.txt

* Merge app parameters constants in one file

* Delete MainHandler

Co-authored-by: Olek Golovatyi <ogolovatyi@tableau.com>
  • Loading branch information
0golovatyi and Olek Golovatyi committed Sep 11, 2020
1 parent de89268 commit d30041b
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 128 deletions.
1 change: 0 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ 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: Test with pytest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ 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
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/pull_fix_spelling.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ 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: Test with pytest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ 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: Test with pytest
Expand Down
72 changes: 35 additions & 37 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
build:
environment:
python: 3.7.6
nodes:
coverage:
project_setup:
override:
- pip install -r requirements.txt
- pip install -r requirements_test.txt
- pip install -r requirements_dev.txt
tests:
override:
- command: 'pytest tests --cov=tabpy --cov-config=setup.cfg'
coverage:
file: '.coverage'
config_file: 'setup.cfg'
format: 'py-cc'
analysis:
project_setup:
override:
- pip install -r requirements_test.txt
tests:
override: [py-scrutinizer-run]
tests:
before:
- pip install -r requirements.txt
- pip install -r requirements_test.txt
override: [pytest]
checks:
python:
code_rating: true
duplicate_code: true
filter:
excluded_paths:
- '*/tests/*'
dependency_paths:
- 'lib/*'
build:
environment:
python: 3.7.6
nodes:
coverage:
project_setup:
override:
- pip install -r requirements.txt
- pip install -r requirements_dev.txt
tests:
override:
- command: 'pytest tests --cov=tabpy --cov-config=setup.cfg'
coverage:
file: '.coverage'
config_file: 'setup.cfg'
format: 'py-cc'
analysis:
project_setup:
override:
- pip install -r requirements.txt
tests:
override: [py-scrutinizer-run]
tests:
before:
- pip install -r requirements.txt
override: [pytest]
checks:
python:
code_rating: true
duplicate_code: true
filter:
excluded_paths:
- '*/tests/*'
dependency_paths:
- 'lib/*'
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ be able to work on TabPy changes:
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
5 changes: 0 additions & 5 deletions requirements_test.txt

This file was deleted.

26 changes: 7 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,29 @@ def read(fname):
# but are listed here because different linux distros use custom
# python installations. And users can remove packages at any point
install_requires=[
"backports_abc",
"cloudpickle",
"configparser",
"decorator",
"coverage",
"coveralls",
"docopt",
"future",
"genson",
"hypothesis",
"jsonschema",
"mock",
"nltk",
"numpy",
"pandas",
"pyopenssl",
"python-dateutil",
"pytest",
"pytest-cov",
"requests",
"scipy",
"simplejson",
"singledispatch",
"six",
"sklearn",
"textblob",
"tornado",
"twisted",
"urllib3",
],
entry_points={
Expand All @@ -97,20 +99,6 @@ def read(fname):
],
},
setup_requires=["pytest-runner"],
tests_require=[
"coverage",
"coveralls",
"hypothesis",
"mock",
"nltk",
"numpy",
"pandas",
"pytest",
"pytest-cov",
"scipy",
"sklearn",
"textblob",
],
test_suite="pytest",
)

Expand Down
17 changes: 0 additions & 17 deletions tabpy/tabpy_server/app/SettingsParameters.py

This file was deleted.

6 changes: 1 addition & 5 deletions tabpy/tabpy_server/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import sys
import tabpy
from tabpy.tabpy import __version__
from tabpy.tabpy_server.app.ConfigParameters import ConfigParameters
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app_parameters import ConfigParameters, SettingsParameters
from tabpy.tabpy_server.app.util import parse_pwd_file
from tabpy.tabpy_server.management.state import TabPyState
from tabpy.tabpy_server.management.util import _get_state_from_file
Expand Down Expand Up @@ -136,9 +135,6 @@ def try_exit(self):
_init_asyncio_patch()
application = TabPyTornadoApp(
[
# skip MainHandler to use StaticFileHandler .* page requests and
# default to index.html
# (r"/", MainHandler),
(
self.subdirectory + r"/query/([^/]+)",
QueryPlaneHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,22 @@ class ConfigParameters:
TABPY_STATIC_PATH = "TABPY_STATIC_PATH"
TABPY_MAX_REQUEST_SIZE_MB = "TABPY_MAX_REQUEST_SIZE_MB"
TABPY_EVALUATE_TIMEOUT = "TABPY_EVALUATE_TIMEOUT"


class SettingsParameters:
"""
Application (TabPyApp) settings names
"""

TransferProtocol = "transfer_protocol"
Port = "port"
ServerVersion = "server_version"
UploadDir = "upload_dir"
CertificateFile = "certificate_file"
KeyFile = "key_file"
StateFilePath = "state_file_path"
ApiVersions = "versions"
LogRequestContext = "log_request_context"
StaticPath = "static_path"
MaxRequestSizeInMb = "max_request_size_in_mb"
EvaluateTimeout = "evaluate_timeout"
1 change: 0 additions & 1 deletion tabpy/tabpy_server/handlers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from tabpy.tabpy_server.handlers.base_handler import BaseHandler
from tabpy.tabpy_server.handlers.main_handler import MainHandler
from tabpy.tabpy_server.handlers.management_handler import ManagementHandler

from tabpy.tabpy_server.handlers.endpoint_handler import EndpointHandler
Expand Down
2 changes: 1 addition & 1 deletion tabpy/tabpy_server/handlers/base_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import logging
import tornado.web
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app_parameters import SettingsParameters
from tabpy.tabpy_server.handlers.util import hash_password
from tabpy.tabpy_server.handlers.util import AuthErrorStates
import uuid
Expand Down
7 changes: 0 additions & 7 deletions tabpy/tabpy_server/handlers/main_handler.py

This file was deleted.

6 changes: 3 additions & 3 deletions tabpy/tabpy_server/handlers/management_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from tornado import gen

from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.handlers import MainHandler
from tabpy.tabpy_server.app.app_parameters import SettingsParameters
from tabpy.tabpy_server.handlers import BaseHandler
from tabpy.tabpy_server.handlers.base_handler import STAGING_THREAD
from tabpy.tabpy_server.management.state import get_query_object_path
from tabpy.tabpy_server.psws.callbacks import on_state_change
Expand All @@ -34,7 +34,7 @@ def copy_from_local(localpath, remotepath, is_dir=False):
shutil.copy(localpath, remotepath)


class ManagementHandler(MainHandler):
class ManagementHandler(BaseHandler):
def initialize(self, app):
super(ManagementHandler, self).initialize(app)
self.port = self.settings[SettingsParameters.Port]
Expand Down
2 changes: 1 addition & 1 deletion tabpy/tabpy_server/handlers/service_info_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app_parameters import SettingsParameters
from tabpy.tabpy_server.handlers import ManagementHandler
from tabpy.tabpy_server.handlers.util import AuthErrorStates

Expand Down
2 changes: 1 addition & 1 deletion tabpy/tabpy_server/handlers/upload_destination_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app_parameters import SettingsParameters
from tabpy.tabpy_server.handlers import ManagementHandler
import os
from tabpy.tabpy_server.handlers.util import AuthErrorStates
Expand Down
3 changes: 1 addition & 2 deletions tabpy/tabpy_server/management/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from ConfigParser import ConfigParser as _ConfigParser
except ImportError:
from configparser import ConfigParser as _ConfigParser
from tabpy.tabpy_server.app.ConfigParameters import ConfigParameters
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app_parameters import ConfigParameters, SettingsParameters


def write_state_config(state, settings, logger=logging.getLogger(__name__)):
Expand Down
2 changes: 1 addition & 1 deletion tabpy/tabpy_server/psws/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app_parameters import SettingsParameters
from tabpy.tabpy_server.common.messages import (
LoadObject,
DeleteObjects,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/server_tests/test_service_info_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import os
from tabpy.tabpy_server.app.app import TabPyApp
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app_parameters import SettingsParameters
import tempfile
from tornado.testing import AsyncHTTPTestCase

Expand Down

0 comments on commit d30041b

Please sign in to comment.