Skip to content

Commit

Permalink
bump to minimum python version to 3.10 and test 3.12 (#2293)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
sdaulton authored and facebook-github-bot committed Apr 11, 2024
1 parent e8cbbae commit 404d869
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build:

requirements:
host:
- python>=3.9
- python>=3.10
- setuptools
- setuptools_scm
run:
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/deploy_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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)
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable_tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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)
Expand All @@ -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
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/test_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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={
Expand Down
5 changes: 1 addition & 4 deletions test/acquisition/test_decoupled.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 404d869

Please sign in to comment.