From 2cc9e4c70f5dc9fa59dba601d08e8f5e8161be6d Mon Sep 17 00:00:00 2001 From: Bruno FS Ciconelle Date: Tue, 28 May 2024 19:56:07 -0300 Subject: [PATCH] Replace flake8-rst-docstrings and darglint with pydoclint As highlighted [here][github discussion], pydoclint is a much faster alternative. [github discussion]: https://github.com/cjolowicz/cookiecutter-hypermodern-python/issues/1282#issuecomment-2136133054 --- .darglint | 2 - .flake8 | 6 --- .pre-commit-config.yaml | 11 ++-- README.md | 1 - noxfile.py | 3 +- poetry.lock | 114 +++++++++------------------------------- pyproject.toml | 10 ++-- 7 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 .darglint delete mode 100644 .flake8 diff --git a/.darglint b/.darglint deleted file mode 100644 index 72ccc6c..0000000 --- a/.darglint +++ /dev/null @@ -1,2 +0,0 @@ -[darglint] -strictness = long diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 3ccf956..0000000 --- a/.flake8 +++ /dev/null @@ -1,6 +0,0 @@ -[flake8] -select = DAR,RST -ignore = RST201,RST203,RST301 -max-line-length = 80 -rst-roles = class,const,func,meth,mod,ref -rst-directives = deprecated diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 01fb99f..a3b1287 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,12 +15,6 @@ repos: entry: check-yaml language: system types: [yaml] - - id: darglint - name: darglint - entry: darglint - language: system - types: [python] - stages: [manual] - id: end-of-file-fixer name: Fix End of Files entry: end-of-file-fixer @@ -33,6 +27,11 @@ repos: language: system types: [text] stages: [commit, push, manual] + - id: pydoclint + name: pydoclint + entry: pydoclint + language: system + types: [python] - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.6.0 hooks: diff --git a/README.md b/README.md index 8515113..d826780 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit] [![Ruff codestyle][ruff badge]][ruff project] - [pypi status]: https://pypi.org/project/retrocookie-hypermodern-python/ [read the docs]: https://retrocookie-hypermodern-python.readthedocs.io/ [tests]: https://github.com/bruno-fs/retrocookie-hypermodern-python/actions?workflow=Tests diff --git a/noxfile.py b/noxfile.py index 37727de..998317f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -122,10 +122,9 @@ def precommit(session: Session) -> None: ] session.install( "ruff", - "darglint", - "flake8-rst-docstrings", "pre-commit", "pre-commit-hooks", + "pydoclint", ) session.run("pre-commit", *args) if args and args[0] == "install": diff --git a/poetry.lock b/poetry.lock index e0f666f..1bf898b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -408,17 +408,6 @@ ssh = ["bcrypt (>=3.1.5)"] test = ["certifi", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"] test-randomorder = ["pytest-randomly"] -[[package]] -name = "darglint" -version = "1.8.1" -description = "A utility for ensuring Google-style docstrings stay up to date with the source code." -optional = false -python-versions = ">=3.6,<4.0" -files = [ - {file = "darglint-1.8.1-py3-none-any.whl", hash = "sha256:5ae11c259c17b0701618a20c3da343a3eb98b3bc4b5a83d31cdd94f5ebdced8d"}, - {file = "darglint-1.8.1.tar.gz", hash = "sha256:080d5106df149b199822e7ee7deb9c012b49891538f14a11be681044f0bb20da"}, -] - [[package]] name = "distlib" version = "0.3.8" @@ -430,6 +419,17 @@ files = [ {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, ] +[[package]] +name = "docstring-parser-fork" +version = "0.0.5" +description = "Parse Python docstrings in reST, Google and Numpydoc format" +optional = false +python-versions = ">=3.6,<4.0" +files = [ + {file = "docstring_parser_fork-0.0.5-py3-none-any.whl", hash = "sha256:d521dea9b9cc6c60ab5569fa0c1115e3b84a83e6413266fb111a7c81cb935997"}, + {file = "docstring_parser_fork-0.0.5.tar.gz", hash = "sha256:395ae8ee6a359e268670ebc4fe9a40dab917a94f6decd7cda8e86f9bea5c9456"}, +] + [[package]] name = "docutils" version = "0.20.1" @@ -492,41 +492,6 @@ docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1 testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8.0.1)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"] typing = ["typing-extensions (>=4.8)"] -[[package]] -name = "flake8" -version = "5.0.4" -description = "the modular source code checker: pep8 pyflakes and co" -optional = false -python-versions = ">=3.6.1" -files = [ - {file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"}, - {file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"}, -] - -[package.dependencies] -mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.9.0,<2.10.0" -pyflakes = ">=2.5.0,<2.6.0" - -[[package]] -name = "flake8-rst-docstrings" -version = "0.3.0" -description = "Python docstring reStructuredText (RST) validator for flake8" -optional = false -python-versions = ">=3.7" -files = [ - {file = "flake8-rst-docstrings-0.3.0.tar.gz", hash = "sha256:d1ce22b4bd37b73cd86b8d980e946ef198cfcc18ed82fedb674ceaa2f8d1afa4"}, - {file = "flake8_rst_docstrings-0.3.0-py3-none-any.whl", hash = "sha256:f8c3c6892ff402292651c31983a38da082480ad3ba253743de52989bdc84ca1c"}, -] - -[package.dependencies] -flake8 = ">=3" -pygments = "*" -restructuredtext-lint = "*" - -[package.extras] -develop = ["build", "twine"] - [[package]] name = "furo" version = "2024.5.6" @@ -754,17 +719,6 @@ dev = ["marshmallow[tests]", "pre-commit (>=3.5,<4.0)", "tox"] docs = ["alabaster (==0.7.16)", "autodocsumm (==0.2.12)", "sphinx (==7.3.7)", "sphinx-issues (==4.1.0)", "sphinx-version-warning (==1.1.2)"] tests = ["pytest", "pytz", "simplejson"] -[[package]] -name = "mccabe" -version = "0.7.0" -description = "McCabe checker, plugin for flake8" -optional = false -python-versions = ">=3.6" -files = [ - {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, - {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, -] - [[package]] name = "mdit-py-plugins" version = "0.4.1" @@ -965,17 +919,6 @@ files = [ "ruamel.yaml" = ">=0.15" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -[[package]] -name = "pycodestyle" -version = "2.9.1" -description = "Python style guide checker" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, - {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, -] - [[package]] name = "pycparser" version = "2.22" @@ -1098,16 +1041,24 @@ files = [ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] -name = "pyflakes" -version = "2.5.0" -description = "passive checker of Python programs" +name = "pydoclint" +version = "0.4.1" +description = "A Python docstring linter that checks arguments, returns, yields, and raises sections" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"}, - {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, + {file = "pydoclint-0.4.1-py2.py3-none-any.whl", hash = "sha256:4e32fdf0a47a2199377617f09af0a82a2157f80543026f919a17112a396e752f"}, + {file = "pydoclint-0.4.1.tar.gz", hash = "sha256:d39ed26a793203afadb1917011710fbf258ac3dddcd79b53212e0a2107221643"}, ] +[package.dependencies] +click = ">=8.1.0" +docstring-parser-fork = ">=0.0.5" +tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} + +[package.extras] +flake8 = ["flake8 (>=4)"] + [[package]] name = "pygments" version = "2.18.0" @@ -1235,19 +1186,6 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] -[[package]] -name = "restructuredtext-lint" -version = "1.4.0" -description = "reStructuredText linter" -optional = false -python-versions = "*" -files = [ - {file = "restructuredtext_lint-1.4.0.tar.gz", hash = "sha256:1b235c0c922341ab6c530390892eb9e92f90b9b75046063e047cacfb0f050c45"}, -] - -[package.dependencies] -docutils = ">=0.11,<1.0" - [[package]] name = "rich" version = "13.7.1" @@ -1816,4 +1754,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "3bd89aab85eeeb743fd5a0a84e4c993dca608c7fa3d7b812ab42d30054b7ae3e" +content-hash = "727d16f4ab9815aa80ad0189761d06ca78699eee75af9d208c4ea4f08d102456" diff --git a/pyproject.toml b/pyproject.toml index ddba5ed..9be4bf3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,12 +21,12 @@ click = ">=8.0.1" [tool.poetry.dev-dependencies] Pygments = ">=2.10.0" coverage = { extras = ["toml"], version = ">=6.2" } -darglint = ">=1.8.1" -flake8-rst-docstrings = ">=0.2.5" furo = ">=2021.11.12" mypy = ">=0.930" +myst-parser = { version = ">=0.16.1" } pre-commit = ">=2.16.0" pre-commit-hooks = ">=4.1.0" +pydoclint = "^0.4.1" pytest = ">=6.2.5" ruff = ">=0.4.6" safety = ">=1.10.3" @@ -35,7 +35,6 @@ sphinx-autobuild = ">=2021.3.14" sphinx-click = ">=3.0.2" typeguard = ">=2.13.3" xdoctest = { extras = ["colors"], version = ">=0.15.10" } -myst-parser = { version = ">=0.16.1" } [tool.poetry.scripts] retrocookie-hypermodern-python = "retrocookie.__main__:main" @@ -106,6 +105,11 @@ extend-ignore = [ [tool.ruff.lint.pydocstyle] convention = "google" +[tool.pydoclint] +style = 'google' +exclude = '\.git|\.nox' +arg-type-hints-in-docstring = false + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"