From b3dec51f6e5aef761c05d36b0576b923462ffeb3 Mon Sep 17 00:00:00 2001 From: mikhail-akimov Date: Wed, 3 Jun 2020 14:04:01 +0300 Subject: [PATCH] WIP: fixing dependencies (#67) * Fixing CI: - upgrade netpick version in poetry - change setup.cfg * Fixing CI: - upgrade netpick version in poetry - change setup.cfg * Fixing CI: - upgrade netpick, urllib3, pyyaml versions in poetry - change setup.cfg * Fixing dependencies: - conf.py fixed (flake8 violation) - poetry.lock updated. flake8-pytest-style still not updated. * Fixing dependencies: - conf.py fixed (flake8 violation) - poetry.lock updated. - sphinx updated to 3.0.4 cuz of safety. flake8-pytest-style still not updated. * There are 2 problems left: 1. After updating flake8-rst-docstrings to 0.0.12 i have the violation RST214 about docstring in ./classes/typeclass.py . I cant imagine how i can fix this docstring :( It seems to me that replacing the first letter with a capital letter is not quite the right solution? 2. I still have pip check error of importlib-metadata like https://github.com/python-poetry/poetry/issues/2042 , but i can`t find any dependencies of it in poetry.toml or poetry.lock. * It seems like finished. Co-authored-by: Akimov Mikhail --- classes/typeclass.py | 2 +- docs/conf.py | 31 +++++++++++++++++++++++++++++- poetry.lock | 45 ++++++++++++++++++++++---------------------- pyproject.toml | 8 ++++---- 4 files changed, 58 insertions(+), 28 deletions(-) diff --git a/classes/typeclass.py b/classes/typeclass.py index a2c902c..4404a16 100644 --- a/classes/typeclass.py +++ b/classes/typeclass.py @@ -280,7 +280,7 @@ def typeclass( .. rubric:: Protocols We also support protocols. It has the same limitation as ``Generic`` types. - It is also dispatched after all regular ``instance``s are checked. + It is also dispatched after all regular instances are checked. To work with protocols, one needs to pass ``is_protocol`` flag to instance: diff --git a/docs/conf.py b/docs/conf.py index daacc8e..caeefde 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,9 +15,38 @@ import os import sys +import sphinx + sys.path.insert(0, os.path.abspath('..')) +# -- Monkeypatches ----------------------------------------------------------- + +def _monkeypatch(cls): + """Decorator to monkey-patch methods.""" + def decorator(func): + method = func.__name__ + old = getattr(cls, method) + setattr( + cls, + method, + lambda inst, *args, **kwargs: func(inst, old, *args, **kwargs), + ) + + return decorator + + +# workaround until https://github.com/miyakogi/m2r/pull/55 is merged +@_monkeypatch(sphinx.registry.SphinxComponentRegistry) +def add_source_parser(self, _old_add_source_parser, *args, **kwargs): + """This function changed in sphinx v3.0, we need to fix it back.""" + # signature is (parser: Type[Parser], **kwargs), but m2r expects + # the removed (str, parser: Type[Parser], **kwargs). + if isinstance(args[0], str): + args = args[1:] + return _old_add_source_parser(self, *args, **kwargs) + + # -- Project information ----------------------------------------------------- def _get_project_meta(): @@ -31,7 +60,7 @@ def _get_project_meta(): pkg_meta = _get_project_meta() project = pkg_meta['name'] -copyright = '2019, dry-python team' # noqa: A001 +copy_right = '2019, dry-python team' # noqa: A001 author = 'dry-python team' # The short X.Y version diff --git a/poetry.lock b/poetry.lock index af7254a..bf30070 100644 --- a/poetry.lock +++ b/poetry.lock @@ -114,7 +114,7 @@ description = "A utility for ensuring Google-style docstrings stay up to date wi name = "darglint" optional = false python-versions = ">=3.5" -version = "1.1.0" +version = "1.2.0" [[package]] category = "dev" @@ -229,7 +229,7 @@ description = "Flake8 plugin to forbid backslashes for line breaks" name = "flake8-broken-line" optional = false python-versions = ">=3.6,<4.0" -version = "0.1.1" +version = "0.2.0" [package.dependencies] flake8 = ">=3.5,<4.0" @@ -324,7 +324,7 @@ description = "Flake8 plugin to find commented out code" name = "flake8-eradicate" optional = false python-versions = ">=3.6,<4.0" -version = "0.2.3" +version = "0.3" [package.dependencies] attrs = ">=18.2,<20.0" @@ -348,7 +348,7 @@ description = "flake8 plugin that integrates isort ." name = "flake8-isort" optional = false python-versions = "*" -version = "2.7.0" +version = "2.9.0" [package.dependencies] flake8 = ">=3.2.1" @@ -458,7 +458,7 @@ description = "Python docstring reStructuredText (RST) validator" name = "flake8-rst-docstrings" optional = false python-versions = "*" -version = "0.0.11" +version = "0.0.12" [package.dependencies] flake8 = ">=3.0.0" @@ -633,7 +633,7 @@ description = "Optional static typing for Python" name = "mypy" optional = false python-versions = ">=3.5" -version = "0.761" +version = "0.770" [package.dependencies] mypy-extensions = ">=0.4.3,<0.5.0" @@ -654,7 +654,8 @@ description = "Flake8 plugin to enforce the same lint configuration (flake8, iso name = "nitpick" optional = false python-versions = ">=3.5,<4.0" -version = "0.22.1" +version = "0.22.2" + [package.dependencies] attrs = "*" @@ -712,7 +713,7 @@ version = "0.13.1" [package.dependencies] [package.dependencies.importlib-metadata] python = "<3.8" -version = ">=0.12" +version = ">=0.23" [[package]] category = "dev" @@ -771,7 +772,7 @@ description = "pytest: simple powerful testing with Python" name = "pytest" optional = false python-versions = ">=3.5" -version = "5.3.4" +version = "5.4.2" [package.dependencies] atomicwrites = ">=1.0" @@ -785,7 +786,7 @@ wcwidth = "*" [package.dependencies.importlib-metadata] python = "<3.8" -version = ">=0.12" +version = ">=0.23" [[package]] category = "dev" @@ -805,7 +806,7 @@ description = "pytest plugin for writing tests for mypy plugins" name = "pytest-mypy-plugins" optional = false python-versions = "*" -version = "1.2.0" +version = "1.3.0" [package.dependencies] decorator = "*" @@ -819,7 +820,7 @@ description = "Pytest plugin to randomly order tests and control random.seed." name = "pytest-randomly" optional = false python-versions = ">=3.5" -version = "3.2.1" +version = "3.4.0" [package.dependencies] pytest = "*" @@ -921,7 +922,7 @@ description = "Safety checks your installed dependencies for known security vuln name = "safety" optional = false python-versions = "*" -version = "1.8.5" +version = "1.8.7" [package.dependencies] Click = ">=6.0" @@ -968,7 +969,7 @@ description = "Python documentation generator" name = "sphinx" optional = false python-versions = ">=3.5" -version = "2.3.1" +version = "3.0.4" [package.dependencies] Jinja2 = ">=2.3" @@ -1046,7 +1047,7 @@ description = "Mermaid diagrams in yours Sphinx powered docs" name = "sphinxcontrib-mermaid" optional = false python-versions = "*" -version = "0.3.1" +version = "0.4.0" [[package]] category = "dev" @@ -1106,7 +1107,7 @@ description = "Style preserving TOML library" name = "tomlkit" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "0.5.8" +version = "0.5.11" [[package]] category = "dev" @@ -1122,7 +1123,7 @@ description = "Backported and Experimental Type Hints for Python 3.5+" name = "typing-extensions" optional = false python-versions = "*" -version = "3.7.4.1" +version = "3.7.4.2" [[package]] category = "dev" @@ -1146,7 +1147,7 @@ description = "The strictest and most opinionated python linter ever" name = "wemake-python-styleguide" optional = false python-versions = ">=3.6,<4.0" -version = "0.13.0" +version = "0.14.0" [package.dependencies] astor = ">=0.8,<0.9" @@ -1156,7 +1157,7 @@ darglint = ">=1.1,<2.0" flake8 = ">=3.7,<4.0" flake8-annotations-complexity = ">=0.0.2,<0.0.3" flake8-bandit = ">=2.1,<3.0" -flake8-broken-line = ">=0.1,<0.2" +flake8-broken-line = ">=0.2,<0.3" flake8-bugbear = ">=19.3,<20.0" flake8-builtins = ">=1.4,<2.0" flake8-coding = ">=1.3,<2.0" @@ -1164,14 +1165,14 @@ flake8-commas = ">=2.0,<3.0" flake8-comprehensions = ">=3.1.0,<4.0.0" flake8-debugger = ">=3.1,<4.0" flake8-docstrings = ">=1.3.1,<2.0.0" -flake8-eradicate = ">=0.2,<0.3" +flake8-eradicate = ">=0.3,<0.4" flake8-executable = ">=2.0,<3.0" -flake8-isort = ">=2.6,<3.0" +flake8-isort = ">=2.9,<3.0" flake8-logging-format = ">=0.6,<0.7" flake8-pep3101 = ">=1.2,<2.0" flake8-print = ">=3.1.4,<4.0.0" flake8-quotes = ">=2.0.1,<3.0.0" -flake8-rst-docstrings = ">=0.0.11,<0.0.12" +flake8-rst-docstrings = ">=0.0.12,<0.0.13" flake8-string-format = ">=0.2,<0.3" pep8-naming = ">=0.9.1,<0.10.0" pygments = ">=2.4,<3.0" diff --git a/pyproject.toml b/pyproject.toml index bbe87fb..2b9d5cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,8 +48,8 @@ python = "^3.6" typing_extensions = "^3.7" [tool.poetry.dev-dependencies] -mypy = "^0.761" -wemake-python-styleguide = "^0.13.0" +mypy = "^0.770" +wemake-python-styleguide = "^0.14.0" flake8-pytest = "^1.3" flake8-pytest-style = "^0.1.3" flake8-pyi = "^19.3" @@ -62,9 +62,9 @@ pytest-cov = "^2.7" pytest-randomly = "^3.2" pytest-mypy-plugins = "^1.2" -sphinx = "^2.3" +sphinx = "^3.0" sphinx-autodoc-typehints = "^1.7" -sphinxcontrib-mermaid = "^0.3.1" +sphinxcontrib-mermaid = "^0.4.0" sphinx-typlog-theme = "^0.8.0" doc8 = "^0.8.0" m2r = "^0.2.1"