From ff6ddc88edbccd6fa465dfab75fd81a458c81fae Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Sat, 2 Sep 2017 14:52:37 +0200 Subject: [PATCH 1/2] Run flake8 as part of the build For files in the python_bindings folder, run flake8 to detect style issues and errors automatically. --- .travis.yml | 3 ++- python_bindings/setup.py | 9 ++++++--- python_bindings/tests/legacy_test.py | 1 + python_bindings/tox.ini | 11 +++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e9a2d3..26140a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ before_install: source venv/bin/activate install: - cmake similarity_search && make -j 4 - - travis_wait travis_retry pip install -r python_bindings/requirements.txt scipy six + - travis_wait travis_retry pip install -r python_bindings/requirements.txt scipy six flake8 - travis_retry cd python_bindings && python setup.py build install && cd .. script: @@ -40,6 +40,7 @@ script: fi cd python_bindings python setup.py test + flake8 cd .. cache: - apt diff --git a/python_bindings/setup.py b/python_bindings/setup.py index 1951786..5253243 100755 --- a/python_bindings/setup.py +++ b/python_bindings/setup.py @@ -129,9 +129,12 @@ def build_extensions(self): description='Non-Metric Space Library (NMSLIB)', author='Leonid Boytsov', url='https://github.com/searchivarius/nmslib', - long_description="""Non-Metric Space Library (NMSLIB) is an efficient cross-platform similarity search library and a toolkit for evaluation of similarity search methods. -The goal of the project is to create an effective and comprehensive toolkit for searching in generic non-metric spaces. Being comprehensive is important, because no single method -is likely to be sufficient in all cases. Also note that exact solutions are hardly efficient in high dimensions and/or non-metric spaces. Hence, the main focus is on approximate me thods.""", + long_description="""Non-Metric Space Library (NMSLIB) is an efficient cross-platform + similarity search library and a toolkit for evaluation of similarity search methods. The + goal of the project is to create an effective and comprehensive toolkit for searching in + generic non-metric spaces. Being comprehensive is important, because no single method is + likely to be sufficient in all cases. Also note that exact solutions are hardly efficient in + high dimensions and/or non-metric spaces. Hence, the main focus is on approximate methods.""", ext_modules=ext_modules, install_requires=['pybind11>=2.0', 'numpy'], cmdclass={'build_ext': BuildExt}, diff --git a/python_bindings/tests/legacy_test.py b/python_bindings/tests/legacy_test.py index 3acaf7e..91fd498 100755 --- a/python_bindings/tests/legacy_test.py +++ b/python_bindings/tests/legacy_test.py @@ -13,6 +13,7 @@ import nmslib + class DenseTests(unittest.TestCase): def setUp(self): diff --git a/python_bindings/tox.ini b/python_bindings/tox.ini index b1af162..6bed36e 100644 --- a/python_bindings/tox.ini +++ b/python_bindings/tox.ini @@ -5,3 +5,14 @@ envlist = py27, py35, py36 commands = {envpython} setup.py test deps = -rrequirements.txt + +[testenv:style] +deps = + -rrequirements.txt + flake8 + +commands = + flake8 + +[flake8] +max-line-length = 100 From 505456851b782efb879ebb187c8c523524953f17 Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Sat, 2 Sep 2017 21:55:34 +0200 Subject: [PATCH 2/2] missing file --- python_bindings/setup.cfg | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 python_bindings/setup.cfg diff --git a/python_bindings/setup.cfg b/python_bindings/setup.cfg new file mode 100644 index 0000000..4e14725 --- /dev/null +++ b/python_bindings/setup.cfg @@ -0,0 +1,6 @@ +[metadata] +description-file = README.md + +[flake8] +max-line-length = 100 +exclude = build,.eggs,.tox,integration_tests,docs