From 079799979b6a6200e1934426ff5b6b1a68b86633 Mon Sep 17 00:00:00 2001 From: Remco de Boer Date: Sat, 21 Nov 2020 14:11:30 +0100 Subject: [PATCH] build!: upgrade and reorganize dependencies (#51) * build: set Development Status to Pre-Alpha * chore: put application imports on separate line * chore: reorganize .gitignores * ci: add doc-live tox job * ci: ignore _build in pyright * docs: add General Index and Search * docs: add Table of Contents header * docs: add favicon * docs: add link to contribute page * docs: add maintainer email * docs: generalize conf.py through package name * docs: remove API page layer * docs: use repo_name in conf.py * fix: cspell errors prereleased * fix: deactivate pytest color for VSCode * fix: ignore numpy and matplotlib types * fix: install version.py under correct path * fix: only extract doc version if available --- .editorconfig | 3 --- .github/workflows/cd.yml | 13 ++++++----- .github/workflows/ci.yml | 4 ++-- .gitignore | 24 +++++++++++++++++++ .pre-commit-config.yaml | 5 ++-- .pylintrc | 6 +++++ .vscode/settings.json | 8 ++++++- README.md | 4 ++++ cspell.json | 2 ++ docs/.gitignore | 1 - docs/_static/favicon.ico | Bin 0 -> 15406 bytes docs/api.rst | 14 ----------- docs/conf.py | 26 ++++++++++++--------- docs/index.md | 12 ++++------ pyproject.toml | 2 +- pyrightconfig.json | 2 +- setup.cfg | 49 +++++++++++++++++++++++---------------- tox.ini | 25 +++++++++++--------- 18 files changed, 119 insertions(+), 81 deletions(-) create mode 100644 docs/_static/favicon.ico delete mode 100644 docs/api.rst diff --git a/.editorconfig b/.editorconfig index e3481199..0ae391f4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,9 +9,6 @@ insert_final_newline = true [Makefile] indent_style = tab -[Makefile] -indent_style = tab - [*.{py,toml}] indent_size = 4 diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8115518e..a23ea0e7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,11 +1,12 @@ -# cspell:ignore noreply pypa sdist +# cspell:ignore noreply prereleased pypa name: CD on: - create: - tags: - - "[0-9]+.[0-9]+.[0-9]+*" + release: + types: + - prereleased + - released jobs: documentation: @@ -45,10 +46,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[ci] + pip install .[precommit] sudo npm install -g cspell markdownlint-cli pyright - name: Perform style checks - run: tox -e sty + run: pre-commit run -a - name: Check spelling run: cspell $(git ls-files) - name: Lint Markdown files diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d089da2f..290d8bdc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,10 +46,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[ci] + pip install .[precommit] sudo npm install -g cspell markdownlint-cli pyright - name: Perform style checks - run: tox -e sty + run: pre-commit run -a - name: Check spelling run: cspell $(git ls-files) - name: Lint Markdown files diff --git a/.gitignore b/.gitignore index 524b7b92..c30a66c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,14 @@ +# Output files +*.gv +*.json +*.npy +*.pdf +*.png +*.svg +*.xml +*.yaml +*.yml + # Build files *.egg-info/ *build/ @@ -26,3 +37,16 @@ pyvenv*/ # Settings .idea/ **.code-workspace + +# Exceptions +!.github/*.yml +!.github/*/*.yml +!.gitpod.yml +!.markdownlint.json +!.pre-commit-config.yaml +!.readthedocs.yml +!.vscode/*.json +!codecov.yml +!cspell.json +!environment.yml +!pyrightconfig.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 448ea360..86634721 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,6 @@ repos: hooks: - id: check-ast - id: check-case-conflict - - id: check-docstring-first - id: check-json - id: check-merge-conflict - id: check-toml @@ -25,8 +24,8 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - - repo: https://github.com/prettier/prettier - rev: 2.1.2 + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.2.0 hooks: - id: prettier language_version: 12.18.2 # prettier does not specify node correctly diff --git a/.pylintrc b/.pylintrc index a0ef315b..5bca367a 100644 --- a/.pylintrc +++ b/.pylintrc @@ -21,5 +21,11 @@ disable= ignore= conf.py +[DESIGN] +# Minimum number of public methods for a class (see R0903). Default is 2. +# We decrease this to 0, since some rules are "empty" but get decorated. +# Note that some interface classes also just have a single method +min-public-methods=0 + [SIMILARITIES] ignore-imports=yes # https://stackoverflow.com/a/30007053 diff --git a/.vscode/settings.json b/.vscode/settings.json index ad0de1aa..5da95153 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -51,11 +51,17 @@ "python.linting.pylintEnabled": true, "python.linting.pylintUseMinimalCheckers": false, "python.testing.nosetestsEnabled": false, + "python.testing.pytestArgs": ["--color=no", "--no-cov"], "python.testing.pytestEnabled": false, "python.testing.unittestEnabled": false, "restructuredtext.builtDocumentationPath": "${workspaceFolder}/docs/_build/html", - "restructuredtext.confPath": "${workspaceFolder}/doc", + "restructuredtext.confPath": "${workspaceFolder}/docs", "rewrap.wrappingColumn": 79, + "search.exclude": { + "**/tests/**/__init__.py": true, + "docs/tox.ini": true, + "tests/tox.ini": true + }, "telemetry.enableCrashReporter": false, "telemetry.enableTelemetry": false } diff --git a/README.md b/README.md index 3092f6a6..9c82f343 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,7 @@ This repository contains the source code for the [pwa.rtfd.io](https://pwa.readthedocs.io) pages. + +## Contribute + +See [`CONTRIBUTING.md`](./CONTRIBUTING.md) diff --git a/cspell.json b/cspell.json index 611dd479..42f419fd 100644 --- a/cspell.json +++ b/cspell.json @@ -28,6 +28,7 @@ ".vscode/*", ".vscode/.gitignore", "Makefile", + "codecov.yml", "cspell.json", "docs/_templates/*", "docs/conf.py", @@ -99,6 +100,7 @@ "oneline", "pandoc", "pawian", + "precommit", "propto", "pycompwa", "pydocstyle", diff --git a/docs/.gitignore b/docs/.gitignore index 0209b04a..b6c50e96 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -2,4 +2,3 @@ *.inv *build/ api/ -pwa_pages.svg diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico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-|~I(n>;?Ma*AeSVZiaXN6lSz4oh<9jhRn=_n!`rBip_{!@( zHdy~X&Xa;Ol0yHhp7A<|`JD;IVetOSen)d&b$$KmeK`9Q=795?R?q%U)b|)(n(K_A zwdx1mM=RFN)Y%uK!(Q57Z}3bi|3;hH@48!COT_ckt-xL@wZCM284sU#Y40FI-`7-Q zihcT>@K~H_7ImKlXKM8}HG8@1bq)@XgX$ zkQraW`#t;z>rC=h?!?vK*kup)yCEvKyL>h0DJlGxSvw4#-tQ^)#lO6$^+M-`=z9@* zKZq{r=-V;T82ypE0DWKQdlbBzC@c2Sd#MfReg(P_%ekxZSGO})rhxY{IB)8Wi}(co z!L!zb+oX3if`x50W6q>uO+Kbu2A`*lO~RU3Ouk8P1%enp;V#5BPw1>qHq!hycuF%~ z`MLD_wp3mDdHA3S@MC;oSKn0}zJPP6udJ)N?r_a-;7j@5f){?<)p|bJ#H{OT&OJPT z?xg;j7QT&&N-E@KduZ94ySw@Sh6#n5t~t$F_PxicJ*DP@uysbKx2#GfGt)5Y#8!XQ z8G2W$xW)K#t%r(f;CGtpb><>J7PT?`!CN7{wG7U$rl?QES8~KhF@@F?)-3t`_psGG z$xwa&{<`*cUw8-S+a7Vh_BaV=CFu`. +## Table of Contents + ```{toctree} --- maxdepth: 2 @@ -41,16 +43,12 @@ theory analysis software develop +API ``` - {ref}`Python API ` - -```{toctree} ---- -hidden: ---- -api -``` +- {ref}`General Index ` +- {ref}`Search ` ```{toctree} --- diff --git a/pyproject.toml b/pyproject.toml index 10639bb9..52a0e183 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ ] [tool.setuptools_scm] -write_to = "pwa_pages/version.py" +write_to = "src/pwa_pages/version.py" [tool.black] line-length = 79 diff --git a/pyrightconfig.json b/pyrightconfig.json index 0036b13f..bbad5e89 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -1,5 +1,5 @@ { - "exclude": [".git", ".tox"], + "exclude": [".git", ".tox", "docs/_build"], "include": ["docs", "src", "tests"], "reportGeneralTypeIssues": false, "reportUnboundVariable": false, diff --git a/setup.cfg b/setup.cfg index ff513e94..5b77ef88 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,11 @@ [metadata] name = PWA-pages +author = Common Partial Wave Analysis +author_email = compwa-admin@ep1.rub.de +maintainer_email = compwa-admin@ep1.rub.de long_description = file: README.md long_description_content_type = text/markdown +# URLS are shown in reverse order on PyPI project_urls = Tracker = https://github.com/ComPWA/PWA-pages/issues Changelog = https://github.com/ComPWA/PWA-pages/releases @@ -17,7 +21,7 @@ keywords = particles physics classifiers = - Development Status :: 1 - Planning + Development Status :: 2 - Pre-Alpha Intended Audience :: Developers Intended Audience :: Education Intended Audience :: Science/Research @@ -52,13 +56,13 @@ pwa_pages = [options.extras_require] doc = - graphviz==0.14.2 + graphviz==0.15 ipywidgets==7.5.1 jupyter==1.0.0 myst-nb==0.10.1 pybtex==0.23.0 pydeps==1.9.11 - Sphinx==3.2.1 + Sphinx==3.3.1 sphinx-book-theme==0.0.39 sphinx-copybutton==0.3.1 sphinx-math-dollar==1.2 @@ -68,36 +72,40 @@ doc = sphinxcontrib-bibtex==1.0.0 format = black==20.8b1 - isort==5.6.1 -lint = - data-science-types==0.2.19 + isort==5.6.4 + nbstripout==0.3.9 +lint-doc = doc8==0.8.1 - flake8==3.8.3 # >=3 for per-file-ignores + rstcheck==3.3.1 +lint-py = + flake8==3.8.4 flake8-blind-except==0.1.1 flake8-bugbear==20.1.4 flake8-builtins==1.5.3 - flake8-rst-docstrings==0.0.13 - mypy==0.782 - nbstripout==0.3.8 + flake8-rst-docstrings==0.0.14 + mypy==0.790 pep8-naming==0.11.1 pydocstyle==5.1.1 pylint==2.6.0 - rstcheck==3.3.1 -ci = +lint = + %(lint-doc)s + %(lint-py)s +precommit = %(format)s %(lint)s pre-commit==2.8.2 - tox==3.20.0 +tox = + %(precommit)s + sphinx-autobuild==2020.9.1 + tox==3.20.1 tools = - jupyterlab==2.2.4 + jupyterlab==2.2.9 jupyterlab_code_formatter==1.3.6 - jupyter_nbextensions_configurator==0.4.1 labels==20.1.0 - sphinx-autobuild==2020.9.1 dev = - %(ci)s %(doc)s %(tools)s + %(tox)s [doc8] extension=.inc @@ -114,10 +122,11 @@ files = **/*.py, **/*.pyi, -[mypy-conf.*] -ignore = True - ; External packages that miss stubs or type hints +[mypy-matplotlib.*] +ignore_missing_imports = True +[mypy-numpy.*] +ignore_missing_imports = True [mypy-setuptools.*] ignore_missing_imports = True diff --git a/tox.ini b/tox.ini index 9a1cf275..f13f44d2 100644 --- a/tox.ini +++ b/tox.ini @@ -16,15 +16,6 @@ whitelist_externals = commands = make html -[testenv:linkcheck] -description = - Check external links in the documentation (requires internet connection) -changedir = docs -whitelist_externals = - make -commands = - make ignore-warnings=1 linkcheck # for margin directive - [testenv:doc-live] description = Set up a server to preview changes to the HTML pages live @@ -34,11 +25,22 @@ commands = sphinx-autobuild \ --watch docs \ --watch src \ - --re-ignore docs/api/.* \ + --re-ignore docs/.*\.inv \ --re-ignore docs/_build/.* \ + --re-ignore docs/api/.* \ --open-browser \ docs/ docs/_build/html + +[testenv:linkcheck] +description = + Check external links in the documentation (requires internet connection) +changedir = docs +whitelist_externals = + make +commands = + make ignore-warnings=1 linkcheck # for margin directive + [testenv:sty] description = Perform all linting, formatting, and spelling checks @@ -55,7 +57,8 @@ commands = - bash -ec "markdownlint . --ignore docs/_build" [flake8] -application-import-names = pwa_pages +application-import-names = + pwa_pages filename = ./src/*.py exclude =