From 7663a400bfb2b1e63ce64f9bfa54f82f6ddd1008 Mon Sep 17 00:00:00 2001 From: Akimov Mikhail Date: Wed, 27 May 2020 17:53:37 +0300 Subject: [PATCH 1/7] Fixing CI: - upgrade netpick version in poetry - change setup.cfg --- poetry.lock | 2 +- pyproject.toml | 2 +- setup.cfg | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6f97e3d..316538b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -654,7 +654,7 @@ description = "Flake8 plugin to enforce the same lint configuration (flake8, iso name = "nitpick" optional = false python-versions = ">=3.5,<4.0" -version = "0.21.3" +version = "0.22.1" [package.dependencies] attrs = "*" diff --git a/pyproject.toml b/pyproject.toml index 1a400f6..bbe87fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ wemake-python-styleguide = "^0.13.0" flake8-pytest = "^1.3" flake8-pytest-style = "^0.1.3" flake8-pyi = "^19.3" -nitpick = "^0.21.3" +nitpick = "^0.22.1" safety = "^1.8" diff --git a/setup.cfg b/setup.cfg index ba2b5fb..9c6d206 100644 --- a/setup.cfg +++ b/setup.cfg @@ -56,6 +56,8 @@ multi_line_output = 3 default_section = FIRSTPARTY # Should be: 80 - 1 line_length = 79 +use_parentheses = True + [darglint] @@ -98,6 +100,7 @@ disallow_any_explicit = True ignore_errors = False ignore_missing_imports = True implicit_reexport = False +local_partial_types = True strict_optional = True strict_equality = True no_implicit_optional = True From 18f0e04642f2358d8ab1536cda021417ce0ffeb7 Mon Sep 17 00:00:00 2001 From: Akimov Mikhail Date: Thu, 28 May 2020 10:51:21 +0300 Subject: [PATCH 2/7] Fixing CI: - upgrade netpick version in poetry - change setup.cfg --- setup.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 9c6d206..174ffa1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,8 +54,7 @@ include_trailing_comma = true # See https://github.com/timothycrosley/isort#multi-line-output-modes multi_line_output = 3 default_section = FIRSTPARTY -# Should be: 80 - 1 -line_length = 79 +line_length = 80 use_parentheses = True From d2072f79cab7a9f3bb38d2528624e8fc04d8fc0a Mon Sep 17 00:00:00 2001 From: Akimov Mikhail Date: Thu, 28 May 2020 11:08:05 +0300 Subject: [PATCH 3/7] Fixing CI: - upgrade netpick, urllib3, pyyaml versions in poetry - change setup.cfg --- poetry.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 316538b..af7254a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -853,7 +853,7 @@ description = "YAML parser and emitter for Python" name = "pyyaml" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "5.1.2" +version = "5.3.1" [[package]] category = "dev" @@ -1130,7 +1130,7 @@ description = "HTTP library with thread-safe connection pooling, file post, and name = "urllib3" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" -version = "1.25.7" +version = "1.25.9" [[package]] category = "dev" From f4491a1e4193e40cffcfbfa56170a39da5a4b70e Mon Sep 17 00:00:00 2001 From: Akimov Mikhail Date: Tue, 2 Jun 2020 17:27:39 +0300 Subject: [PATCH 4/7] Fixing dependencies: - conf.py fixed (flake8 violation) - poetry.lock updated. flake8-pytest-style still not updated. --- docs/conf.py | 2 +- poetry.lock | 18 +++++++++--------- pyproject.toml | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index daacc8e..b8bfc4b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,7 +31,7 @@ def _get_project_meta(): pkg_meta = _get_project_meta() project = pkg_meta['name'] -copyright = '2019, dry-python team' # noqa: A001 +copy_right = '2020, dry-python team' # noqa: A001 author = 'dry-python team' # The short X.Y version diff --git a/poetry.lock b/poetry.lock index af7254a..a9909cf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -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,7 @@ 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 = "*" @@ -771,7 +771,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" @@ -805,7 +805,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 +819,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 +921,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" @@ -1046,7 +1046,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" @@ -1122,7 +1122,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 +1146,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" diff --git a/pyproject.toml b/pyproject.toml index bbe87fb..9b63f07 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" @@ -64,7 +64,7 @@ pytest-mypy-plugins = "^1.2" sphinx = "^2.3" 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" From 551d4e581f3cb9daea3be9607f5d81321e4c9668 Mon Sep 17 00:00:00 2001 From: Akimov Mikhail Date: Tue, 2 Jun 2020 17:42:16 +0300 Subject: [PATCH 5/7] 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. --- poetry.lock | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index a9909cf..a77dd9b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -968,7 +968,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" diff --git a/pyproject.toml b/pyproject.toml index 9b63f07..2b9d5cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ 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.4.0" sphinx-typlog-theme = "^0.8.0" From 6424bcdb6c5fbec81f0e364c9b194533666e7eb8 Mon Sep 17 00:00:00 2001 From: Akimov Mikhail Date: Wed, 3 Jun 2020 11:58:23 +0300 Subject: [PATCH 6/7] 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. --- docs/conf.py | 31 ++++++++++++++++++++++++++++++- poetry.lock | 24 ++++++++++++------------ 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index b8bfc4b..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'] -copy_right = '2020, 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 3694198..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" @@ -713,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" @@ -786,7 +786,7 @@ wcwidth = "*" [package.dependencies.importlib-metadata] python = "<3.8" -version = ">=0.12" +version = ">=0.23" [[package]] category = "dev" @@ -1107,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" @@ -1157,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" @@ -1165,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" From 90d664baaa00cefbec091534e7f351a5d6fa27a1 Mon Sep 17 00:00:00 2001 From: Akimov Mikhail Date: Wed, 3 Jun 2020 13:24:06 +0300 Subject: [PATCH 7/7] It seems like finished. --- classes/typeclass.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: