From 6c55ba4ca3503ed5968e370fc63ceab43826ba34 Mon Sep 17 00:00:00 2001 From: phi Date: Wed, 12 Feb 2025 00:32:31 +0900 Subject: [PATCH 1/7] chore: upgrade poetry2.0 & apply pep621 --- pyproject.toml | 51 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 884c3ac48..dc0b8d9d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,24 +1,35 @@ -[tool.poetry] +[project] name = "bayesian-optimization" version = "3.0.0b1" description = "Bayesian Optimization package" -authors = ["Fernando Nogueira"] -license = "MIT" +authors = [{ name = "Fernando Nogueira", email = "fmfnogueira@gmail.com" }] +license = { file = "LICENSE" } readme = "README.md" -packages = [{include = "bayes_opt"}] - -[tool.poetry.dependencies] -python = "^3.9" -scikit-learn = "^1.0.0" -numpy = ">=1.25" -scipy = [ - {version = "^1.0.0", python = "<3.13"}, - {version = "^1.14.1", python = ">=3.13"} +requires-python = ">=3.9,<4.0" +classifiers = [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +dependencies = [ + "scikit-learn>=1.0.0,<2.0.0", + "numpy>=1.25", + "scipy>=1.0.0,<2.0.0; python_version<'3.13'", + "scipy>=1.14.1,<2.0.0; python_version>='3.13'", + "colorama>=0.4.6,<1.0.0", ] -colorama = "^0.4.6" + +[tool.poetry] +requires-poetry = ">=2.0" +packages = [{ include = "bayes_opt" }] -[tool.poetry.group.dev] # for testing/developing +[tool.poetry.group.dev] # for testing/developing optional = true [tool.poetry.group.dev.dependencies] pytest = "^8.0.0" @@ -28,7 +39,7 @@ ruff = "0.6.6" pre-commit = "^3.7.1" -[tool.poetry.group.nbtools] # for running/converting notebooks +[tool.poetry.group.nbtools] # for running/converting notebooks optional = true [tool.poetry.group.nbtools.dependencies] nbformat = "^5.9.2" @@ -38,17 +49,17 @@ matplotlib = "^3.0" nbsphinx = "^0.9.4" sphinx-immaterial = "^0.12.0" sphinx = [ - {version = "^7.0.0", python = "<3.10"}, - {version = "^8.0.0", python = ">=3.10"} + { version = "^7.0.0", python = "<3.10" }, + { version = "^8.0.0", python = ">=3.10" }, ] sphinx-autodoc-typehints = [ - {version = "^2.3.0", python = "<3.10"}, - {version = "^2.4.0", python = ">=3.10"} + { version = "^2.3.0", python = "<3.10" }, + { version = "^2.4.0", python = ">=3.10" }, ] [build-system] -requires = ["poetry-core"] +requires = ["poetry-core>=2.0"] build-backend = "poetry.core.masonry.api" [tool.coverage.report] From dfc12bf4f6e3279492416ce1df1290e5f0fd3003 Mon Sep 17 00:00:00 2001 From: phi Date: Wed, 12 Feb 2025 01:01:23 +0900 Subject: [PATCH 2/7] fix: replace poetry action(not support 2.0) --- .github/workflows/build_docs.yml | 7 ++++++- .github/workflows/format_and_lint.yml | 7 ++++++- .github/workflows/run_tests.yml | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 43e7d988e..58ea75299 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -26,8 +26,13 @@ jobs: uses: olegtarasov/get-tag@v2.1 - name: Install pandoc run: sudo apt-get install -y pandoc + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" - name: Install Poetry - uses: snok/install-poetry@v1 + run: | + uv tool install poetry - name: Install package and test dependencies run: | poetry install --with dev,nbtools diff --git a/.github/workflows/format_and_lint.yml b/.github/workflows/format_and_lint.yml index 7a870481a..b4fbbea64 100644 --- a/.github/workflows/format_and_lint.yml +++ b/.github/workflows/format_and_lint.yml @@ -17,8 +17,13 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.9" + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" - name: Install Poetry - uses: snok/install-poetry@v1 + run: | + uv tool install poetry - name: Install dependencies run: | poetry install --with dev diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 8501d8cd6..1d13bea5d 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -26,8 +26,13 @@ jobs: uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" - name: Install Poetry - uses: snok/install-poetry@v1 + run: | + uv tool install poetry - name: Install test dependencies run: | poetry add "numpy${{ matrix.numpy-version }}" From 61e728cab507e7a143d1965d49397be0b09e7258 Mon Sep 17 00:00:00 2001 From: phi Date: Wed, 12 Feb 2025 01:04:51 +0900 Subject: [PATCH 3/7] fix: exclude one matrix --- .github/workflows/run_tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 1d13bea5d..340e05360 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -19,6 +19,9 @@ jobs: matrix: python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] numpy-version: [">=1.25,<2", ">=2"] + exclude: + - python-version: "3.13" + numpy-version: ">=1.25,<2" # numpy<2 is not supported on Python 3.13 steps: - uses: actions/checkout@v3 From 1775f1aeb747a5c01880774e87d6bf64410d0879 Mon Sep 17 00:00:00 2001 From: phi Date: Wed, 12 Feb 2025 01:12:08 +0900 Subject: [PATCH 4/7] chore: split numpy deps --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dc0b8d9d3..a1ff1d7be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,8 @@ classifiers = [ ] dependencies = [ "scikit-learn>=1.0.0,<2.0.0", - "numpy>=1.25", + "numpy>=1.25; python_version<'3.13'", + "numpy>=2.1.3; python_version>='3.13'", "scipy>=1.0.0,<2.0.0; python_version<'3.13'", "scipy>=1.14.1,<2.0.0; python_version>='3.13'", "colorama>=0.4.6,<1.0.0", From 851fff5468c6a6920e12598fc39b380e26927d6f Mon Sep 17 00:00:00 2001 From: phi Date: Wed, 12 Feb 2025 01:49:16 +0900 Subject: [PATCH 5/7] fix: numpy constraints --- .github/workflows/run_tests.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 340e05360..984c03af7 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -38,8 +38,13 @@ jobs: uv tool install poetry - name: Install test dependencies run: | - poetry add "numpy${{ matrix.numpy-version }}" - poetry install --with dev,nbtools + poetry self add poetry-plugin-export + poetry export -f requirements.txt --with dev,nbtools --without-hashes --output requirements-dev.txt + echo "numpy${{ matrix.numpy-version }}" >> constraints.txt + uv pip compile requirements-dev.txt --output-file requirements.txt \ + --python-version ${{ matrix.python-version }} \ + --override constraints.txt + poetry run pip install -r requirements.txt - name: Test with pytest run: | poetry run pytest --cov-report xml --cov=bayes_opt/ From 8b5f16799caf851f37fdec04163a251f329f9f3d Mon Sep 17 00:00:00 2001 From: phi Date: Wed, 12 Feb 2025 01:49:27 +0900 Subject: [PATCH 6/7] fix: install root --- .github/workflows/run_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 984c03af7..411385902 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -45,6 +45,7 @@ jobs: --python-version ${{ matrix.python-version }} \ --override constraints.txt poetry run pip install -r requirements.txt + poetry install --only-root - name: Test with pytest run: | poetry run pytest --cov-report xml --cov=bayes_opt/ From 8dce4662f3aa0850483454485c5359032ea03104 Mon Sep 17 00:00:00 2001 From: phi Date: Thu, 27 Feb 2025 23:31:08 +0900 Subject: [PATCH 7/7] chore: use install-poetry --- .github/workflows/build_docs.yml | 9 +++------ .github/workflows/format_and_lint.yml | 9 +++------ .github/workflows/run_tests.yml | 5 +++-- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 58ea75299..4227baf14 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -26,13 +26,10 @@ jobs: uses: olegtarasov/get-tag@v2.1 - name: Install pandoc run: sudo apt-get install -y pandoc - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v5 - with: - version: "latest" - name: Install Poetry - run: | - uv tool install poetry + uses: snok/install-poetry@v1 + with: + version: 'latest' - name: Install package and test dependencies run: | poetry install --with dev,nbtools diff --git a/.github/workflows/format_and_lint.yml b/.github/workflows/format_and_lint.yml index b4fbbea64..a7fffe021 100644 --- a/.github/workflows/format_and_lint.yml +++ b/.github/workflows/format_and_lint.yml @@ -17,13 +17,10 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.9" - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v5 - with: - version: "latest" - name: Install Poetry - run: | - uv tool install poetry + uses: snok/install-poetry@v1 + with: + version: 'latest' - name: Install dependencies run: | poetry install --with dev diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 411385902..1475feb72 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -34,8 +34,9 @@ jobs: with: version: "latest" - name: Install Poetry - run: | - uv tool install poetry + uses: snok/install-poetry@v1 + with: + version: 'latest' - name: Install test dependencies run: | poetry self add poetry-plugin-export