diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index 869ace82..9aa913c7 100755 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -35,4 +35,4 @@ docker run \ --name eland-test-runner \ --rm \ elastic/eland \ - ./run_build.sh + nox -s test diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 00000000..748b9695 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,30 @@ +import nox + + +SOURCE_FILES = ( + "setup.py", + "noxfile.py", + "eland/", + "docs/", +) + + +@nox.session(reuse_venv=True) +def blacken(session): + session.install("black") + session.run("black", "--target-version=py36", *SOURCE_FILES) + lint(session) + + +@nox.session(reuse_venv=True) +def lint(session): + session.install("black", "flake8") + session.run("black", "--check", "--target-version=py36", *SOURCE_FILES) + session.run("flake8", "--ignore=E501,W503,E402,E712", *SOURCE_FILES) + + +@nox.session(python=["3.6", "3.7", "3.8"]) +def test(session): + session.install("-r", "requirements-dev.txt") + session.run("python", "-m", "eland.tests.setup_tests") + session.run("pytest", "eland/tests/") diff --git a/run_build.sh b/run_build.sh index 32e40762..99b27bdf 100755 --- a/run_build.sh +++ b/run_build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -python -m eland.tests.setup_tests -pytest +python -m pip install nox +nox -s lint test diff --git a/setup.py b/setup.py index 0759cbf3..feae0de9 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# flake8: noqa + from codecs import open from os import path @@ -19,7 +21,7 @@ here = path.abspath(path.dirname(__file__)) about = {} -with open(path.join(here, 'eland', '_version.py'), 'r', 'utf-8') as f: +with open(path.join(here, "eland", "_version.py"), "r", "utf-8") as f: exec(f.read(), about) CLASSIFIERS = [ @@ -36,16 +38,16 @@ "Topic :: Scientific/Engineering", ] -LONG_DESCRIPTION=""" +LONG_DESCRIPTION = """ # What is it? -eland is a Elasticsearch client Python package to analyse, explore and manipulate data that resides in Elasticsearch. -Where possible the package uses existing Python APIs and data structures to make it easy to switch between numpy, -pandas, scikit-learn to their Elasticsearch powered equivalents. In general, the data resides in Elasticsearch and +eland is a Elasticsearch client Python package to analyse, explore and manipulate data that resides in Elasticsearch. +Where possible the package uses existing Python APIs and data structures to make it easy to switch between numpy, +pandas, scikit-learn to their Elasticsearch powered equivalents. In general, the data resides in Elasticsearch and not in memory, which allows eland to access large datasets stored in Elasticsearch. -For example, to explore data in a large Elasticsearch index, simply create an eland DataFrame from an Elasticsearch -index pattern, and explore using an API that mirrors a subset of the pandas.DataFrame API: +For example, to explore data in a large Elasticsearch index, simply create an eland DataFrame from an Elasticsearch +index pattern, and explore using an API that mirrors a subset of the pandas.DataFrame API: ``` >>> import eland as ed @@ -171,22 +173,18 @@ """ setup( - name=about['__title__'], - version=about['__version__'], - description=about['__description__'], + name=about["__title__"], + version=about["__version__"], + description=about["__description__"], long_description=LONG_DESCRIPTION, - long_description_content_type='text/markdown', - url=about['__url__'], - maintainer=about['__maintainer__'], - maintainer_email=about['__maintainer_email__'], - license='Apache-2.0', + long_description_content_type="text/markdown", + url=about["__url__"], + maintainer=about["__maintainer__"], + maintainer_email=about["__maintainer_email__"], + license="Apache-2.0", classifiers=CLASSIFIERS, - keywords='elastic eland pandas python', + keywords="elastic eland pandas python", packages=find_packages(include=["eland", "eland.*"]), - install_requires=[ - 'elasticsearch>=7.0.5, <8', - 'pandas==0.25.3', - 'matplotlib' - ], + install_requires=["elasticsearch>=7.0.5, <8", "pandas==0.25.3", "matplotlib"], python_requires=">=3.6", )