From c3d6846713c1125b89d8be78c36fbad521fb159e Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Sat, 2 Dec 2023 22:19:29 +0100 Subject: [PATCH] DX: install Ruff and Git in Jupyter Lab (#87) * MAINT: update pip constraints and pre-commit --------- Co-authored-by: GitHub Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .constraints/py3.10.txt | 10 ++++++++++ .constraints/py3.11.txt | 10 ++++++++++ .constraints/py3.8.txt | 10 ++++++++++ .constraints/py3.9.txt | 10 ++++++++++ .pre-commit-config.yaml | 23 +++-------------------- pyproject.toml | 37 ++++++++++++++++++++++--------------- 6 files changed, 65 insertions(+), 35 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index 3601848c..424fc5c6 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -21,6 +21,7 @@ beautifulsoup4==4.12.2 black==23.11.0 bleach==6.1.0 cachetools==5.3.2 +cattrs==23.2.3 certifi==2023.11.17 cffi==1.16.0 cfgv==3.4.0 @@ -49,6 +50,8 @@ flatbuffers==23.5.26 fonttools==4.46.0 fqdn==1.5.1 gast==0.5.4 +gitdb==4.0.11 +gitpython==3.1.40 google-auth==2.24.0 google-auth-oauthlib==1.1.0 google-pasta==0.2.0 @@ -69,6 +72,7 @@ ipython==8.18.1 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 +isort==5.12.0 jax==0.4.20 jaxlib==0.4.20 jedi==0.19.1 @@ -83,9 +87,11 @@ jupyter-core==5.5.0 jupyter-events==0.9.0 jupyter-lsp==2.2.1 jupyter-server==2.11.1 +jupyter-server-mathjax==0.2.6 jupyter-server-terminals==0.4.4 jupyterlab==4.0.9 jupyterlab-code-formatter==2.2.1 +jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 jupyterlab-myst==2.1.0 jupyterlab-pygments==0.3.0 @@ -96,6 +102,7 @@ kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 +lsprotocol==2023.0.0 markdown==3.5.1 markdown-it-py==3.0.0 markupsafe==2.1.3 @@ -111,6 +118,7 @@ myst-nb==1.0.0 myst-parser==2.0.0 nbclient==0.6.8 nbconvert==7.11.0 +nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 @@ -153,6 +161,7 @@ python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 +python-lsp-ruff==2.0.0 python-lsp-server==1.9.0 pytoolconfig==1.2.6 pyyaml==6.0.1 @@ -170,6 +179,7 @@ ruff==0.1.6 scipy==1.11.4 send2trash==1.8.2 six==1.16.0 +smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 7633ff0f..255d42b2 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -21,6 +21,7 @@ beautifulsoup4==4.12.2 black==23.11.0 bleach==6.1.0 cachetools==5.3.2 +cattrs==23.2.3 certifi==2023.11.17 cffi==1.16.0 cfgv==3.4.0 @@ -48,6 +49,8 @@ flatbuffers==23.5.26 fonttools==4.46.0 fqdn==1.5.1 gast==0.5.4 +gitdb==4.0.11 +gitpython==3.1.40 google-auth==2.24.0 google-auth-oauthlib==1.1.0 google-pasta==0.2.0 @@ -68,6 +71,7 @@ ipython==8.18.1 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 +isort==5.12.0 jax==0.4.20 jaxlib==0.4.20 jedi==0.19.1 @@ -82,9 +86,11 @@ jupyter-core==5.5.0 jupyter-events==0.9.0 jupyter-lsp==2.2.1 jupyter-server==2.11.1 +jupyter-server-mathjax==0.2.6 jupyter-server-terminals==0.4.4 jupyterlab==4.0.9 jupyterlab-code-formatter==2.2.1 +jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 jupyterlab-myst==2.1.0 jupyterlab-pygments==0.3.0 @@ -95,6 +101,7 @@ kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 +lsprotocol==2023.0.0 markdown==3.5.1 markdown-it-py==3.0.0 markupsafe==2.1.3 @@ -110,6 +117,7 @@ myst-nb==1.0.0 myst-parser==2.0.0 nbclient==0.6.8 nbconvert==7.11.0 +nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 @@ -152,6 +160,7 @@ python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 +python-lsp-ruff==2.0.0 python-lsp-server==1.9.0 pytoolconfig==1.2.6 pyyaml==6.0.1 @@ -169,6 +178,7 @@ ruff==0.1.6 scipy==1.11.4 send2trash==1.8.2 six==1.16.0 +smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index 1e604d4a..8b32ee36 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -22,6 +22,7 @@ beautifulsoup4==4.12.2 black==23.11.0 bleach==6.1.0 cachetools==5.3.2 +cattrs==23.2.3 certifi==2023.11.17 cffi==1.16.0 cfgv==3.4.0 @@ -50,6 +51,8 @@ flatbuffers==23.5.26 fonttools==4.46.0 fqdn==1.5.1 gast==0.4.0 +gitdb==4.0.11 +gitpython==3.1.40 google-auth==2.24.0 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 @@ -71,6 +74,7 @@ ipython==8.12.3 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 +isort==5.12.0 jax==0.4.13 jaxlib==0.4.13 jedi==0.19.1 @@ -85,9 +89,11 @@ jupyter-core==5.5.0 jupyter-events==0.9.0 jupyter-lsp==2.2.1 jupyter-server==2.11.1 +jupyter-server-mathjax==0.2.6 jupyter-server-terminals==0.4.4 jupyterlab==4.0.9 jupyterlab-code-formatter==2.2.1 +jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 jupyterlab-myst==2.1.0 jupyterlab-pygments==0.3.0 @@ -98,6 +104,7 @@ kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 +lsprotocol==2023.0.0 markdown==3.5.1 markdown-it-py==2.2.0 markupsafe==2.1.3 @@ -113,6 +120,7 @@ myst-nb==0.17.2 myst-parser==0.18.1 nbclient==0.6.8 nbconvert==7.11.0 +nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 @@ -157,6 +165,7 @@ python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 +python-lsp-ruff==2.0.0 python-lsp-server==1.9.0 pytoolconfig==1.2.6 pytz==2023.3.post1 @@ -175,6 +184,7 @@ ruff==0.1.6 scipy==1.10.1 send2trash==1.8.2 six==1.16.0 +smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index 9a675109..2ae89af7 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -21,6 +21,7 @@ beautifulsoup4==4.12.2 black==23.11.0 bleach==6.1.0 cachetools==5.3.2 +cattrs==23.2.3 certifi==2023.11.17 cffi==1.16.0 cfgv==3.4.0 @@ -49,6 +50,8 @@ flatbuffers==23.5.26 fonttools==4.46.0 fqdn==1.5.1 gast==0.5.4 +gitdb==4.0.11 +gitpython==3.1.40 google-auth==2.24.0 google-auth-oauthlib==1.1.0 google-pasta==0.2.0 @@ -70,6 +73,7 @@ ipython==8.18.1 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 +isort==5.12.0 jax==0.4.20 jaxlib==0.4.20 jedi==0.19.1 @@ -84,9 +88,11 @@ jupyter-core==5.5.0 jupyter-events==0.9.0 jupyter-lsp==2.2.1 jupyter-server==2.11.1 +jupyter-server-mathjax==0.2.6 jupyter-server-terminals==0.4.4 jupyterlab==4.0.9 jupyterlab-code-formatter==2.2.1 +jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 jupyterlab-myst==2.1.0 jupyterlab-pygments==0.3.0 @@ -97,6 +103,7 @@ kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 +lsprotocol==2023.0.0 markdown==3.5.1 markdown-it-py==3.0.0 markupsafe==2.1.3 @@ -112,6 +119,7 @@ myst-nb==1.0.0 myst-parser==2.0.0 nbclient==0.6.8 nbconvert==7.11.0 +nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 @@ -154,6 +162,7 @@ python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 +python-lsp-ruff==2.0.0 python-lsp-server==1.9.0 pytoolconfig==1.2.6 pyyaml==6.0.1 @@ -171,6 +180,7 @@ ruff==0.1.6 scipy==1.11.4 send2trash==1.8.2 six==1.16.0 +smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0450f235..c7d3c99b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.1.4 + rev: 0.1.6 hooks: - id: check-dev-files args: @@ -39,16 +39,6 @@ repos: - --repo-title=AmpForm-DPD - id: colab-toc-visible - - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.1 - hooks: - - id: nbqa-pyupgrade - args: - - --py38-plus - - id: nbqa-ruff - args: - - --fix - - repo: https://github.com/psf/black-pre-commit-mirror rev: 23.11.0 hooks: @@ -108,19 +98,12 @@ repos: hooks: - id: pyright - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 - hooks: - - id: pyupgrade - args: - - --py38-plus - - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.1.6 hooks: - id: ruff - args: - - --fix + args: [--fix] + types_or: [python, pyi, jupyter] - repo: https://github.com/ComPWA/mirrors-taplo rev: v0.8.1 diff --git a/pyproject.toml b/pyproject.toml index 27730912..33878777 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,10 +69,14 @@ jax = [ ] jupyter = [ "ampform-dpd[doc]", + "isort", "jupyterlab >=3.0", + "jupyterlab", "jupyterlab-code-formatter", + "jupyterlab-git", "jupyterlab-lsp", "jupyterlab-myst", + "python-lsp-ruff", "python-lsp-server[rope]", ] lint = [ @@ -151,21 +155,6 @@ target-version = [ "py39", ] -[tool.nbqa.addopts] -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", - "--extend-ignore=PLW2901", - "--line-length=85", -] - [tool.pyright] reportGeneralTypeIssues = false reportImportCycles = false @@ -214,6 +203,7 @@ testpaths = [ ] [tool.ruff] +extend-include = ["*.ipynb"] extend-select = [ "A", "B", @@ -287,6 +277,23 @@ ignore-names = [ [tool.ruff.per-file-ignores] "*" = ["D"] +"*.ipynb" = [ + "B018", + "C90", + "D", + "E402", + "E703", + "N806", + "N816", + "PLR09", + "PLR2004", + "PLW0602", + "PLW0603", + "PLW2901", + "S101", + "T201", + "TCH00", +] "docs/*" = [ "E402", "INP001",