From 51dc954b63b9691f6ee6090007006f062a9562ff Mon Sep 17 00:00:00 2001 From: uri-granta <50578464+uri-granta@users.noreply.github.com> Date: Wed, 15 Feb 2023 12:27:59 +0000 Subject: [PATCH] Upgrade more tox jobs to 3.10 and rename a couple (#696) --- .github/workflows/develop-checks.yaml | 8 ++-- .github/workflows/quality-checks.yaml | 18 ++++---- docs/README.md | 2 + docs/constraints.txt | 43 +++---------------- docs/notebooks/constraints.txt | 54 ++++++++++++++++-------- docs/notebooks/requirements.txt | 4 -- docs/requirements.txt | 4 -- generate_constraints.sh | 2 +- tests/{ => old}/constraints.txt | 0 tests/{ => old}/requirements.txt | 2 +- tox.ini | 59 ++++++++++++++++++--------- 11 files changed, 97 insertions(+), 99 deletions(-) rename tests/{ => old}/constraints.txt (100%) rename tests/{ => old}/requirements.txt (94%) diff --git a/.github/workflows/develop-checks.yaml b/.github/workflows/develop-checks.yaml index 49902943ec..ff9f47a63b 100644 --- a/.github/workflows/develop-checks.yaml +++ b/.github/workflows/develop-checks.yaml @@ -25,19 +25,19 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.7" + python-version: "3.10" - run: pip install tox - run: tox -e tests -- --runslow only - slowtests_latest: + slowtests_old: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.7" - run: pip install tox - - run: tox -e tests_latest -- --runslow only + - run: tox -e tests_old -- --runslow only fulldocs: runs-on: ubuntu-latest diff --git a/.github/workflows/quality-checks.yaml b/.github/workflows/quality-checks.yaml index c8fc7e9d6f..bc69645eab 100644 --- a/.github/workflows/quality-checks.yaml +++ b/.github/workflows/quality-checks.yaml @@ -24,19 +24,19 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.7" + python-version: "3.10" - run: pip install tox - run: tox -e types - types_latest: + types_old: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.7" - run: pip install tox - - run: tox -e types_latest + - run: tox -e types_old format: runs-on: ubuntu-latest @@ -44,7 +44,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.7" + python-version: "3.10" - run: pip install tox - run: tox -e format @@ -54,19 +54,19 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.7" + python-version: "3.10" - run: pip install tox - run: tox -e tests - tests_latest: + tests_old: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.7" - run: pip install tox - - run: tox -e tests_latest + - run: tox -e tests_old docs: runs-on: ubuntu-latest diff --git a/docs/README.md b/docs/README.md index d4e52b1221..6eb70e4f78 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,7 @@ # Building documentation +> **Note: though trieste itself supports any version of Python from 3.7 onwards, the trieste documentation currently only builds using Python 3.7 or 3.8.** + To build the documentation, ensure you have both [tox](https://tox.readthedocs.io) and [pandoc](https://github.com/jgm/pandoc/releases/) installed. Then run the following from the repository root directory: diff --git a/docs/constraints.txt b/docs/constraints.txt index 9d5664d2ee..f6c17c39c1 100644 --- a/docs/constraints.txt +++ b/docs/constraints.txt @@ -1,29 +1,17 @@ -absl-py==1.4.0 alabaster==0.7.13 -astroid==2.13.3 -astunparse==1.6.3 +astroid==2.14.2 attrs==22.2.0 Babel==2.11.0 backcall==0.2.0 -beautifulsoup4==4.11.1 +beautifulsoup4==4.11.2 bleach==6.0.0 -cachetools==5.3.0 certifi==2022.12.7 charset-normalizer==3.0.1 -cloudpickle==2.2.1 decorator==5.1.1 defusedxml==0.7.1 -dm-tree==0.1.8 docutils==0.16 entrypoints==0.4 fastjsonschema==2.16.2 -flatbuffers==23.1.21 -gast==0.5.3 -google-auth==2.16.0 -google-auth-oauthlib==0.4.6 -google-pasta==0.2.0 -grpcio==1.51.1 -h5py==3.8.0 idna==3.4 imagesize==1.4.1 importlib-metadata==4.13.0 @@ -35,23 +23,16 @@ jsonschema==4.17.3 jupyter_client==7.4.9 jupyter_core==4.12.0 jupyterlab-pygments==0.2.2 -keras==2.8.0 -Keras-Preprocessing==1.1.2 latexcodec==2.0.1 lazy-object-proxy==1.9.0 -libclang==15.0.6.1 -Markdown==3.4.1 MarkupSafe==2.1.2 matplotlib-inline==0.1.6 -mistune==2.0.4 +mistune==2.0.5 nbclient==0.7.2 nbconvert==7.2.9 nbformat==5.7.3 nbsphinx==0.8.12 nest-asyncio==1.5.6 -numpy==1.21.6 -oauthlib==3.2.2 -opt-einsum==3.3.0 packaging==23.0 pandocfilters==1.5.0 parso==0.8.3 @@ -59,10 +40,7 @@ pexpect==4.8.0 pickleshare==0.7.5 pkgutil_resolve_name==1.3.10 prompt-toolkit==3.0.36 -protobuf==3.19.6 ptyprocess==0.7.0 -pyasn1==0.4.8 -pyasn1-modules==0.2.8 pybtex==0.24.0 pybtex-docutils==1.0.2 pydata-sphinx-theme==0.8.1 @@ -73,8 +51,6 @@ pytz==2022.7.1 PyYAML==6.0 pyzmq==25.0.0 requests==2.28.2 -requests-oauthlib==1.3.1 -rsa==4.9 six==1.16.0 snowballstemmer==2.2.0 soupsieve==2.3.2.post1 @@ -87,23 +63,14 @@ sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -tensorboard==2.8.0 -tensorboard-data-server==0.6.1 -tensorboard-plugin-wit==1.8.1 -tensorflow==2.8.4 -tensorflow-estimator==2.8.0 -tensorflow-io-gcs-filesystem==0.30.0 -tensorflow-probability==0.13.0 -termcolor==2.2.0 tinycss2==1.2.1 tornado==6.2 -traitlets==5.8.1 +traitlets==5.9.0 typed-ast==1.5.4 typing_extensions==4.4.0 Unidecode==1.3.6 urllib3==1.26.14 wcwidth==0.2.6 webencodings==0.5.1 -Werkzeug==2.2.2 wrapt==1.14.1 -zipp==3.12.0 +zipp==3.13.0 diff --git a/docs/notebooks/constraints.txt b/docs/notebooks/constraints.txt index 1b903ea9a4..604c9f633f 100644 --- a/docs/notebooks/constraints.txt +++ b/docs/notebooks/constraints.txt @@ -1,12 +1,15 @@ about-time==4.2.1 absl-py==1.4.0 -aiohttp==3.8.3 +aiofiles==22.1.0 +aiohttp==3.8.4 aiohttp-cors==0.7.0 aiosignal==1.3.1 +aiosqlite==0.18.0 alive-progress==3.0.1 anyio==3.6.2 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 +arrow==1.2.3 astunparse==1.6.3 async-timeout==4.0.2 asynctest==0.13.0 @@ -14,14 +17,15 @@ attrs==22.2.0 autograd==1.5 Babel==2.11.0 backcall==0.2.0 -beautifulsoup4==4.11.1 +beautifulsoup4==4.11.2 bleach==6.0.0 -blessed==1.19.1 +blessed==1.20.0 Box2D==2.3.10 +cached-property==1.5.2 cachetools==5.3.0 certifi==2022.12.7 cffi==1.15.1 -charset-normalizer==2.1.1 +charset-normalizer==3.0.1 check-shapes==1.0.0 click==8.1.3 cloudpickle==2.2.1 @@ -42,6 +46,7 @@ fastjsonschema==2.16.2 filelock==3.9.0 flatbuffers==23.1.21 fonttools==4.38.0 +fqdn==1.5.1 frozenlist==1.3.3 future==0.18.3 gast==0.4.0 @@ -64,18 +69,24 @@ importlib-resources==5.10.2 ipykernel==6.16.2 ipython==7.34.0 ipython-genutils==0.2.0 +isoduration==20.11.0 jedi==0.18.2 Jinja2==3.0.3 json5==0.9.11 +jsonpointer==2.3 jsonschema==4.17.3 +jupyter-events==0.5.0 jupyter-server==1.23.5 +jupyter-ydoc==0.2.2 jupyter_client==7.4.9 jupyter_core==4.12.0 -jupyterlab==3.5.3 +jupyter_server_fileid==0.6.0 +jupyter_server_ydoc==0.6.1 +jupyterlab==3.6.1 jupyterlab-pygments==0.2.2 jupyterlab_server==2.19.0 jupytext==1.14.4 -keras==2.8.0 +keras==2.10.0 Keras-Preprocessing==1.1.2 kiwisolver==1.4.4 lark==1.1.5 @@ -87,7 +98,7 @@ matplotlib==3.5.3 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.3 mdurl==0.1.2 -mistune==2.0.4 +mistune==2.0.5 msgpack==1.0.4 multidict==6.0.4 multipledispatch==0.6.0 @@ -113,7 +124,7 @@ pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.4.0 pkgutil_resolve_name==1.3.10 -platformdirs==2.6.2 +platformdirs==3.0.0 plotly==5.13.0 prometheus-client==0.13.1 prompt-toolkit==3.0.36 @@ -130,6 +141,7 @@ pymoo==0.6.0.1 pyparsing==3.0.9 pyrsistent==0.19.3 python-dateutil==2.8.2 +python-json-logger==2.0.6 pytz==2022.7.1 PyYAML==6.0 pyzmq==25.0.0 @@ -137,6 +149,8 @@ qdldl==0.1.5.post3 ray==2.2.0 requests==2.28.2 requests-oauthlib==1.3.1 +rfc3339-validator==0.1.4 +rfc3986-validator==0.1.1 rsa==4.9 scipy==1.7.3 scs==3.2.2 @@ -144,30 +158,34 @@ Send2Trash==1.8.0 six==1.16.0 smart-open==6.3.0 sniffio==1.3.0 -soupsieve==2.3.2.post1 +soupsieve==2.4 tabulate==0.9.0 -tenacity==8.1.0 -tensorboard==2.8.0 +tenacity==8.2.1 +tensorboard==2.10.1 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 -tensorflow==2.8.4 -tensorflow-estimator==2.8.0 +tensorflow==2.10.1 +tensorflow-estimator==2.10.0 tensorflow-io-gcs-filesystem==0.30.0 -tensorflow-probability==0.13.0 +tensorflow-probability==0.18.0 termcolor==2.2.0 terminado==0.17.1 tinycss2==1.2.1 toml==0.10.2 tomli==2.0.1 tornado==6.2 -traitlets==5.8.1 +traitlets==5.9.0 typing_extensions==4.4.0 +uri-template==1.2.0 urllib3==1.26.14 -virtualenv==20.17.1 +virtualenv==20.19.0 wcwidth==0.2.6 +webcolors==1.12 webencodings==0.5.1 -websocket-client==1.5.0 +websocket-client==1.5.1 Werkzeug==2.2.2 wrapt==1.14.1 +y-py==0.5.5 yarl==1.8.2 -zipp==3.12.0 +ypy-websocket==0.8.2 +zipp==3.13.0 diff --git a/docs/notebooks/requirements.txt b/docs/notebooks/requirements.txt index 993fc43ece..fc62f3ba48 100644 --- a/docs/notebooks/requirements.txt +++ b/docs/notebooks/requirements.txt @@ -22,7 +22,3 @@ jupyterlab jupytext gym<0.22 box2d - -# pin to version of TF used in prod -tensorflow ~= 2.8.0 -tensorflow-probability ~= 0.13.0 diff --git a/docs/requirements.txt b/docs/requirements.txt index 6783d91e50..21594f023e 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -23,7 +23,3 @@ pydata-sphinx-theme ipython nbsphinx sphinxcontrib-bibtex - -# pin to version of TF used in prod -tensorflow ~= 2.8.0 -tensorflow-probability ~= 0.13.0 diff --git a/generate_constraints.sh b/generate_constraints.sh index a3171d981d..e5175ec4cd 100755 --- a/generate_constraints.sh +++ b/generate_constraints.sh @@ -40,7 +40,7 @@ generate_for_env common_build/format false generate_for_env common_build/taskipy false generate_for_env common_build/types false generate_for_env notebooks true -generate_for_env tests true +generate_for_env tests/old true generate_for_env tests/latest true rm -rf $VENV_DIR diff --git a/tests/constraints.txt b/tests/old/constraints.txt similarity index 100% rename from tests/constraints.txt rename to tests/old/constraints.txt diff --git a/tests/requirements.txt b/tests/old/requirements.txt similarity index 94% rename from tests/requirements.txt rename to tests/old/requirements.txt index 747e7e9734..11bdf0e5f9 100644 --- a/tests/requirements.txt +++ b/tests/old/requirements.txt @@ -16,6 +16,6 @@ packaging pytest PyYAML -# pin to version of TF used in prod +# pin to older version of TF (for now) tensorflow ~= 2.8.0 tensorflow-probability ~= 0.13.0 diff --git a/tox.ini b/tox.ini index 4e78146a43..5582eb064c 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ per-file-ignores = __init__.py: F401 extend-exclude = docs/notebooks/,.venv,build/ [testenv] -basepython = python3.7 +basepython = python3.10 deps = # pinned for now due to https://github.com/openai/gym/issues/3176 setuptools==65.6.3 @@ -32,40 +32,59 @@ allowlist_externals = bash setenv = CUDA_VISIBLE_DEVICES = commands = - # type checking - types: pip install -r common_build/types/requirements.txt -c common_build/types/constraints.txt - types: pip install . -r tests/requirements.txt -c tests/constraints.txt - types: mypy {posargs} - # formatting + # check formatting format: pip install -r common_build/format/requirements.txt -c common_build/format/constraints.txt format: black --check . format: flake8 --count . format: isort --check . format: black -l 80 --include \.pct\.py$ --check notebooks - # tests (run with "-- --runslow yes" to run all tests) - tests: pip install . -r tests/requirements.txt -c tests/constraints.txt - tests: pytest --ignore trieste/experimental {posargs} + # do formatting + reformat: black . + reformat: flake8 . + reformat: isort . + reformat: black -l 80 notebooks/*pct.py + # check types + types: pip install -r common_build/types/requirements.txt -c common_build/types/constraints.txt + types: pip install . -r tests/latest/requirements.txt -c tests/latest/constraints.txt + types: mypy {posargs} + # run tests (run with "-- --runslow yes" to run all tests) + tests: pip install .[qhsri] -r tests/latest/requirements.txt -c tests/latest/constraints.txt + tests: pytest --ignore trieste/experimental --qhsri yes {posargs} + +# TODO: migrate docs builds to 3.10 after working around the following issues: +# 1. we currently pin sphinx to 3.5.4 to work around +# https://github.com/plotly/plotly.js/issues/4563, but that version breaks with Python 3.10 +# 2. we currently pin pandas to <1.0.0 (and rely on it), which similarly breaks with Pytho 3.10 +# 3. we depend on box2d, which doesn't provide wheels for Python 3.10 or a source package +# see https://stackoverflow.com/questions/70323852/error-trying-to-install-python-package-box2d + +[testenv:docs] +basepython = python3.7 +commands = # docs build docs: pip install .[qhsri] -r notebooks/requirements.txt -c notebooks/constraints.txt docs: pip install -r docs/requirements.txt -c docs/constraints.txt docs: bash -c "cd docs; make html" + +[testenv:quickdocs] +basepython = python3.7 +commands = # quickdocs build quickdocs: pip install .[qhsri] -r notebooks/requirements.txt -c notebooks/constraints.txt quickdocs: pip install -r docs/requirements.txt -c docs/constraints.txt quickdocs: bash -c "cd docs; if (python notebooks/quickrun/quickrun.py && make html); then python notebooks/quickrun/quickrun.py --revert; else python notebooks/quickrun/quickrun.py --revert; exit 1; fi" -[testenv:tests_latest] -basepython = python3.10 +[testenv:tests_old] +basepython = python3.7 commands = - # test but with python 3.10 and latest supported library versions - # unlike tests this includes the optional qhsri support - tests_latest: pip install .[qhsri] -r tests/latest/requirements.txt -c tests/latest/constraints.txt - tests_latest: pytest --ignore trieste/experimental --qhsri yes {posargs} + # unlike tests_latest this doesn't include the optional qhsri support + tests_old: pip install . -r tests/old/requirements.txt -c tests/old/constraints.txt + tests_old: pytest --ignore trieste/experimental {posargs} -[testenv:types_latest] -basepython = python3.10 +[testenv:types_old] +basepython = python3.7 commands = # test but with python 3.10 and latest supported tensorflow and numpy versions - types_latest: pip install -r common_build/types/requirements.txt -c common_build/types/constraints.txt - types_latest: pip install . -r tests/latest/requirements.txt -c tests/latest/constraints.txt - types_latest: mypy {posargs} + types_old: pip install -r common_build/types/requirements.txt -c common_build/types/constraints.txt + types_old: pip install . -r tests/old/requirements.txt -c tests/old/constraints.txt + types_old: mypy {posargs}