From 937d3ca7faea460ed25b9e473f97d6a6e0674ea9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 03:55:55 +0200 Subject: [PATCH] DX!: switch to Ruff as linter (#189) * MAINT!: drop Python 3.6 support * MAINT: implement updates from pre-commit hooks * MAINT: update pip constraints and pre-commit * MAINT: upgrade to Jupyter Lab v4 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: GitHub Co-authored-by: Remco de Boer <29308176+redeboer@users.noreply.github.com> --- .constraints/py3.10.txt | 91 ++++----- .constraints/py3.11.txt | 89 ++++----- .constraints/py3.6.txt | 193 -------------------- .constraints/py3.7.txt | 70 ++++--- .constraints/py3.8.txt | 91 ++++----- .constraints/py3.9.txt | 91 ++++----- .cspell.json | 5 - .flake8 | 34 ---- .gitpod.yml | 6 +- .mypy.ini | 19 -- .pre-commit-config.yaml | 57 ++---- .pydocstyle | 11 -- .pylintrc | 26 --- .vscode/extensions.json | 13 +- .vscode/settings.json | 15 +- README.md | 2 +- codecov.yml | 2 +- docs/conf.py | 22 +-- docs/software/project-inventory-schema.json | 128 +++++++------ pyproject.toml | 163 ++++++++++++++++- pyrightconfig.json | 33 ---- pytest.ini | 17 -- setup.cfg | 36 +--- setup.py | 1 - src/pwa_pages/project_inventory.py | 27 +-- src/pwa_pages/repo/_github.py | 24 ++- src/pwa_pages/repo/_gitlab.py | 6 +- tests/.pydocstyle | 4 - tests/repo/test_gitlab.py | 1 - tests/test_project_inventory.py | 13 +- 30 files changed, 488 insertions(+), 802 deletions(-) delete mode 100644 .constraints/py3.6.txt delete mode 100644 .flake8 delete mode 100644 .mypy.ini delete mode 100644 .pydocstyle delete mode 100644 .pylintrc delete mode 100644 pyrightconfig.json delete mode 100644 pytest.ini delete mode 100644 tests/.pydocstyle diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index d504e88f..bc2ed096 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -5,14 +5,12 @@ # pip-compile --extra=dev --no-annotate --output-file=.constraints/py3.10.txt --strip-extras setup.py # accessible-pygments==0.0.4 -aiofiles==22.1.0 -aiosqlite==0.19.0 alabaster==0.7.13 -anyio==3.7.0 +annotated-types==0.5.0 +anyio==3.7.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 -astroid==2.15.5 asttokens==2.2.1 async-lru==2.0.2 attrs==23.1.0 @@ -27,38 +25,27 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 colorama==0.4.6 comm==0.1.3 contourpy==1.1.0 coverage==7.2.7 cryptography==41.0.1 cycler==0.11.0 -dataproperty==0.55.1 +dataproperty==1.0.0 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 deprecated==1.2.14 -dill==0.3.6 distlib==0.3.6 docutils==0.19 dominate==2.8.0 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 executing==1.2.0 fastjsonschema==2.17.1 feynman==2.0.2 filelock==3.12.2 -flake8==6.0.0 ; python_version >= "3.8.0" -flake8-blind-except==0.2.1 ; python_version >= "3.8.0" -flake8-bugbear==23.6.5 ; python_version >= "3.8.0" -flake8-builtins==2.1.0 ; python_version >= "3.8.0" -flake8-comprehensions==3.13.0 ; python_version >= "3.8.0" -flake8-plugin-utils==1.3.2 -flake8-pytest-style==1.7.2 ; python_version >= "3.8.0" -flake8-rst-docstrings==0.3.0 ; python_version >= "3.8.0" -flake8-type-ignore==0.1.0.post2 ; python_version >= "3.8.0" -flake8-use-fstring==1.4 ; python_version >= "3.8.0" fonttools==4.40.0 fqdn==1.5.1 greenlet==2.0.2 @@ -67,47 +54,45 @@ idna==3.4 imagesize==1.4.1 importlib-metadata==6.7.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipython==8.14.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-console==6.6.3 jupyter-core==5.3.1 jupyter-events==0.6.3 jupyter-lsp==2.2.0 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-terminals==0.4.4 jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 ; python_version >= "3.7.0" +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 +jupyterlab-widgets==3.0.8 kiwisolver==1.4.4 latexcodec==2.0.1 -lazy-object-proxy==1.9.0 livereload==2.6.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mbstrdecoder==1.1.3 -mccabe==0.7.0 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.1 mpmath==1.3.0 -mypy==1.4.0 +mypy==1.4.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 @@ -125,37 +110,32 @@ packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 pathspec==0.11.1 -pathvalidate==2.5.2 -pep8-naming==0.13.3 ; python_version >= "3.8.0" +pathvalidate==3.0.0 pexpect==4.8.0 pickleshare==0.7.5 -pillow==9.5.0 -platformdirs==3.7.0 +pillow==10.0.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 pybtex==0.24.0 pybtex-docutils==1.0.2 -pycodestyle==2.10.0 pycparser==2.21 -pydantic==1.10.9 +pydantic==2.0.2 +pydantic-core==2.1.2 pydata-sphinx-theme==0.13.3 -pydocstyle==6.3.0 -pyflakes==3.0.1 -pygithub==1.58.2 +pygithub==1.59.0 pygments==2.15.1 pyjwt==2.7.0 -pylint==2.17.4 pynacl==1.5.0 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 -pytablewriter==0.64.2 -pytest==7.3.2 +pyparsing==3.0.9 +pyproject-api==1.5.3 +pytablewriter==1.0.0 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-dateutil==2.8.2 @@ -166,11 +146,13 @@ pyyaml==6.0 pyzmq==25.1.0 qtconsole==5.4.3 qtpy==2.3.1 +referencing==0.29.1 requests==2.31.0 requests-toolbelt==1.0.0 -restructuredtext-lint==1.4.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 +ruff==0.0.277 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 @@ -193,7 +175,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabledata==1.3.1 @@ -202,29 +184,26 @@ tcolorpy==0.1.3 terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 -tomlkit==0.11.8 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 traitlets==5.9.0 typepy==1.3.1 types-docutils==0.20.0.1 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.13 types-pyyaml==6.0.12.10 -types-setuptools==68.0.0.0 -typing-extensions==4.6.3 +types-setuptools==68.0.0.1 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==2.0.3 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 wheel==0.40.0 -widgetsnbextension==4.0.7 +widgetsnbextension==4.0.8 wrapt==1.15.0 -y-py==0.5.9 -ypy-websocket==0.8.2 ; python_version >= "3.7.0" zipp==3.15.0 # The following packages are considered to be unsafe in a requirements file: diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 3df6b8e1..1e4c37d9 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -5,14 +5,12 @@ # pip-compile --extra=dev --no-annotate --output-file=.constraints/py3.11.txt --strip-extras setup.py # accessible-pygments==0.0.4 -aiofiles==22.1.0 -aiosqlite==0.19.0 alabaster==0.7.13 -anyio==3.7.0 +annotated-types==0.5.0 +anyio==3.7.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 -astroid==2.15.5 asttokens==2.2.1 async-lru==2.0.2 attrs==23.1.0 @@ -27,19 +25,18 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 colorama==0.4.6 comm==0.1.3 contourpy==1.1.0 coverage==7.2.7 cryptography==41.0.1 cycler==0.11.0 -dataproperty==0.55.1 +dataproperty==1.0.0 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 deprecated==1.2.14 -dill==0.3.6 distlib==0.3.6 docutils==0.19 dominate==2.8.0 @@ -48,16 +45,6 @@ executing==1.2.0 fastjsonschema==2.17.1 feynman==2.0.2 filelock==3.12.2 -flake8==6.0.0 ; python_version >= "3.8.0" -flake8-blind-except==0.2.1 ; python_version >= "3.8.0" -flake8-bugbear==23.6.5 ; python_version >= "3.8.0" -flake8-builtins==2.1.0 ; python_version >= "3.8.0" -flake8-comprehensions==3.13.0 ; python_version >= "3.8.0" -flake8-plugin-utils==1.3.2 -flake8-pytest-style==1.7.2 ; python_version >= "3.8.0" -flake8-rst-docstrings==0.3.0 ; python_version >= "3.8.0" -flake8-type-ignore==0.1.0.post2 ; python_version >= "3.8.0" -flake8-use-fstring==1.4 ; python_version >= "3.8.0" fonttools==4.40.0 fqdn==1.5.1 greenlet==2.0.2 @@ -66,47 +53,45 @@ idna==3.4 imagesize==1.4.1 importlib-metadata==6.7.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipython==8.14.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-console==6.6.3 jupyter-core==5.3.1 jupyter-events==0.6.3 jupyter-lsp==2.2.0 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-terminals==0.4.4 jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 ; python_version >= "3.7.0" +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 +jupyterlab-widgets==3.0.8 kiwisolver==1.4.4 latexcodec==2.0.1 -lazy-object-proxy==1.9.0 livereload==2.6.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mbstrdecoder==1.1.3 -mccabe==0.7.0 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.1 mpmath==1.3.0 -mypy==1.4.0 +mypy==1.4.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 @@ -124,37 +109,32 @@ packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 pathspec==0.11.1 -pathvalidate==2.5.2 -pep8-naming==0.13.3 ; python_version >= "3.8.0" +pathvalidate==3.0.0 pexpect==4.8.0 pickleshare==0.7.5 -pillow==9.5.0 -platformdirs==3.7.0 +pillow==10.0.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 pybtex==0.24.0 pybtex-docutils==1.0.2 -pycodestyle==2.10.0 pycparser==2.21 -pydantic==1.10.9 +pydantic==2.0.2 +pydantic-core==2.1.2 pydata-sphinx-theme==0.13.3 -pydocstyle==6.3.0 -pyflakes==3.0.1 -pygithub==1.58.2 +pygithub==1.59.0 pygments==2.15.1 pyjwt==2.7.0 -pylint==2.17.4 pynacl==1.5.0 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 -pytablewriter==0.64.2 -pytest==7.3.2 +pyparsing==3.0.9 +pyproject-api==1.5.3 +pytablewriter==1.0.0 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-dateutil==2.8.2 @@ -165,11 +145,13 @@ pyyaml==6.0 pyzmq==25.1.0 qtconsole==5.4.3 qtpy==2.3.1 +referencing==0.29.1 requests==2.31.0 requests-toolbelt==1.0.0 -restructuredtext-lint==1.4.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 +ruff==0.0.277 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 @@ -192,7 +174,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabledata==1.3.1 @@ -200,29 +182,26 @@ tabulate==0.9.0 tcolorpy==0.1.3 terminado==0.17.1 tinycss2==1.2.1 -tomlkit==0.11.8 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 traitlets==5.9.0 typepy==1.3.1 types-docutils==0.20.0.1 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.13 types-pyyaml==6.0.12.10 -types-setuptools==68.0.0.0 -typing-extensions==4.6.3 +types-setuptools==68.0.0.1 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==2.0.3 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 wheel==0.40.0 -widgetsnbextension==4.0.7 +widgetsnbextension==4.0.8 wrapt==1.15.0 -y-py==0.5.9 -ypy-websocket==0.8.2 ; python_version >= "3.7.0" zipp==3.15.0 # The following packages are considered to be unsafe in a requirements file: diff --git a/.constraints/py3.6.txt b/.constraints/py3.6.txt deleted file mode 100644 index 06b815c3..00000000 --- a/.constraints/py3.6.txt +++ /dev/null @@ -1,193 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.6 -# To update, run: -# -# pip-compile --extra=dev --no-annotate --output-file=.constraints/py3.6.txt --strip-extras setup.py -# -alabaster==0.7.13 -anyio==3.6.2 -argon2-cffi==21.3.0 -argon2-cffi-bindings==21.2.0 -astroid==2.11.7 -async-generator==1.10 -attrs==21.4.0 -babel==2.11.0 -backcall==0.2.0 -beautifulsoup4==4.12.2 -black==22.8.0 -bleach==4.1.0 -certifi==2023.5.7 -cffi==1.15.1 -cfgv==3.3.1 -chardet==5.0.0 -charset-normalizer==2.0.12 -click==8.0.4 -colorama==0.4.5 -contextvars==2.4 -coverage==6.2 -cycler==0.11.0 -dataclasses==0.8 ; python_version < "3.7" -dataproperty==0.55.1 -decorator==5.1.1 -defusedxml==0.7.1 -deprecated==1.2.14 -dill==0.3.4 -distlib==0.3.6 -docutils==0.16 -dominate==2.8.0 -entrypoints==0.4 -execnet==1.9.0 -feynman==2.0.2 -filelock==3.4.1 -gitdb==4.0.9 -gitpython==3.1.18 -greenlet==2.0.2 -identify==2.4.4 -idna==3.4 -imagesize==1.4.1 -immutables==0.19 -importlib-metadata==4.8.3 ; python_version < "3.8.0" -importlib-resources==3.0.0 -iniconfig==1.1.1 -ipykernel==5.5.6 -ipython==7.16.3 -ipython-genutils==0.2.0 -ipywidgets==7.7.5 -isort==5.10.1 -jedi==0.17.2 -jinja2==3.0.3 -json5==0.9.14 -jsonschema==3.2.0 -jupyter==1.0.0 -jupyter-cache==0.4.3 -jupyter-client==7.1.2 -jupyter-console==6.4.3 -jupyter-core==4.9.2 -jupyter-server==1.13.1 -jupyter-server-mathjax==0.2.3 -jupyter-sphinx==0.3.2 -jupyterlab==3.2.9 -jupyterlab-code-formatter==1.6.1 -jupyterlab-pygments==0.1.2 -jupyterlab-server==2.10.3 -jupyterlab-widgets==1.1.4 -kiwisolver==1.3.1 -latexcodec==2.0.1 -lazy-object-proxy==1.7.1 -livereload==2.6.3 -markdown-it-py==1.1.0 -markupsafe==2.0.1 -matplotlib==3.3.4 -mbstrdecoder==1.1.1 -mccabe==0.7.0 -mdit-py-plugins==0.2.8 -mistune==0.8.4 -mpmath==1.3.0 -mypy==0.971 -mypy-extensions==1.0.0 -myst-nb==0.13.2 -myst-parser==0.15.2 -nbclassic==0.3.5 -nbclient==0.5.9 -nbconvert==6.0.7 -nbdime==3.2.1 -nbformat==5.1.3 -nest-asyncio==1.5.6 -nodeenv==1.6.0 -notebook==6.4.10 -numpy==1.19.5 -packaging==21.3 -pandocfilters==1.5.0 -parso==0.7.1 -pathspec==0.9.0 -pathvalidate==2.5.2 -pexpect==4.8.0 -pickleshare==0.7.5 -pillow==8.4.0 -platformdirs==2.4.0 -pluggy==1.0.0 -pre-commit==2.17.0 -prometheus-client==0.17.0 -prompt-toolkit==3.0.36 -ptyprocess==0.7.0 -py==1.11.0 -pybtex==0.24.0 -pybtex-docutils==1.0.2 -pycparser==2.21 -pydantic==1.9.2 -pydata-sphinx-theme==0.7.2 -pydocstyle==6.3.0 -pygithub==1.56 -pygments==2.14.0 -pyjwt==2.4.0 -pylint==2.13.9 -pynacl==1.5.0 -pyparsing==3.1.0 -pyrsistent==0.18.0 -pytablewriter==0.64.2 -pytest==7.0.1 -pytest-cov==4.0.0 -pytest-xdist==3.0.2 -python-dateutil==2.8.2 -python-gitlab==2.10.1 -pytz==2023.3 -pyyaml==6.0 -pyzmq==25.1.0 -qtconsole==5.2.2 -qtpy==2.0.1 -requests==2.27.1 -requests-toolbelt==1.0.0 -send2trash==1.8.2 -six==1.16.0 -smmap==5.0.0 -sniffio==1.2.0 -snowballstemmer==2.2.0 -soupsieve==2.3.2.post1 -sphinx==4.3.2 ; python_version < "3.8.0" -sphinx-autobuild==2021.3.14 -sphinx-book-theme==0.2.0 -sphinx-codeautolink==0.12.1 -sphinx-comments==0.0.3 -sphinx-copybutton==0.5.0 -sphinx-design==0.0.13 -sphinx-thebe==0.2.1 -sphinx-togglebutton==0.3.2 -sphinxcontrib-applehelp==1.0.2 -sphinxcontrib-bibtex==2.5.0 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-hep-pdgref==0.1.4 -sphinxcontrib-htmlhelp==2.0.0 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==1.4.48 -sympy==1.9 -tabledata==1.3.1 -tcolorpy==0.1.2 -terminado==0.12.1 -testpath==0.6.0 -toml==0.10.2 -tomli==1.2.3 -tornado==6.1 -tox==3.28.0 ; python_version < "3.8.0" -traitlets==4.3.3 -typed-ast==1.5.4 -typepy==1.3.0 -types-docutils==0.20.0.1 -types-pkg-resources==0.1.3 -types-python-dateutil==2.8.19.13 -types-pyyaml==6.0.12.10 -types-setuptools==68.0.0.0 -typing-extensions==4.1.1 -urllib3==1.26.16 -virtualenv==20.15.1 ; python_version < "3.8.0" -wcwidth==0.2.6 -webencodings==0.5.1 -websocket-client==1.3.1 -wheel==0.37.1 -widgetsnbextension==3.6.4 -wrapt==1.15.0 -zipp==3.6.0 - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt index 1b45bb27..eec00a7f 100644 --- a/.constraints/py3.7.txt +++ b/.constraints/py3.7.txt @@ -8,11 +8,11 @@ accessible-pygments==0.0.4 aiofiles==22.1.0 aiosqlite==0.19.0 alabaster==0.7.13 -anyio==3.7.0 +annotated-types==0.5.0 +anyio==3.7.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 -astroid==2.15.5 attrs==23.1.0 babel==2.12.1 backcall==0.2.0 @@ -20,27 +20,27 @@ beautifulsoup4==4.12.2 black==23.3.0 bleach==6.0.0 cached-property==1.5.2 +cachetools==5.3.1 certifi==2023.5.7 cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 colorama==0.4.6 coverage==7.2.7 cryptography==41.0.1 cycler==0.11.0 -dataproperty==0.55.1 +dataproperty==1.0.0 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 deprecated==1.2.14 -dill==0.3.6 distlib==0.3.6 -docutils==0.17.1 +docutils==0.19 dominate==2.8.0 entrypoints==0.4 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 fastjsonschema==2.17.1 feynman==2.0.2 @@ -51,15 +51,14 @@ greenlet==2.0.2 identify==2.5.24 idna==3.4 imagesize==1.4.1 -importlib-metadata==4.13.0 ; python_version < "3.8.0" +importlib-metadata==6.7.0 ; python_version < "3.8.0" importlib-resources==5.12.0 iniconfig==2.0.0 ipykernel==6.16.2 ipython==7.34.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.11.5 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 @@ -75,27 +74,25 @@ jupyter-server==1.24.0 jupyter-server-fileid==0.9.0 jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 -jupyterlab==3.6.4 +jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 ; python_version >= "3.7.0" +jupyterlab-myst==1.2.0 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 +jupyterlab-widgets==3.0.8 kiwisolver==1.4.4 latexcodec==2.0.1 -lazy-object-proxy==1.9.0 livereload==2.6.3 markdown-it-py==2.2.0 markupsafe==2.1.3 matplotlib==3.5.3 matplotlib-inline==0.1.6 mbstrdecoder==1.1.3 -mccabe==0.7.0 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.1 mpmath==1.3.0 -mypy==1.4.0 +mypy==1.4.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 @@ -112,34 +109,33 @@ packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 pathspec==0.11.1 -pathvalidate==2.5.2 +pathvalidate==3.0.0 pexpect==4.8.0 pickleshare==0.7.5 pillow==9.5.0 pkgutil-resolve-name==1.3.10 -platformdirs==3.7.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==2.21.0 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 psutil==5.9.5 ptyprocess==0.7.0 -py==1.11.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.9 +pydantic==2.0.2 +pydantic-core==2.1.2 pydata-sphinx-theme==0.13.3 -pydocstyle==6.3.0 -pygithub==1.58.2 +pygithub==1.59.0 pygments==2.15.1 pyjwt==2.7.0 -pylint==2.17.4 pynacl==1.5.0 pyparsing==3.1.0 +pyproject-api==1.5.3 pyrsistent==0.19.3 -pytablewriter==0.64.2 -pytest==7.3.2 +pytablewriter==1.0.0 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-dateutil==2.8.2 @@ -154,12 +150,13 @@ requests==2.31.0 requests-toolbelt==1.0.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +ruff==0.0.277 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.4.1 -sphinx==4.3.2 ; python_version < "3.8.0" +sphinx==5.3.0 sphinx-autobuild==2021.3.14 sphinx-book-theme==1.0.1 sphinx-codeautolink==0.15.0 @@ -176,7 +173,7 @@ sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==1.4.48 +sqlalchemy==1.4.49 sympy==1.10.1 tabledata==1.3.1 tabulate==0.9.0 @@ -184,30 +181,29 @@ tcolorpy==0.1.3 terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 -tomlkit==0.11.8 tornado==6.2 -tox==3.28.0 ; python_version < "3.8.0" +tox==4.6.4 traitlets==5.9.0 -typed-ast==1.5.4 +typed-ast==1.5.5 typepy==1.3.1 types-docutils==0.20.0.1 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.13 types-pyyaml==6.0.12.10 -types-setuptools==68.0.0.0 -typing-extensions==4.6.3 +types-setuptools==68.0.0.1 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==2.0.3 -virtualenv==20.21.1 ; python_version < "3.8.0" +virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 wheel==0.40.0 -widgetsnbextension==4.0.7 +widgetsnbextension==4.0.8 wrapt==1.15.0 y-py==0.5.9 -ypy-websocket==0.8.2 ; python_version >= "3.7.0" +ypy-websocket==0.8.2 ; python_version < "3.8.0" zipp==3.15.0 # The following packages are considered to be unsafe in a requirements file: diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index 6b179fd1..7a4801fc 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -5,14 +5,12 @@ # pip-compile --extra=dev --no-annotate --output-file=.constraints/py3.8.txt --strip-extras setup.py # accessible-pygments==0.0.4 -aiofiles==22.1.0 -aiosqlite==0.19.0 alabaster==0.7.13 -anyio==3.7.0 +annotated-types==0.5.0 +anyio==3.7.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 -astroid==2.15.5 asttokens==2.2.1 async-lru==2.0.2 attrs==23.1.0 @@ -27,38 +25,27 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 colorama==0.4.6 comm==0.1.3 contourpy==1.1.0 coverage==7.2.7 cryptography==41.0.1 cycler==0.11.0 -dataproperty==0.55.1 +dataproperty==1.0.0 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 deprecated==1.2.14 -dill==0.3.6 distlib==0.3.6 docutils==0.19 dominate==2.8.0 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 executing==1.2.0 fastjsonschema==2.17.1 feynman==2.0.2 filelock==3.12.2 -flake8==6.0.0 ; python_version >= "3.8.0" -flake8-blind-except==0.2.1 ; python_version >= "3.8.0" -flake8-bugbear==23.6.5 ; python_version >= "3.8.0" -flake8-builtins==2.1.0 ; python_version >= "3.8.0" -flake8-comprehensions==3.13.0 ; python_version >= "3.8.0" -flake8-plugin-utils==1.3.2 -flake8-pytest-style==1.7.2 ; python_version >= "3.8.0" -flake8-rst-docstrings==0.3.0 ; python_version >= "3.8.0" -flake8-type-ignore==0.1.0.post2 ; python_version >= "3.8.0" -flake8-use-fstring==1.4 ; python_version >= "3.8.0" fonttools==4.40.0 fqdn==1.5.1 greenlet==2.0.2 @@ -68,47 +55,45 @@ imagesize==1.4.1 importlib-metadata==6.7.0 importlib-resources==5.12.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipython==8.12.2 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-console==6.6.3 jupyter-core==5.3.1 jupyter-events==0.6.3 jupyter-lsp==2.2.0 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-terminals==0.4.4 jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 ; python_version >= "3.7.0" +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 +jupyterlab-widgets==3.0.8 kiwisolver==1.4.4 latexcodec==2.0.1 -lazy-object-proxy==1.9.0 livereload==2.6.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mbstrdecoder==1.1.3 -mccabe==0.7.0 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.1 mpmath==1.3.0 -mypy==1.4.0 +mypy==1.4.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 @@ -126,38 +111,33 @@ packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 pathspec==0.11.1 -pathvalidate==2.5.2 -pep8-naming==0.13.3 ; python_version >= "3.8.0" +pathvalidate==3.0.0 pexpect==4.8.0 pickleshare==0.7.5 -pillow==9.5.0 +pillow==10.0.0 pkgutil-resolve-name==1.3.10 -platformdirs==3.7.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 pybtex==0.24.0 pybtex-docutils==1.0.2 -pycodestyle==2.10.0 pycparser==2.21 -pydantic==1.10.9 +pydantic==2.0.2 +pydantic-core==2.1.2 pydata-sphinx-theme==0.13.3 -pydocstyle==6.3.0 -pyflakes==3.0.1 -pygithub==1.58.2 +pygithub==1.59.0 pygments==2.15.1 pyjwt==2.7.0 -pylint==2.17.4 pynacl==1.5.0 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 -pytablewriter==0.64.2 -pytest==7.3.2 +pyparsing==3.0.9 +pyproject-api==1.5.3 +pytablewriter==1.0.0 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-dateutil==2.8.2 @@ -168,11 +148,13 @@ pyyaml==6.0 pyzmq==25.1.0 qtconsole==5.4.3 qtpy==2.3.1 +referencing==0.29.1 requests==2.31.0 requests-toolbelt==1.0.0 -restructuredtext-lint==1.4.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 +ruff==0.0.277 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 @@ -195,7 +177,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabledata==1.3.1 @@ -204,29 +186,26 @@ tcolorpy==0.1.3 terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 -tomlkit==0.11.8 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 traitlets==5.9.0 typepy==1.3.1 types-docutils==0.20.0.1 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.13 types-pyyaml==6.0.12.10 -types-setuptools==68.0.0.0 -typing-extensions==4.6.3 +types-setuptools==68.0.0.1 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==2.0.3 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 wheel==0.40.0 -widgetsnbextension==4.0.7 +widgetsnbextension==4.0.8 wrapt==1.15.0 -y-py==0.5.9 -ypy-websocket==0.8.2 ; python_version >= "3.7.0" zipp==3.15.0 # The following packages are considered to be unsafe in a requirements file: diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index 8e09d584..7166edbb 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -5,14 +5,12 @@ # pip-compile --extra=dev --no-annotate --output-file=.constraints/py3.9.txt --strip-extras setup.py # accessible-pygments==0.0.4 -aiofiles==22.1.0 -aiosqlite==0.19.0 alabaster==0.7.13 -anyio==3.7.0 +annotated-types==0.5.0 +anyio==3.7.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 -astroid==2.15.5 asttokens==2.2.1 async-lru==2.0.2 attrs==23.1.0 @@ -27,38 +25,27 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 colorama==0.4.6 comm==0.1.3 contourpy==1.1.0 coverage==7.2.7 cryptography==41.0.1 cycler==0.11.0 -dataproperty==0.55.1 +dataproperty==1.0.0 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 deprecated==1.2.14 -dill==0.3.6 distlib==0.3.6 docutils==0.19 dominate==2.8.0 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 executing==1.2.0 fastjsonschema==2.17.1 feynman==2.0.2 filelock==3.12.2 -flake8==6.0.0 ; python_version >= "3.8.0" -flake8-blind-except==0.2.1 ; python_version >= "3.8.0" -flake8-bugbear==23.6.5 ; python_version >= "3.8.0" -flake8-builtins==2.1.0 ; python_version >= "3.8.0" -flake8-comprehensions==3.13.0 ; python_version >= "3.8.0" -flake8-plugin-utils==1.3.2 -flake8-pytest-style==1.7.2 ; python_version >= "3.8.0" -flake8-rst-docstrings==0.3.0 ; python_version >= "3.8.0" -flake8-type-ignore==0.1.0.post2 ; python_version >= "3.8.0" -flake8-use-fstring==1.4 ; python_version >= "3.8.0" fonttools==4.40.0 fqdn==1.5.1 greenlet==2.0.2 @@ -68,47 +55,45 @@ imagesize==1.4.1 importlib-metadata==6.7.0 importlib-resources==5.12.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipython==8.14.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-console==6.6.3 jupyter-core==5.3.1 jupyter-events==0.6.3 jupyter-lsp==2.2.0 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-terminals==0.4.4 jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 ; python_version >= "3.7.0" +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 +jupyterlab-widgets==3.0.8 kiwisolver==1.4.4 latexcodec==2.0.1 -lazy-object-proxy==1.9.0 livereload==2.6.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mbstrdecoder==1.1.3 -mccabe==0.7.0 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.1 mpmath==1.3.0 -mypy==1.4.0 +mypy==1.4.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 @@ -126,37 +111,32 @@ packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 pathspec==0.11.1 -pathvalidate==2.5.2 -pep8-naming==0.13.3 ; python_version >= "3.8.0" +pathvalidate==3.0.0 pexpect==4.8.0 pickleshare==0.7.5 -pillow==9.5.0 -platformdirs==3.7.0 +pillow==10.0.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 pybtex==0.24.0 pybtex-docutils==1.0.2 -pycodestyle==2.10.0 pycparser==2.21 -pydantic==1.10.9 +pydantic==2.0.2 +pydantic-core==2.1.2 pydata-sphinx-theme==0.13.3 -pydocstyle==6.3.0 -pyflakes==3.0.1 -pygithub==1.58.2 +pygithub==1.59.0 pygments==2.15.1 pyjwt==2.7.0 -pylint==2.17.4 pynacl==1.5.0 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 -pytablewriter==0.64.2 -pytest==7.3.2 +pyparsing==3.0.9 +pyproject-api==1.5.3 +pytablewriter==1.0.0 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-dateutil==2.8.2 @@ -167,11 +147,13 @@ pyyaml==6.0 pyzmq==25.1.0 qtconsole==5.4.3 qtpy==2.3.1 +referencing==0.29.1 requests==2.31.0 requests-toolbelt==1.0.0 -restructuredtext-lint==1.4.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 +ruff==0.0.277 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 @@ -194,7 +176,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabledata==1.3.1 @@ -203,29 +185,26 @@ tcolorpy==0.1.3 terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 -tomlkit==0.11.8 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 traitlets==5.9.0 typepy==1.3.1 types-docutils==0.20.0.1 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.13 types-pyyaml==6.0.12.10 -types-setuptools==68.0.0.0 -typing-extensions==4.6.3 +types-setuptools==68.0.0.1 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==2.0.3 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 wheel==0.40.0 -widgetsnbextension==4.0.7 +widgetsnbextension==4.0.8 wrapt==1.15.0 -y-py==0.5.9 -ypy-websocket==0.8.2 ; python_version >= "3.7.0" zipp==3.15.0 # The following packages are considered to be unsafe in a requirements file: diff --git a/.cspell.json b/.cspell.json index 70b611eb..e2717015 100644 --- a/.cspell.json +++ b/.cspell.json @@ -24,14 +24,11 @@ "*particle*.*ml", ".constraints/*.txt", ".editorconfig", - ".flake8*", ".gitignore", ".gitpod.*", ".mypy.ini", ".pre-commit-config.yaml", ".prettierignore", - ".pydocstyle*", - ".pylintrc", ".readthedocs.yml", ".vscode/*", ".vscode/.gitignore", @@ -84,7 +81,6 @@ "mypy", "numpy", "pseudoscalar", - "pylint", "PYTHONHASHSEED", "qrules", "sympy", @@ -143,7 +139,6 @@ "propto", "pycompwa", "pydantic", - "pydocstyle", "pygments", "pypi", "pyplot", diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 0474d25d..00000000 --- a/.flake8 +++ /dev/null @@ -1,34 +0,0 @@ -[flake8] -application-import-names = - pwa_pages -filename = - ./docs/*.py - ./src/*.py - ./tests/*.py -exclude = - **/__pycache__ - **/_build - /typings/** -ignore = - # https://github.com/psf/black#slices - E203 - # allowed by black - E231 - # already covered by black - E302 - # https://github.com/psf/black#line-length - E501 - # should be possible to use {} in latex strings - FS003 - # block quote ends without a blank line (black formatting) - RST201 - # missing pygments - RST299 - # unexpected indentation (related to google style docstring) - RST301 - # enforce type ignore with mypy error codes (combined --extend-select=TI100) - TI1 - # https://github.com/psf/black#line-breaks--binary-operators - W503 -extend-select = - TI100 diff --git a/.gitpod.yml b/.gitpod.yml index fec23f2a..153517d2 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -13,17 +13,17 @@ github: vscode: extensions: + - charliermarsh.ruff - christian-kohler.path-intellisense - davidanson.vscode-markdownlint - eamodio.gitlens - editorconfig.editorconfig - esbenp.prettier-vscode - executablebookproject.myst-highlight + - garaioag.garaio-vscode-unwanted-recommendations - github.vscode-github-actions - github.vscode-pull-request-github - - ms-python.flake8 - - ms-python.isort - - ms-python.pylint + - ms-python.mypy-type-checker - ms-python.python - ms-python.vscode-pylance - ms-vscode.live-server diff --git a/.mypy.ini b/.mypy.ini deleted file mode 100644 index 39df5b53..00000000 --- a/.mypy.ini +++ /dev/null @@ -1,19 +0,0 @@ -[mypy] -disallow_incomplete_defs = True -disallow_untyped_defs = True -exclude = _build -show_error_codes = True -warn_unused_configs = True - -[mypy-tests.*] -check_untyped_defs = True -disallow_incomplete_defs = False -disallow_untyped_defs = False - -; External packages that miss stubs or type hints -[mypy-pybtex.*] -ignore_missing_imports = True -[mypy-sphinx.*] -ignore_missing_imports = True -[mypy-sphinxcontrib.bibtex.*] -ignore_missing_imports = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6be16da9..68ca368f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,9 +2,7 @@ ci: autoupdate_commit_msg: "MAINT: update pip constraints and pre-commit" autoupdate_schedule: quarterly # already done by requirements-cron.yml skip: - - flake8 - mypy - - pylint - pyright - taplo - update-json-schema @@ -40,7 +38,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.182 + rev: 0.0.189 hooks: - id: check-dev-files args: @@ -58,11 +56,12 @@ repos: - id: nbqa-black additional_dependencies: - black>=22.1.0 - - id: nbqa-flake8 - - id: nbqa-isort - id: nbqa-pyupgrade args: - - --py36-plus + - --py37-plus + - id: nbqa-ruff + args: + - --fix - repo: https://github.com/psf/black rev: 23.3.0 @@ -100,20 +99,6 @@ repos: .*\.py )$ - - repo: local - hooks: - - id: flake8 - name: flake8 - entry: flake8 - language: system - types: - - python - - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.35.0 hooks: @@ -154,38 +139,28 @@ repos: metadata.vscode - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.9-for-vscode + rev: v3.0.0 hooks: - id: prettier - - repo: https://github.com/pycqa/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - - - repo: local - hooks: - - id: pylint - name: pylint - entry: pylint - args: - - --rcfile=.pylintrc - - --score=no - language: system - types: - - python - - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.315 + rev: v1.1.316 hooks: - id: pyright - repo: https://github.com/asottile/pyupgrade - rev: v3.7.0 + rev: v3.8.0 hooks: - id: pyupgrade args: - - --py36-plus + - --py37-plus + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.277 + hooks: + - id: ruff + args: + - --fix - repo: https://github.com/ComPWA/mirrors-taplo rev: v0.8.0 diff --git a/.pydocstyle b/.pydocstyle deleted file mode 100644 index 285e8c55..00000000 --- a/.pydocstyle +++ /dev/null @@ -1,11 +0,0 @@ -[pydocstyle] -convention = google -add_ignore = - D101, # class docstring - D102, # method docstring - D103, # function docstring - D105, # magic method docstring - D107, # init docstring - D203, # conflicts with D211 - D213, # multi-line docstring should start at the second line - D407, # missing dashed underline after section diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 6d9e61a5..00000000 --- a/.pylintrc +++ /dev/null @@ -1,26 +0,0 @@ -# To see other available options: -# pylint --generate-rcfile > .pylintrc_new -# and compare the output - -[MASTER] -ignore-patterns= - .*\.pyi - -[MESSAGES CONTROL] -disable= - duplicate-code, # https://github.com/PyCQA/pylint/issues/214 - import-error, # already handled by pyright - logging-fstring-interpolation, - missing-class-docstring, # pydocstyle - missing-function-docstring, # pydocstyle - missing-module-docstring, # pydocstyle - redefined-builtin, # flake8-built - too-few-public-methods, # data containers (attrs) and interface classes - unspecified-encoding, # http://pylint.pycqa.org/en/latest/whatsnew/2.10.html - unused-import, # https://www.flake8rules.com/rules/F401 - -[SIMILARITIES] -ignore-imports=yes # https://stackoverflow.com/a/30007053 - -[VARIABLES] -init-import=yes diff --git a/.vscode/extensions.json b/.vscode/extensions.json index acd2eae9..85a15a7b 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,16 +1,16 @@ { "recommendations": [ + "charliermarsh.ruff", "christian-kohler.path-intellisense", "davidanson.vscode-markdownlint", "eamodio.gitlens", "editorconfig.editorconfig", "esbenp.prettier-vscode", "executablebookproject.myst-highlight", + "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", "github.vscode-pull-request-github", - "ms-python.flake8", - "ms-python.isort", - "ms-python.pylint", + "ms-python.mypy-type-checker", "ms-python.python", "ms-python.vscode-pylance", "ms-vscode.live-server", @@ -22,5 +22,12 @@ "tamasfe.even-better-toml", "tyriar.sort-lines", "yzhang.markdown-all-in-one" + ], + "unwantedRecommendations": [ + "bungcip.better-toml", + "ms-python.flake8", + "ms-python.isort", + "ms-python.pylint", + "travisillig.vscode-json-stable-stringify" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index dcb4a13f..fda29aa4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,11 +23,11 @@ "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "cSpell.enabled": true, "coverage-gutters.coverageFileNames": ["coverage.xml"], "coverage-gutters.coverageReportFileName": "**/htmlcov/index.html", "coverage-gutters.showGutterCoverage": false, "coverage-gutters.showLineCoverage": true, + "cSpell.enabled": true, "editor.formatOnSave": true, "editor.rulers": [88], "files.watcherExclude": { @@ -36,24 +36,20 @@ "**/.git/**": true, "**/.tox/**": true }, - "flake8.importStrategy": "fromEnvironment", "git.rebaseWhenSync": true, "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], - "isort.check": true, - "isort.importStrategy": "fromEnvironment", "livePreview.defaultPreviewPath": "docs/_build/html", + "mypy-type-checker.importStrategy": "fromEnvironment", "myst.preview.extensions": ["amsmath", "colon_fence", "dollarmath", "tasklist"], - "pylint.importStrategy": "fromEnvironment", "python.analysis.autoImportCompletions": false, - "python.analysis.diagnosticMode": "workspace", "python.analysis.inlayHints.pytestParameters": true, "python.analysis.typeCheckingMode": "strict", "python.formatting.provider": "black", "python.linting.banditEnabled": false, "python.linting.enabled": true, "python.linting.flake8Enabled": false, - "python.linting.mypyEnabled": true, - "python.linting.pydocstyleEnabled": true, + "python.linting.mypyEnabled": false, + "python.linting.pydocstyleEnabled": false, "python.linting.pylamaEnabled": false, "python.linting.pylintEnabled": false, "python.testing.autoTestDiscoverOnSaveEnabled": false, @@ -66,9 +62,10 @@ "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, "rewrap.wrappingColumn": 88, + "ruff.enable": true, + "ruff.organizeImports": true, "search.exclude": { "**/tests/**/__init__.py": true, - "*/.pydocstyle": true, ".constraints/*.txt": true }, "yaml.schemas": { diff --git a/README.md b/README.md index c2eab054..b39a9f97 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) This repository contains the source code for the [pwa.rtfd.io](https://pwa.readthedocs.io) pages. diff --git a/codecov.yml b/codecov.yml index 46f182f6..5c94133c 100755 --- a/codecov.yml +++ b/codecov.yml @@ -10,7 +10,7 @@ coverage: project: default: # basic - target: 90% # can't go below this percentage + target: 85% # can't go below this percentage threshold: 1% # allow drops by this percentage base: auto # advanced diff --git a/docs/conf.py b/docs/conf.py index 6fc96659..2f4548cd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,11 +1,10 @@ -# pylint: disable=invalid-name,no-value-for-parameter -# pyright: reportMissingImports=false """Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html """ +# pyright: reportMissingImports=false import dataclasses import os @@ -200,7 +199,7 @@ def get_version(package_name: str) -> str: if not line: continue line_segments = tuple(line.split("==")) - if len(line_segments) != 2: + if len(line_segments) != 2: # noqa: PLR2004 continue _, installed_version, *_ = line_segments installed_version = installed_version.strip() @@ -219,9 +218,8 @@ def get_minor_version(package_name: str) -> str: return installed_version matches = re.match(r"^([0-9]+\.[0-9]+).*$", installed_version) if matches is None: - raise ValueError( - f"Could not find documentation for {package_name} v{installed_version}" - ) + msg = f"Could not find documentation for {package_name} v{installed_version}" + raise ValueError(msg) return matches[1] @@ -330,8 +328,7 @@ def setup(app: Sphinx) -> Dict[str, Any]: def wikilink(pattern: str) -> RoleFunction: - def role( - # pylint: disable=too-many-arguments,unused-argument + def role( # noqa: PLR0913 name: str, rawtext: str, text: str, @@ -375,9 +372,9 @@ def et_al(children, data, sep="", sep2=None, last_sep=None): # type: ignore[no- parts = [part for part in _format_list(children, data) if part] if len(parts) <= 1: return Text(*parts) - if len(parts) == 2: + if len(parts) == 2: # noqa: PLR2004 return Text(sep2).join(parts) - if len(parts) == 3: + if len(parts) == 3: # noqa: PLR2004 return Text(last_sep).join([Text(sep).join(parts[:-1]), parts[-1]]) return Text(parts[0], Tag("em", " et al")) @@ -389,8 +386,7 @@ def names(children, context, role, **kwargs): # type: ignore[no-untyped-def] try: persons = context["entry"].persons[role] except KeyError: - # pylint: disable=raise-missing-from - raise FieldIsMissing(role, context["entry"]) + raise FieldIsMissing(role, context["entry"]) from None style = context["style"] formatted_names = [ @@ -424,7 +420,7 @@ def format_url(self, e: Entry) -> Node: ] ] - def format_isbn(self, e: Entry) -> Node: # pylint: disable=unused-argument + def format_isbn(self, e: Entry) -> Node: return href[ join[ "https://isbnsearch.org/isbn/", diff --git a/docs/software/project-inventory-schema.json b/docs/software/project-inventory-schema.json index 7a5a15f9..16176be5 100644 --- a/docs/software/project-inventory-schema.json +++ b/docs/software/project-inventory-schema.json @@ -1,48 +1,6 @@ { - "title": "ProjectInventory", - "type": "object", - "properties": { - "projects": { - "title": "Projects", - "type": "array", - "items": { - "$ref": "#/definitions/Project" - } - }, - "collaborations": { - "title": "Collaborations", - "default": {}, - "type": "object", - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "projects" - ], - "definitions": { - "SubProject": { - "title": "SubProject", - "type": "object", - "properties": { - "name": { - "title": "Name", - "type": "string" - }, - "url": { - "title": "Url", - "type": "string" - } - }, - "required": [ - "name", - "url" - ] - }, + "$defs": { "Project": { - "title": "Project", - "type": "object", "properties": { "name": { "title": "Name", @@ -53,44 +11,98 @@ "type": "string" }, "collaboration": { - "title": "Collaboration", "anyOf": [ { - "type": "array", "items": { "type": "string" - } + }, + "type": "array" }, { "type": "string" + }, + { + "type": "null" } - ] + ], + "default": null, + "title": "Collaboration" }, "languages": { - "title": "Languages", "default": [], - "type": "array", "items": { "type": "string" - } + }, + "title": "Languages", + "type": "array" }, "sub_projects": { - "title": "Sub Projects", - "type": "array", - "items": { - "$ref": "#/definitions/SubProject" - } + "anyOf": [ + { + "items": { + "$ref": "#/$defs/SubProject" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sub Projects" }, "since": { - "title": "Since", "default": 0, + "title": "Since", "type": "integer" } }, "required": [ "name", "url" - ] + ], + "title": "Project", + "type": "object" + }, + "SubProject": { + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "url": { + "title": "Url", + "type": "string" + } + }, + "required": [ + "name", + "url" + ], + "title": "SubProject", + "type": "object" + } + }, + "properties": { + "projects": { + "items": { + "$ref": "#/$defs/Project" + }, + "title": "Projects", + "type": "array" + }, + "collaborations": { + "additionalProperties": { + "type": "string" + }, + "default": {}, + "title": "Collaborations", + "type": "object" } - } + }, + "required": [ + "projects" + ], + "title": "ProjectInventory", + "type": "object" } diff --git a/pyproject.toml b/pyproject.toml index 7fb73c51..8f9eceb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,37 +26,184 @@ preview = true target-version = [ "py310", "py311", - "py36", "py37", "py38", "py39", ] -[tool.isort] -profile = "black" +[tool.coverage.run] +branch = true +source = ["src"] + +[tool.mypy] +disallow_incomplete_defs = true +disallow_untyped_defs = true +exclude = "_build" +show_error_codes = true +warn_unused_configs = true + +[[tool.mypy.overrides]] +check_untyped_defs = true +disallow_incomplete_defs = false +disallow_untyped_defs = false +module = ["tests.*"] + +[[tool.mypy.overrides]] +ignore_missing_imports = true +module = ["pybtex.*"] + +[[tool.mypy.overrides]] +ignore_missing_imports = true +module = ["sphinx.*"] + +[[tool.mypy.overrides]] +ignore_missing_imports = true +module = ["sphinxcontrib.bibtex.*"] [tool.nbqa.addopts] black = [ "--line-length=85", ] -flake8 = [ - "--extend-ignore=E402,F821", +ruff = [ + "--extend-ignore=B018", + "--extend-ignore=C90", + "--extend-ignore=D", + "--extend-ignore=N806", + "--extend-ignore=N816", + "--extend-ignore=PLR09", + "--extend-ignore=PLR2004", + "--extend-ignore=PLW0602", + "--extend-ignore=PLW0603", + "--line-length=85", ] [tool.pyright] exclude = [ - ".git", - ".tox", - "docs/_build", + "**/.git", + "**/.ipynb_checkpoints", + "**/.mypy_cache", + "**/.pytest_cache", + "**/.tox", + "**/__pycache__", + "**/_build", ] include = [ "docs", "src", ] reportGeneralTypeIssues = false +reportIncompatibleMethodOverride = false +reportMissingParameterType = false +reportMissingTypeArgument = false +reportMissingTypeStubs = false +reportOverlappingOverload = false reportPrivateImportUsage = false +reportPrivateUsage = false reportUnboundVariable = false +reportUnknownArgumentType = false +reportUnknownMemberType = false +reportUnknownParameterType = false +reportUnknownVariableType = false +reportUnnecessaryComparison = false +reportUnnecessaryContains = false +reportUnnecessaryIsInstance = false +reportUntypedFunctionDecorator = false reportUnusedClass = true reportUnusedFunction = true reportUnusedImport = true reportUnusedVariable = true +typeCheckingMode = "strict" + +[tool.pytest.ini_options] +addopts = """ +--color=yes +--doctest-continue-on-failure +--doctest-modules +--durations=3 +--ignore=docs/conf.py""" +filterwarnings = [ + "error", + "ignore:Argument login_or_token is deprecated.*:DeprecationWarning", + "ignore:Exception ignored in.*:UserWarning", + "ignore:Pydantic V1 style `@root_validator` validators are deprecated.*:pydantic.warnings.PydanticDeprecatedSince20", +] +testpaths = [ + "src", + "tests", +] + +[tool.ruff] +extend-select = [ + "A", + "B", + "BLE", + "C4", + "C90", + "D", + "EM", + "ERA", + "FA", + "I", + "ICN", + "INP", + "ISC", + "N", + "NPY", + "PGH", + "PIE", + "PL", + "Q", + "RET", + "RSE", + "RUF", + "S", + "SIM", + "T20", + "TCH", + "TID", + "TRY", + "UP", + "YTT", +] +ignore = [ + "D101", + "D102", + "D103", + "D105", + "D107", + "D203", + "D213", + "D407", + "D416", + "E501", + "SIM108", +] +show-fixes = true +src = [ + "src", + "tests", +] +target-version = "py37" +task-tags = ["cspell"] + +[tool.ruff.per-file-ignores] +"docs/*" = [ + "E402", + "INP001", + "PLW2901", + "S101", + "S113", + "T201", +] +"setup.py" = ["D100"] +"tests/*" = [ + "D", + "INP001", + "PGH001", + "PLR0913", + "PLR2004", + "S101", +] + +[tool.ruff.pydocstyle] +convention = "google" diff --git a/pyrightconfig.json b/pyrightconfig.json deleted file mode 100644 index db06ae8a..00000000 --- a/pyrightconfig.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "exclude": [ - "**/__pycache__", - "**/_build", - "**/.git", - "**/.ipynb_checkpoints", - "**/.mypy_cache", - "**/.pytest_cache", - "**/.tox" - ], - "reportGeneralTypeIssues": false, - "reportIncompatibleMethodOverride": false, - "reportMissingParameterType": false, - "reportMissingTypeArgument": false, - "reportMissingTypeStubs": false, - "reportOverlappingOverload": false, - "reportPrivateImportUsage": false, - "reportPrivateUsage": false, - "reportUnboundVariable": false, - "reportUnknownArgumentType": false, - "reportUnknownMemberType": false, - "reportUnknownParameterType": false, - "reportUnknownVariableType": false, - "reportUnnecessaryComparison": false, - "reportUnnecessaryContains": false, - "reportUnnecessaryIsInstance": false, - "reportUntypedFunctionDecorator": false, - "reportUnusedClass": true, - "reportUnusedFunction": true, - "reportUnusedImport": true, - "reportUnusedVariable": true, - "typeCheckingMode": "strict" -} diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 3bd61ee2..00000000 --- a/pytest.ini +++ /dev/null @@ -1,17 +0,0 @@ -[coverage:run] -branch = True -source = src - -[pytest] -addopts = - --color=yes - --doctest-continue-on-failure - --doctest-modules - --durations=3 - --ignore=docs/conf.py -filterwarnings = - error - ignore:Exception ignored in.*:UserWarning -testpaths = - src - tests diff --git a/setup.cfg b/setup.cfg index afc1e3f3..4913a375 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,6 @@ classifiers = Natural Language :: English Operating System :: OS Independent Programming Language :: Python - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -40,7 +39,7 @@ classifiers = Typing :: Typed [options] -python_requires = >=3.6 +python_requires = >=3.7 setup_requires = setuptools_scm install_requires = @@ -57,7 +56,6 @@ package_dir = [options.extras_require] doc = - dataclasses; python_version <'3.7' feynman importlib-metadata; python_version <"3.8.0" ipywidgets @@ -66,7 +64,6 @@ doc = myst-nb >=0.11 # myst_enable_extensions numpy <1.24 # bug in feynman: https://github.com/ComPWA/PWA-pages/actions/runs/3868808372/jobs/6594501436#step:6:177 Sphinx >=3 - Sphinx <4.4; python_version <"3.8.0" # https://github.com/ComPWA/PWA-pages/runs/4998874049 sphinx-book-theme sphinx-codeautolink[ipython] sphinx-comments @@ -83,18 +80,6 @@ test = pytest-xdist format = black - isort -flake8 = - flake8 >=4; python_version >="3.8.0" # extend-select - flake8-blind-except; python_version >="3.8.0" - flake8-bugbear; python_version >="3.8.0" - flake8-builtins; python_version >="3.8.0" - flake8-comprehensions; python_version >="3.8.0" - flake8-pytest-style; python_version >="3.8.0" - flake8-rst-docstrings; python_version >="3.8.0" - flake8-type-ignore; python_version >="3.8.0" - flake8-use-fstring; python_version >="3.8.0" - pep8-naming; python_version >="3.8.0" mypy = mypy >=0.730 # error code support types-docutils @@ -103,29 +88,26 @@ mypy = types-PyYAML types-setuptools lint = - %(flake8)s %(mypy)s - pydocstyle - pylint >=2.5 # good-names-rgxs + ruff sty = %(format)s %(lint)s %(test)s # for pytest type hints pre-commit >=1.4.0 +jupyter = + %(doc)s + jupyterlab + jupyterlab-code-formatter + jupyterlab-myst + ypy-websocket <0.8.3; python_version <"3.8.0" dev = %(doc)s + %(jupyter)s %(sty)s %(test)s - jupyterlab - jupyterlab-code-formatter - jupyterlab-myst; python_version >="3.7.0" sphinx-autobuild tox >=1.9 # for skip_install, use_develop - tox <4; python_version <"3.8.0" - virtualenv !=20.16.*; python_version <"3.7.0" # https://github.com/ComPWA/PWA-pages/actions/runs/4359429611/jobs/7621215447#step:3:77 - virtualenv !=20.17.*; python_version <"3.7.0" # https://github.com/ComPWA/PWA-pages/actions/runs/4359429611/jobs/7621215447#step:3:77 - virtualenv <20.22.0; python_version <"3.8.0" # importlib-metadata conflict - ypy-websocket <0.8.3; python_version >="3.7.0" # https://github.com/ComPWA/PWA-pages/actions/runs/4350354169/jobs/7600981452#step:3:79 [options.entry_points] console_scripts = diff --git a/setup.py b/setup.py index 2e577037..93296978 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -# noqa: D100 from setuptools import setup setup( diff --git a/src/pwa_pages/project_inventory.py b/src/pwa_pages/project_inventory.py index da3027a7..71412506 100644 --- a/src/pwa_pages/project_inventory.py +++ b/src/pwa_pages/project_inventory.py @@ -1,8 +1,8 @@ -# cspell:ignore subproject -# pylint: disable=no-name-in-module, no-self-argument """Helper tools for writing tables.""" +# cspell:ignore subproject import argparse +import json import re from datetime import datetime from functools import partial @@ -29,7 +29,7 @@ def to_html_table( min_percentage: float = 2.5, hide_columns: Optional[Iterable[str]] = None, ) -> str: - header_to_formatters: Dict[str, Callable[[Project], str]] = { + header_to_formatters: Dict[str, Callable[[Project], str]] = { # noqa: FA100 "Project": _create_project_entry, "Collaboration": partial(_format_collaboration, inventory=inventory), "Since": _fetch_first_commit_year if fetch else lambda _: "", @@ -69,8 +69,7 @@ def fix_html_alignment(src: str) -> str: src, ) src = src.replace('align="left"', left_align_style) - src = src.replace("", f"") - return src + return src.replace("", f"") class SubProject(BaseModel): @@ -91,7 +90,7 @@ class ProjectInventory(BaseModel): projects: List[Project] collaborations: Dict[str, str] = {} - @root_validator() + @root_validator(skip_on_failure=True) def _check_collaboration_exists(cls, values: dict) -> dict: # noqa: N805 defined_collaborations = set(values["collaborations"]) project: Project @@ -104,7 +103,8 @@ def _check_collaboration_exists(cls, values: dict) -> dict: # noqa: N805 collaborations = project.collaboration for col in collaborations: if col not in defined_collaborations: - raise ValueError(f"No collaboration defined for {col}") + msg = f"No collaboration defined for {col}" + raise ValueError(msg) return values @@ -226,7 +226,8 @@ def _format_collaboration(project: Project, inventory: "ProjectInventory") -> st def _form_collaboration_link(inventory: ProjectInventory, name: str) -> str: collaboration_url = inventory.collaborations.get(name) if collaboration_url is None: - raise KeyError(f'Collaboration entry "{name}" not found') + msg = f'Collaboration entry "{name}" not found' + raise KeyError(msg) return _form_html_link(name=name, url=collaboration_url) @@ -240,8 +241,7 @@ def _enumerate_html_links(list_of_entries: Sequence[str]) -> str: if len(list_of_entries) == 1: return list_of_entries[0] html = "
  • ".join(list_of_entries) - html = "
  • " + html - return html + return "
  • " + html def export_json_schema(argv: Optional[Sequence[str]] = None) -> int: @@ -256,10 +256,11 @@ def export_json_schema(argv: Optional[Sequence[str]] = None) -> int: help="Output path to write the JSON schema to", ) args = parser.parse_args(argv) - schema = ProjectInventory.schema_json(indent=2) - schema += "\n" + schema = ProjectInventory.model_json_schema() + json_schema = json.dumps(schema, indent=2, sort_keys=False) + json_schema += "\n" with open(args.path, "w") as stream: - stream.write(schema) + stream.write(json_schema) return 0 diff --git a/src/pwa_pages/repo/_github.py b/src/pwa_pages/repo/_github.py index 4210cd1e..49376522 100644 --- a/src/pwa_pages/repo/_github.py +++ b/src/pwa_pages/repo/_github.py @@ -2,20 +2,23 @@ import re from datetime import datetime from functools import lru_cache -from typing import Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional from dateutil.parser import parse as parse_date from github import Github -from github.Commit import Commit from github.Repository import Repository as GithubRepository +if TYPE_CHECKING: + from github.Commit import Commit + @lru_cache() def get_github_repo(url: str) -> GithubRepository: github = __get_github() repo_name = extract_github_repo_name(url) if not repo_name: - raise ValueError(f"Not a GitHub repo URL: {url}") + msg = f"Not a GitHub repo URL: {url}" + raise ValueError(msg) return github.get_repo(repo_name) @@ -34,9 +37,8 @@ def get_first_commit_date(repo: GithubRepository) -> datetime: first_commit: Commit = commits[0] timestamp = first_commit.last_modified if timestamp is None: - raise ValueError( - f"First commit on of GitHub repo {repo.full_name} has no timestamp" - ) + msg = f"First commit on of GitHub repo {repo.full_name} has no timestamp" + raise ValueError(msg) return parse_date(timestamp) @@ -46,16 +48,18 @@ def get_latest_commit_date(repo: GithubRepository) -> datetime: latest_commit = repo.get_commit(default_branch) timestamp = latest_commit.last_modified if timestamp is None: - raise ValueError( - f"Last commit on default branch {default_branch} of" - f" {repo.url} has no timestamp" + msg = ( + f"Last commit on default branch {default_branch} of {repo.url} has no" + " timestamp" ) + raise ValueError(msg) return parse_date(timestamp) def get_last_modified(repo: GithubRepository) -> datetime: if repo.last_modified is None: - raise ValueError(f"GitHub repo {repo.full_name} has no last modified timestamp") + msg = f"GitHub repo {repo.full_name} has no last modified timestamp" + raise ValueError(msg) return parse_date(repo.last_modified) diff --git a/src/pwa_pages/repo/_gitlab.py b/src/pwa_pages/repo/_gitlab.py index b6694df0..136a00e4 100644 --- a/src/pwa_pages/repo/_gitlab.py +++ b/src/pwa_pages/repo/_gitlab.py @@ -28,9 +28,9 @@ def split_gitlab_repo_url(url: str) -> Optional[Tuple[str, str]]: def get_first_commit_date(repo: GitlabProject) -> datetime: commits: ProjectCommitManager = repo.commits all_commits = commits.list(all=True) - assert isinstance(all_commits, list) + assert isinstance(all_commits, list) # noqa: S101 first_commit = all_commits[-1] - commit_info = first_commit._attrs # pylint: disable=protected-access + commit_info = first_commit._attrs return parse_date(commit_info["created_at"]) @@ -39,7 +39,7 @@ def get_latest_commit_date(repo: GitlabProject) -> datetime: default_branch = repo.attributes["default_branch"] commits: ProjectCommitManager = repo.commits latest_commit = commits.get(default_branch) - commit_info = latest_commit._attrs # pylint: disable=protected-access + commit_info = latest_commit._attrs return parse_date(commit_info["created_at"]) diff --git a/tests/.pydocstyle b/tests/.pydocstyle deleted file mode 100644 index 26d0703b..00000000 --- a/tests/.pydocstyle +++ /dev/null @@ -1,4 +0,0 @@ -; ignore all pydocstyle errors in this folder - -[pydocstyle] -add_ignore = D diff --git a/tests/repo/test_gitlab.py b/tests/repo/test_gitlab.py index 8bd697c5..e74d683e 100644 --- a/tests/repo/test_gitlab.py +++ b/tests/repo/test_gitlab.py @@ -1,4 +1,3 @@ -# pylint: disable=redefined-outer-name import pytest from pwa_pages.repo._gitlab import ( diff --git a/tests/test_project_inventory.py b/tests/test_project_inventory.py index 6c1af5a6..07790346 100644 --- a/tests/test_project_inventory.py +++ b/tests/test_project_inventory.py @@ -1,5 +1,4 @@ # cspell:ignore subproject -# pylint: disable=redefined-outer-name from pathlib import Path from textwrap import dedent @@ -91,9 +90,7 @@ def test_create_project_entry(): ) assert ( _create_project_entry(project) - == 'name' - + '
  • sub1' - + '
  • sub2' + == 'name
  • sub1
  • sub2' ) @@ -115,9 +112,8 @@ def test_to_html_table(project_inventory, fetch, fix_alignment): src = fix_html_alignment(src) if fetch: assert '2020' in src - else: - if fetch: - assert '2020' in src + elif fetch: + assert '2020' in src # cspell: ignore thead assert src.startswith("") assert src.count("") == 1 @@ -173,4 +169,5 @@ def test_get_subproject_timestamps(project_inventory: ProjectInventory): ) assert len(timestamps) == 3 return - raise ValueError(f"Project {project_name} not found") + msg = f"Project {project_name} not found" + raise ValueError(msg)