From 523c639dd5ac2178035f4c40106db569ead63d27 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 20 Oct 2021 17:22:04 +0200 Subject: [PATCH] build: support Python 3.10 (#117) * ci: auto-update pre-commit * ci: upgrade pinned requirements (automatic) * ci: use ignore instead of extend-ignore nbQA does not take extend-ignore into account * ci: define Python version in YAML as string Defining the Python version as a number (e.g. 3.7) can lead to problems later on when you want to use 3.10, because that would be interpreted as 3.1. * ci: print myst-nb error logs with color See https://github.com/ComPWA/ampform/pull/170 * ci: update pin_requirements.py script Co-authored-by: GitHub Action <41898282+github-actions[bot]@users.noreply.github.com> --- .constraints/pin_requirements.py | 6 +- .constraints/py3.10.txt | 194 ++++++++++++++++++++++++ .constraints/py3.6.txt | 4 +- .constraints/py3.7.txt | 6 +- .constraints/py3.8.txt | 6 +- .constraints/py3.9.txt | 6 +- .cspell.json | 2 + .flake8 | 2 +- .github/workflows/cd.yml | 2 +- .github/workflows/ci-docs.yml | 16 +- .github/workflows/ci-style.yml | 2 +- .github/workflows/ci-tests.yml | 19 ++- .github/workflows/linkcheck.yml | 2 +- .github/workflows/requirements-cron.yml | 13 +- .github/workflows/requirements-pr.yml | 11 +- .pre-commit-config.yaml | 2 +- .readthedocs.yml | 2 +- setup.cfg | 3 +- 18 files changed, 258 insertions(+), 40 deletions(-) create mode 100644 .constraints/py3.10.txt diff --git a/.constraints/pin_requirements.py b/.constraints/pin_requirements.py index 6188d3d1..a4923d4e 100644 --- a/.constraints/pin_requirements.py +++ b/.constraints/pin_requirements.py @@ -67,7 +67,11 @@ def perform_replacements(line: str) -> str: stream.write(new_content) -if "__main__" in __name__: +def main() -> None: if upgrade_constraints_file(): raise RuntimeError("There were issues running pip-compile") remove_extras_syntax() + + +if "__main__" in __name__: + main() diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt new file mode 100644 index 00000000..15a36cd5 --- /dev/null +++ b/.constraints/py3.10.txt @@ -0,0 +1,194 @@ +# +# This file is autogenerated by pip-compile with python 3.10 +# To update, run: +# +# pip-compile --extra=dev --no-annotate --output-file=.constraints/py3.10.txt +# +alabaster==0.7.12 +anyio==3.3.4 +aquirdturtle-collapsible-headings==3.1.0 +argon2-cffi==21.1.0 +astroid==2.8.3 +attrs==20.3.0 +babel==2.9.1 +backcall==0.2.0 +backports.entry-points-selectable==1.1.0 +beautifulsoup4==4.10.0 +black==21.9b0 +bleach==4.1.0 +certifi==2021.10.8 +cffi==1.15.0 +cfgv==3.3.1 +charset-normalizer==2.0.7 +click==7.1.2 +colorama==0.4.4 +coverage==6.0.2 +debugpy==1.5.1 +decorator==5.1.0 +defusedxml==0.7.1 +deprecated==1.2.13 +distlib==0.3.3 +docutils==0.16 +entrypoints==0.3 +execnet==1.9.0 +filelock==3.3.1 +flake8==4.0.1 +flake8-blind-except==0.2.0 +flake8-bugbear==21.9.2 +flake8-builtins==1.5.3 +flake8-comprehensions==3.7.0 +flake8-plugin-utils==1.3.2 +flake8-polyfill==1.0.2 +flake8-pytest-style==1.5.0 +flake8-rst-docstrings==0.2.3 +flake8-type-ignore==0.1.0.post2 +flake8-use-fstring==1.2 +fuzzywuzzy==0.18.0 +gitdb==4.0.7 +gitpython==3.1.24 +gprof2dot==2021.2.21 +graphviz==0.17 +greenlet==1.1.2 +hepunits==2.1.2 +identify==2.3.0 +idna==3.3 +imagesize==1.2.0 +importlib-metadata==4.8.1 +importlib-resources==5.3.0 +iniconfig==1.1.1 +ipykernel==6.4.2 +ipython==7.28.0 +ipython-genutils==0.2.0 +ipywidgets==7.6.5 +isort==5.9.3 +jedi==0.18.0 +jinja2==3.0.2 +json5==0.9.6 +jsonschema==4.1.2 +jupyter==1.0.0 +jupyter-cache==0.4.3 +jupyter-client==7.0.6 +jupyter-console==6.4.0 +jupyter-core==4.8.1 +jupyter-server==1.11.1 +jupyter-server-mathjax==0.2.3 +jupyter-sphinx==0.3.2 +jupyterlab==3.2.1 +jupyterlab-code-formatter==1.4.10 +jupyterlab-server==2.8.2 +jupyterlab-widgets==1.0.2 +latexcodec==2.0.1 +lazy-object-proxy==1.6.0 +livereload==2.6.3 +markdown-it-py==1.1.0 +markupsafe==2.0.1 +matplotlib-inline==0.1.3 +mccabe==0.6.1 +mdit-py-plugins==0.2.8 +mistune==0.8.4 +mypy==0.910 +mypy-extensions==0.4.3 +myst-nb==0.13.1 +myst-parser==0.15.2 +nbclassic==0.3.2 +nbclient==0.5.4 +nbconvert==5.6.1 +nbdime==3.1.0 +nbformat==5.1.3 +nest-asyncio==1.5.1 +nodeenv==1.6.0 +notebook==6.4.5 +packaging==21.0 +pandocfilters==1.5.0 +parso==0.8.2 +particle==0.16.1 +pathspec==0.9.0 +pep517==0.12.0 +pep8-naming==0.12.1 +pexpect==4.8.0 +pickleshare==0.7.5 +pip-tools==6.4.0 +platformdirs==2.4.0 +pluggy==1.0.0 +pre-commit==2.15.0 +prometheus-client==0.11.0 +prompt-toolkit==3.0.20 +ptyprocess==0.7.0 +py==1.10.0 +pybtex==0.24.0 +pybtex-docutils==1.0.1 +pycodestyle==2.8.0 +pycparser==2.20 +pydata-sphinx-theme==0.6.3 +pydocstyle==6.1.1 +pydot==1.4.2 +pyflakes==2.4.0 +pygments==2.10.0 +pylint==2.11.1 +pyparsing==2.4.7 +pyrsistent==0.18.0 +pytest==6.2.5 +pytest-cov==3.0.0 +pytest-forked==1.3.0 +pytest-notebook==0.6.1 +pytest-profiling==1.7.0 +pytest-xdist==2.4.0 +python-constraint==1.4.0 +python-dateutil==2.8.2 +pytz==2021.3 +pyyaml==6.0 +pyzmq==22.3.0 +qtconsole==5.1.1 +qtpy==1.11.2 +regex==2021.10.8 +requests==2.26.0 +requests-unixsocket==0.2.0 +restructuredtext-lint==1.3.2 +send2trash==1.8.0 +six==1.16.0 +smmap==4.0.0 +sniffio==1.2.0 +snowballstemmer==2.1.0 +soupsieve==2.2.1 +sphinx==4.2.0 +sphinx-autobuild==2021.3.14 +sphinx-book-theme==0.1.6 +sphinx-copybutton==0.4.0 +sphinx-panels==0.6.0 +sphinx-thebe==0.0.10 +sphinx-togglebutton==0.2.3 +sphinxcontrib-applehelp==1.0.2 +sphinxcontrib-bibtex==2.4.1 +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 +sphobjinv==2.1 +sqlalchemy==1.4.26 +terminado==0.12.1 +testpath==0.5.0 +toml==0.10.2 +tomli==1.2.1 +tornado==6.1 +tox==3.24.4 +tqdm==4.62.3 +traitlets==5.1.0 +types-docutils==0.17.1 +types-pkg-resources==0.1.3 +types-pyyaml==5.4.12 +typing-extensions==3.10.0.2 +urllib3==1.26.7 +virtualenv==20.8.1 +wcwidth==0.2.5 +webencodings==0.5.1 +websocket-client==1.2.1 +wheel==0.37.0 +widgetsnbextension==3.5.1 +wrapt==1.13.2 +zipp==3.6.0 + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/.constraints/py3.6.txt b/.constraints/py3.6.txt index 101915a2..1bb8560c 100644 --- a/.constraints/py3.6.txt +++ b/.constraints/py3.6.txt @@ -76,7 +76,7 @@ jupyter-core==4.8.1 jupyter-server==1.11.1 jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 -jupyterlab==3.2.0 +jupyterlab==3.2.1 jupyterlab-code-formatter==1.4.10 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 @@ -162,7 +162,7 @@ sphinx-togglebutton==0.2.3 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-bibtex==2.4.1 sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-hep-pdgref==0.1.3 +sphinxcontrib-hep-pdgref==0.1.4 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt index f5b69538..cc07bfaf 100644 --- a/.constraints/py3.7.txt +++ b/.constraints/py3.7.txt @@ -65,7 +65,7 @@ isort==5.9.3 jedi==0.18.0 jinja2==3.0.2 json5==0.9.6 -jsonschema==4.1.1 +jsonschema==4.1.2 jupyter==1.0.0 jupyter-cache==0.4.3 jupyter-client==7.0.6 @@ -74,7 +74,7 @@ jupyter-core==4.8.1 jupyter-server==1.11.1 jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 -jupyterlab==3.2.0 +jupyterlab==3.2.1 jupyterlab-code-formatter==1.4.10 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 @@ -161,7 +161,7 @@ sphinx-togglebutton==0.2.3 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-bibtex==2.4.1 sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-hep-pdgref==0.1.3 +sphinxcontrib-hep-pdgref==0.1.4 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index 7d75bf91..e7a9ae42 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -64,7 +64,7 @@ isort==5.9.3 jedi==0.18.0 jinja2==3.0.2 json5==0.9.6 -jsonschema==4.1.1 +jsonschema==4.1.2 jupyter==1.0.0 jupyter-cache==0.4.3 jupyter-client==7.0.6 @@ -73,7 +73,7 @@ jupyter-core==4.8.1 jupyter-server==1.11.1 jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 -jupyterlab==3.2.0 +jupyterlab==3.2.1 jupyterlab-code-formatter==1.4.10 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 @@ -160,7 +160,7 @@ sphinx-togglebutton==0.2.3 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-bibtex==2.4.1 sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-hep-pdgref==0.1.3 +sphinxcontrib-hep-pdgref==0.1.4 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index fedc51d5..73188d7c 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -64,7 +64,7 @@ isort==5.9.3 jedi==0.18.0 jinja2==3.0.2 json5==0.9.6 -jsonschema==4.1.1 +jsonschema==4.1.2 jupyter==1.0.0 jupyter-cache==0.4.3 jupyter-client==7.0.6 @@ -73,7 +73,7 @@ jupyter-core==4.8.1 jupyter-server==1.11.1 jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 -jupyterlab==3.2.0 +jupyterlab==3.2.1 jupyterlab-code-formatter==1.4.10 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 @@ -160,7 +160,7 @@ sphinx-togglebutton==0.2.3 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-bibtex==2.4.1 sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-hep-pdgref==0.1.3 +sphinxcontrib-hep-pdgref==0.1.4 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 diff --git a/.cspell.json b/.cspell.json index e0ec0c40..2053e671 100644 --- a/.cspell.json +++ b/.cspell.json @@ -116,6 +116,7 @@ "asdict", "asdot", "astuple", + "autoupdate", "cano", "celltoolbar", "codacy", @@ -167,6 +168,7 @@ "nbstripout", "ndarray", "noqa", + "noreply", "nrows", "nsimplify", "pandoc", diff --git a/.flake8 b/.flake8 index b9cd7313..7df4ef62 100644 --- a/.flake8 +++ b/.flake8 @@ -9,7 +9,7 @@ exclude = **/__pycache__ **/_build /typings/** -extend-ignore = +ignore = # https://github.com/psf/black#slices E203 # allowed by black diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b0864a5f..5067fcca 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -31,7 +31,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: "3.8" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index 281b3f6c..fc23234d 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -19,12 +19,12 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: "3.7" - name: Install dependencies run: | python -m pip install --upgrade pip pip install -c .constraints/py3.7.txt .[doc] - sudo apt-get -y install pandoc graphviz + sudo apt-get -y install graphviz pandoc - name: Build documentation and run notebooks working-directory: docs env: @@ -35,3 +35,15 @@ jobs: with: name: html path: docs/_build/html + - name: Print error logs with color + if: ${{ failure() }} + # cspell:ignore printf + run: | + for log_file in $(ls docs/_build/html/reports/*); do + for i in $(seq 6); do echo; done + printf '%45s\n' | tr ' ' = + echo "$log_file" + printf '%45s\n' | tr ' ' = + echo + cat "$log_file" + done diff --git a/.github/workflows/ci-style.yml b/.github/workflows/ci-style.yml index 86c8bea9..c699d800 100644 --- a/.github/workflows/ci-style.yml +++ b/.github/workflows/ci-style.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Python 3.8 uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: "3.8" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index a94029ec..d1d61680 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - python-version: [3.7] + python-version: ["3.7"] steps: - uses: actions/checkout@master - name: Set up Python ${{ matrix.python-version }} @@ -50,16 +50,23 @@ jobs: os: - macos-11 - ubuntu-20.04 - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" exclude: - os: macos-11 - python-version: 3.6 + python-version: "3.6" - os: macos-11 - python-version: 3.8 + python-version: "3.8" - os: macos-11 - python-version: 3.9 + python-version: "3.9" + - os: macos-11 + python-version: "3.10" - os: ubuntu-20.04 # coverage job - python-version: 3.7 + python-version: "3.7" steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 4cc10d30..a7339ac4 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: "3.7" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/requirements-cron.yml b/.github/workflows/requirements-cron.yml index 7759a547..c6c46e52 100644 --- a/.github/workflows/requirements-cron.yml +++ b/.github/workflows/requirements-cron.yml @@ -1,5 +1,3 @@ -# cspell:ignore autoupdate noreply - name: Requirements (scheduled) on: @@ -14,10 +12,11 @@ jobs: strategy: matrix: python-version: - - 3.6 - - 3.7 - - 3.8 - - 3.9 + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -42,7 +41,7 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: "3.7" - name: Install dependencies run: | python3 -m pip install --upgrade pip diff --git a/.github/workflows/requirements-pr.yml b/.github/workflows/requirements-pr.yml index 0965e551..8d3aed22 100644 --- a/.github/workflows/requirements-pr.yml +++ b/.github/workflows/requirements-pr.yml @@ -1,5 +1,3 @@ -# cspell:ignore noreply - name: Requirements (PR) on: @@ -15,10 +13,11 @@ jobs: strategy: matrix: python-version: - - 3.6 - - 3.7 - - 3.8 - - 3.9 + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" steps: - uses: actions/checkout@v2 - run: git fetch origin diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f76c8129..b1d850c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.47 + rev: 0.0.51 hooks: - id: check-dev-files args: diff --git a/.readthedocs.yml b/.readthedocs.yml index 70ffe583..05e61be5 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,7 +9,7 @@ formats: - htmlzip python: - version: 3.7 + version: "3.7" install: - method: pip path: . diff --git a/setup.cfg b/setup.cfg index 1cbb8481..f05c6cd5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,12 +33,13 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Topic :: Scientific/Engineering Topic :: Scientific/Engineering :: Physics Typing :: Typed [options] -python_requires = >=3.6, <3.10 +python_requires = >=3.6 setup_requires = setuptools_scm install_requires =