From 404d869a72b8ca6a775f4d7469a62aa9dc0a5795 Mon Sep 17 00:00:00 2001 From: Sam Daulton Date: Thu, 11 Apr 2024 11:46:00 -0700 Subject: [PATCH] bump to minimum python version to 3.10 and test 3.12 (#2293) Summary: ## Motivation Bump minimum version of python from 3.9 -> 3.10 and start testing 3.12, since scientific python is no longer supporting py3.9: https://scientific-python.org/specs/spec-0000/ ### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)? (Write your answer here.) Pull Request resolved: https://github.com/pytorch/botorch/pull/2293 Test Plan: Circle CI, running manual nightly job: https://github.com/sdaulton/botorch/actions/runs/8638469226 Reviewed By: saitcakmak Differential Revision: D55991521 Pulled By: sdaulton fbshipit-source-id: b89054c8a74848b3193d890adc7a35d090e623a0 --- .conda/meta.yaml | 2 +- .github/workflows/deploy_on_release.yml | 11 ++++------- .github/workflows/docs.yml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/nightly.yml | 11 ++++------- .github/workflows/reusable_tutorials.yml | 4 ++-- .github/workflows/reusable_website.yml | 2 +- .github/workflows/test.yml | 12 +++--------- .github/workflows/test_stable.yml | 15 +++------------ CONTRIBUTING.md | 2 +- README.md | 2 +- setup.py | 4 ++-- test/acquisition/test_decoupled.py | 5 +---- 13 files changed, 26 insertions(+), 50 deletions(-) diff --git a/.conda/meta.yaml b/.conda/meta.yaml index d524bcfc7f..c69916e157 100644 --- a/.conda/meta.yaml +++ b/.conda/meta.yaml @@ -13,7 +13,7 @@ build: requirements: host: - - python>=3.9 + - python>=3.10 - setuptools - setuptools_scm run: diff --git a/.github/workflows/deploy_on_release.yml b/.github/workflows/deploy_on_release.yml index 50e227f28a..383d385883 100644 --- a/.github/workflows/deploy_on_release.yml +++ b/.github/workflows/deploy_on_release.yml @@ -15,10 +15,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.9", "3.11"] - exclude: - - os: "macos-14" - python-version: "3.9" # not available for macos-14 + python-version: ["3.10", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -32,7 +29,7 @@ jobs: run: | pytest -ra --cov=. --cov-report term-missing - name: Upload coverage - if: ${{ runner.os == 'Linux' && matrix.python-version == 3.9 }} + if: ${{ runner.os == 'Linux' && matrix.python-version == 3.10 }} run: | bash <(curl -s https://codecov.io/bash) @@ -49,7 +46,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install dependencies run: | pip install .[test] @@ -79,7 +76,7 @@ jobs: with: miniconda-version: "latest" activate-environment: test - python-version: "3.9" + python-version: "3.10" - name: Fetch all history for all tags and branches run: git fetch --prune --unshallow - name: Install dependencies diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 65c576a6fd..d2aa3d4e31 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install dependencies env: ALLOW_LATEST_GPYTORCH_LINOP: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a200db7e0b..4459b4f0ae 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install dependencies run: | # pin dependencies to match Meta-internal versions @@ -40,7 +40,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install dependencies run: | pip install flake8 flake8-docstrings diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d8ab109e81..357f17f83e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,10 +15,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.9", "3.11"] - exclude: - - os: "macos-14" - python-version: "3.9" # not available for macos-14 + python-version: ["3.10", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -37,7 +34,7 @@ jobs: run: | pytest -ra --cov=. --cov-report term-missing - name: Upload coverage - if: ${{ runner.os == 'Linux' && matrix.python-version == 3.9 }} + if: ${{ runner.os == 'Linux' && matrix.python-version == 3.10 }} run: | bash <(curl -s https://codecov.io/bash) @@ -53,7 +50,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.10 - name: Install dependencies env: ALLOW_LATEST_GPYTORCH_LINOP: true @@ -99,7 +96,7 @@ jobs: with: miniconda-version: "latest" activate-environment: test - python-version: "3.9" + python-version: "3.10" - name: Fetch all history for all tags and branches run: git fetch --prune --unshallow - name: Install dependencies diff --git a/.github/workflows/reusable_tutorials.yml b/.github/workflows/reusable_tutorials.yml index 50e8aa38dc..221b0cd480 100644 --- a/.github/workflows/reusable_tutorials.yml +++ b/.github/workflows/reusable_tutorials.yml @@ -43,14 +43,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Fetch all history for all tags and branches # We need to do this so setuptools_scm knows how to set the BoTorch version. run: git fetch --prune --unshallow - if: ${{ !inputs.use_stable_pytorch_gpytorch }} name: Install latest PyTorch & GPyTorch run: | - pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + pip install torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html pip install git+https://github.com/cornellius-gp/linear_operator.git pip install git+https://github.com/cornellius-gp/gpytorch.git - if: ${{ inputs.use_stable_pytorch_gpytorch }} diff --git a/.github/workflows/reusable_website.yml b/.github/workflows/reusable_website.yml index 4a3a3a4568..81a8692467 100644 --- a/.github/workflows/reusable_website.yml +++ b/.github/workflows/reusable_website.yml @@ -29,7 +29,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.10 - name: Fetch all history for all tags and branches run: git fetch --prune --unshallow - if: ${{ !inputs.publish_versioned_website }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29f53e63f2..cc50b01e99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,10 +16,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.9", "3.11"] - exclude: - - os: "macos-14" - python-version: "3.9" # not available for macos-14 + python-version: ["3.10", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -38,7 +35,7 @@ jobs: run: | pytest -ra --cov=. --cov-report term-missing - name: Upload coverage - if: ${{ runner.os == 'Linux' && matrix.python-version == 3.9 }} + if: ${{ runner.os == 'Linux' && matrix.python-version == 3.10 }} run: | bash <(curl -s https://codecov.io/bash) @@ -49,10 +46,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.9", "3.11"] - exclude: - - os: "macos-14" - python-version: "3.9" # not available for macos-14 + python-version: ["3.10", "3.12"] steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 diff --git a/.github/workflows/test_stable.yml b/.github/workflows/test_stable.yml index b2dc5a45ec..7bc6aea9b9 100644 --- a/.github/workflows/test_stable.yml +++ b/.github/workflows/test_stable.yml @@ -12,10 +12,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.9", "3.11"] - exclude: - - os: "macos-14" - python-version: "3.9" # not available for macos-14 + python-version: ["3.10", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -37,10 +34,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.9", "3.11"] - exclude: - - os: "macos-14" - python-version: "3.9" # not available for macos-14 + python-version: ["3.10", "3.12"] steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 @@ -70,10 +64,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-14"] - python-version: ["3.9", "3.11"] - exclude: - - os: "macos-14" - python-version: "3.9" # not available for macos-14 + python-version: ["3.10", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9b706dba73..e1702a91a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,7 +50,7 @@ every `__init__` function contains an `Args:` block. We use the #### Type Hints -BoTorch is fully typed using python 3.9+ +BoTorch is fully typed using python 3.10+ [type hints](https://www.python.org/dev/peps/pep-0484/). We expect any contributions to also use proper type annotations. While we currently do not enforce full consistency of these in our continuous integration test, you should diff --git a/README.md b/README.md index 1d8a3ef862..76dc20684f 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Optimization simply use Ax. ## Installation **Installation Requirements** -- Python >= 3.9 +- Python >= 3.10 - PyTorch >= 1.13.1 - gpytorch == 1.11 - linear_operator == 0.5.1 diff --git a/setup.py b/setup.py index 144230ce45..fb06d97d5c 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ # Minimum required python version REQUIRED_MAJOR = 3 -REQUIRED_MINOR = 9 +REQUIRED_MINOR = 10 # Requirements for testing, formatting, and tutorials TEST_REQUIRES = ["pytest", "pytest-cov"] @@ -98,7 +98,7 @@ def read_deps_from_file(filname): ], long_description=long_description, long_description_content_type="text/markdown", - python_requires=">=3.9", + python_requires=f">={REQUIRED_MAJOR}.{REQUIRED_MINOR}", packages=find_packages(exclude=["test", "test.*"]), install_requires=install_requires, extras_require={ diff --git a/test/acquisition/test_decoupled.py b/test/acquisition/test_decoupled.py index bf15ea3469..a0020b27f3 100644 --- a/test/acquisition/test_decoupled.py +++ b/test/acquisition/test_decoupled.py @@ -22,10 +22,7 @@ def forward(self, X): class TestDecoupledAcquisitionFunction(BotorchTestCase): def test_decoupled_acquisition_function(self): - msg = ( - "Can't instantiate abstract class DecoupledAcquisitionFunction" - " with abstract method forward" - ) + msg = "Can't instantiate abstract class DecoupledAcquisitionFunction" with self.assertRaisesRegex(TypeError, msg): DecoupledAcquisitionFunction() # test raises error if model is not ModelList