Skip to content

Commit

Permalink
Test with Python 3.9 and TF 2.5 (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
uri-granta authored Feb 7, 2022
1 parent ce84c5e commit 4983914
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 15 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/develop-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@ jobs:
with:
python-version: 3.7
- run: pip install tox
- run: tox -e alltests
- run: tox -e tests -- --runslow yes

alltests_latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: pip install tox
- run: tox -e tests_latest -- --runslow yes

fulldocs:
runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/quality-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ jobs:
- run: pip install tox
- run: tox -e tests

tests_latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: pip install tox
- run: tox -e tests_latest

docs:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $ tox -e tests

To save time, some slower tests are not run by default. Run these with:
```bash
$ tox -e alltests
$ tox -e tests -- --runslow yes
```

#### Code formatting
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# ping sphinx to 3.5 for now to work around https://github.com/plotly/plotly.js/issues/4563
# pin sphinx to 3.5 for now to work around https://github.com/plotly/plotly.js/issues/4563
# setting mathjax_path in docs/confg.py to https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML
# SHOULD fix this, but it doesn't seem to quite
sphinx~=3.5.4
Expand Down
1 change: 1 addition & 0 deletions generate_constraints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ 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/latest true

rm -rf $VENV_DIR
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
install_requires=[
"absl-py",
"gpflow==2.2.*",
"gpflux==0.2.3",
"gpflux>=0.2.3",
"numpy",
"tensorflow>=2.4",
"tensorflow-probability>=0.12,<0.14.0",
"tensorflow-probability>=0.12",
"greenlet>=1.1.0",
],
)
59 changes: 59 additions & 0 deletions tests/latest/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
absl-py==0.15.0
astunparse==1.6.3
attrs==21.4.0
cached-property==1.5.2
cachetools==5.0.0
certifi==2021.10.8
charset-normalizer==2.0.11
cloudpickle==2.0.0
dataclasses==0.6
decorator==5.1.1
Deprecated==1.2.13
dm-tree==0.1.6
flatbuffers==1.12
gast==0.4.0
google-auth==2.6.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
gpflow==2.2.1
gpflux==0.2.7
greenlet==1.1.2
grpcio==1.34.1
h5py==3.1.0
idna==3.3
importlib-metadata==4.10.1
iniconfig==1.1.1
keras-nightly==2.5.0.dev2021032900
Keras-Preprocessing==1.1.2
Markdown==3.3.6
multipledispatch==0.6.0
numpy==1.19.5
oauthlib==3.2.0
opt-einsum==3.3.0
packaging==21.3
pluggy==1.0.0
protobuf==3.19.4
py==1.11.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==3.0.7
pytest==6.2.5
requests==2.27.1
requests-oauthlib==1.3.1
rsa==4.8
scipy==1.7.3
six==1.15.0
tabulate==0.8.9
tensorboard==2.8.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.5.3
tensorflow-estimator==2.5.0
tensorflow-probability==0.13.0
termcolor==1.1.0
toml==0.10.2
typing-extensions==3.7.4.3
urllib3==1.26.8
Werkzeug==2.0.2
wrapt==1.12.1
zipp==3.7.0
16 changes: 16 additions & 0 deletions tests/latest/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 The Trieste Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

packaging
pytest
6 changes: 5 additions & 1 deletion tests/unit/models/gpflow/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,11 @@ def test_gaussian_process_regression_correctly_counts_params_that_can_be_sampled
prior_for_lengthscale: bool,
) -> None:
x = tf.constant(np.arange(1, 5 * dim + 1).reshape(-1, dim), dtype=tf.float64) # shape: [5, d]
model = GaussianProcessRegression(gpr_model(x, fnc_3x_plus_10(x)))
optimizer = Optimizer(
optimizer=gpflow.optimizers.Scipy(),
minimize_args={"options": dict(maxiter=10)},
)
model = GaussianProcessRegression(gpr_model(x, fnc_3x_plus_10(x)), optimizer=optimizer)
model.model.kernel = gpflow.kernels.RBF(lengthscales=tf.ones([dim], dtype=tf.float64))
model.model.likelihood.variance.assign(1.0)
gpflow.set_trainable(model.model.likelihood, True)
Expand Down
25 changes: 16 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,36 @@ extend-exclude = docs/notebooks/,.venv

[testenv]
basepython = python3.7
deps = pip~=20.3
deps = pip
whitelist_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: mypy
types: mypy {posargs}
# 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: pip install -U pip
# tests (run with "-- --runslow yes" to run all tests)
tests: pip install . -r tests/requirements.txt -c tests/constraints.txt
tests: pytest
alltests: pip install -U pip
alltests: pip install . -r tests/requirements.txt -c tests/constraints.txt
alltests: pytest --runslow yes
docs: pip install -U pip
tests: pytest {posargs}
# docs build
docs: pip install . -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"
quickdocs: pip install -U pip
# quickdocs build
quickdocs: pip install . -r notebooks/requirements.txt -c notebooks/constraints.txt
quickdocs: pip install -r docs/requirements.txt -c docs/constraints.txt
quickdocs: bash -c "cd docs; python notebooks/quickrun/quickrun.py; if make html; then python notebooks/quickrun/quickrun.py --revert; else python notebooks/quickrun/quickrun.py --revert; exit 1; fi"

[testenv:tests_latest]
basepython = python3.9
commands =
# test but with python 3.9 and latest supported version of tensorflow
tests_latest: pip install . -r tests/latest/requirements.txt -c tests/latest/constraints.txt
tests_latest: pytest {posargs}

0 comments on commit 4983914

Please sign in to comment.