diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e4c34d6..aa5beed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,12 @@ repos: - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 20.8b0 hooks: - id: black + files: \.py$ +- repo: https://github.com/pycqa/isort + rev: 5.6.4 + hooks: + - id: isort + files: \.py$ diff --git a/.travis.yml b/.travis.yml index 9f8bacd..6c8d3cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ env: - SCRIPT="test" - TEST_ARGS="" - BRANCH_NAME="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" + - PIP_USE_FEATURE="2020-resolver" - NUMPY="numpy" - COV_CORE_SOURCE="pytest_allclose" - COV_CORE_CONFIG=".coveragerc" @@ -62,7 +63,7 @@ jobs: - provider: pypi server: https://test.pypi.org/legacy/ user: tbekolay - password: $PYPI_TOKEN + password: $PYPI_TEST_TOKEN distributions: "sdist bdist_wheel " on: all_branches: true @@ -92,11 +93,7 @@ before_install: # install/run nengo-bones - pip install git+https://github.com/nengo/nengo-bones#egg=nengo-bones - bones-generate --output-dir .ci ci-scripts - - if [[ "$TRAVIS_PYTHON_VERSION" < "3.6" ]]; then - echo "Skipping bones-check because Python $TRAVIS_PYTHON_VERSION < 3.6"; - else - bones-check --verbose; - fi + - bones-check --verbose # display environment info - pip freeze diff --git a/LICENSE.rst b/LICENSE.rst index ef506a9..afdaf62 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -6,7 +6,7 @@ pytest-allclose license MIT License -Copyright (c) 2019-2020 Applied Brain Research +Copyright (c) 2019-2021 Applied Brain Research Permission is hereby granted, free of charge, to any person obtaining a copy of this software diff --git a/docs/conf.py b/docs/conf.py index 8068065..b75e415 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,7 +2,7 @@ # # Automatically generated by nengo-bones, do not edit this file directly -import os +import pathlib import pytest_allclose @@ -14,10 +14,11 @@ "sphinx.ext.intersphinx", "sphinx.ext.mathjax", "sphinx.ext.todo", - "sphinx.ext.viewcode", "nbsphinx", "nengo_sphinx_theme", "nengo_sphinx_theme.ext.backoff", + "nengo_sphinx_theme.ext.sourcelinks", + "notfound.extension", "numpydoc", ] @@ -34,18 +35,26 @@ # -- sphinx.ext.intersphinx intersphinx_mapping = { "nengo": ("https://www.nengo.ai/nengo/", None), - "numpy": ("https://docs.scipy.org/doc/numpy", None), + "numpy": ("https://numpy.org/doc/stable", None), "python": ("https://docs.python.org/3", None), } # -- sphinx.ext.todo todo_include_todos = True +# -- nbsphinx +nbsphinx_timeout = -1 + +# -- notfound.extension +notfound_template = "404.html" +notfound_urls_prefix = "/pytest-allclose/" + # -- numpydoc config numpydoc_show_class_members = False -# -- nbsphinx -nbsphinx_timeout = -1 +# -- nengo_sphinx_theme.ext.sourcelinks +sourcelinks_module = "pytest_allclose" +sourcelinks_url = "https://github.com/nengo/pytest-allclose" # -- sphinx nitpicky = True @@ -65,7 +74,7 @@ project = "pytest-allclose" authors = "Applied Brain Research" -copyright = "2019-2020 Applied Brain Research" +copyright = "2019-2021 Applied Brain Research" version = ".".join(pytest_allclose.__version__.split(".")[:2]) # Short X.Y version release = pytest_allclose.__version__ # Full version, with tags @@ -73,11 +82,11 @@ templates_path = ["_templates"] html_static_path = ["_static"] html_theme = "nengo_sphinx_theme" -html_title = "pytest-allclose {0} docs".format(release) +html_title = f"pytest-allclose {release} docs" htmlhelp_basename = "pytest-allclose" html_last_updated_fmt = "" # Default output format (suppressed) html_show_sphinx = False -html_favicon = os.path.join("_static", "favicon.ico") +html_favicon = str(pathlib.Path("_static", "favicon.ico")) html_theme_options = { "nengo_logo": "general-small-light.svg", "nengo_logo_color": "#a8acaf", diff --git a/pyproject.toml b/pyproject.toml index 2410bfa..f79ceb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,4 +4,8 @@ requires = ["setuptools", "wheel"] [tool.black] -target-version = ['py35', 'py36', 'py37'] +target-version = ['py36', 'py37', 'py38'] + +[tool.isort] +profile = "black" +src_paths = ["pytest_allclose"] diff --git a/pytest_allclose/__init__.py b/pytest_allclose/__init__.py index bab267c..711d35f 100644 --- a/pytest_allclose/__init__.py +++ b/pytest_allclose/__init__.py @@ -5,9 +5,8 @@ Pytest fixture extending Numpy's allclose function. """ -from .version import version as __version__ - from .plugin import report_rmses +from .version import version as __version__ -__copyright__ = "2019-2019 pytest_plt contributors" +__copyright__ = "2019-2021 pytest_plt contributors" __license__ = "MIT license" diff --git a/pytest_allclose/plugin.py b/pytest_allclose/plugin.py index 0f70e0c..53dde22 100644 --- a/pytest_allclose/plugin.py +++ b/pytest_allclose/plugin.py @@ -65,8 +65,7 @@ def _allclose( print_fail=5, record_rmse=True, ): - """Checks if two arrays are close, mimicking `numpy.allclose`. - """ + """Checks if two arrays are close, mimicking `numpy.allclose`.""" if len(overrides) > 0: override_args = overrides[min(call_count[0], len(overrides) - 1)] diff --git a/pytest_allclose/tests/test_pytest.py b/pytest_allclose/tests/test_pytest.py index d1866e1..91982d8 100644 --- a/pytest_allclose/tests/test_pytest.py +++ b/pytest_allclose/tests/test_pytest.py @@ -6,7 +6,6 @@ import numpy as np import pytest - pytest_plugins = ["pytester"] # adds the `testdir` fixture diff --git a/setup.cfg b/setup.cfg index ef82936..d457dad 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ build-dir = docs/_build all_files = 1 [coverage:run] -source = pytest_allclose +source = ./ [coverage:report] # Regexes for lines to exclude from consideration @@ -64,8 +64,8 @@ allclose_tolerances = xfail_strict = False [pylint] -# note: pylint doesn't look in setup.cfg by default, need to call it with -# `pylint ... --rcfile=setup.cfg` + +[pylint.messages] disable = arguments-differ, assignment-from-no-return, @@ -103,12 +103,20 @@ disable = unsubscriptable-object, unsupported-assignment-operation, unused-argument, + +[pylint.imports] known-third-party = matplotlib, nengo, numpy, pytest, + +[pylint.format] max-line-length = 88 + +[pylint.classes] valid-metaclass-classmethod-first-arg = metacls + +[pylint.reports] reports = no score = no diff --git a/setup.py b/setup.py index ac99d47..93d8bc1 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ # Automatically generated by nengo-bones, do not edit this file directly import io -import os +import pathlib import runpy try: @@ -26,8 +26,8 @@ def read(*filenames, **kwargs): return sep.join(buf) -root = os.path.dirname(os.path.realpath(__file__)) -version = runpy.run_path(os.path.join(root, "pytest_allclose", "version.py"))["version"] +root = pathlib.Path(__file__).parent +version = runpy.run_path(str(root / "pytest_allclose" / "version.py"))["version"] install_req = [ "numpy>=1.11", @@ -68,7 +68,11 @@ def read(*filenames, **kwargs): "tests": tests_req, }, python_requires=">=3.5", - entry_points={"pytest11": ["allclose = pytest_allclose.plugin",],}, + entry_points={ + "pytest11": [ + "allclose = pytest_allclose.plugin", + ], + }, classifiers=[ "Development Status :: 5 - Production/Stable", "Framework :: Pytest",