Skip to content

Commit 232f9d9

Browse files
authored
upgrade poetry2.0 & apply pep621 (#545)
* chore: upgrade poetry2.0 & apply pep621 * fix: replace poetry action(not support 2.0) * fix: exclude one matrix * chore: split numpy deps * fix: numpy constraints * fix: install root * chore: use install-poetry
1 parent dc6f251 commit 232f9d9

File tree

4 files changed

+53
-22
lines changed

4 files changed

+53
-22
lines changed

.github/workflows/build_docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
run: sudo apt-get install -y pandoc
2929
- name: Install Poetry
3030
uses: snok/install-poetry@v1
31+
with:
32+
version: 'latest'
3133
- name: Install package and test dependencies
3234
run: |
3335
poetry install --with dev,nbtools

.github/workflows/format_and_lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
python-version: "3.9"
2020
- name: Install Poetry
2121
uses: snok/install-poetry@v1
22+
with:
23+
version: 'latest'
2224
- name: Install dependencies
2325
run: |
2426
poetry install --with dev

.github/workflows/run_tests.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,34 @@ jobs:
1919
matrix:
2020
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2121
numpy-version: [">=1.25,<2", ">=2"]
22+
exclude:
23+
- python-version: "3.13"
24+
numpy-version: ">=1.25,<2" # numpy<2 is not supported on Python 3.13
2225

2326
steps:
2427
- uses: actions/checkout@v3
2528
- name: Set up Python
2629
uses: actions/setup-python@v3
2730
with:
2831
python-version: ${{ matrix.python-version }}
32+
- name: Install the latest version of uv
33+
uses: astral-sh/setup-uv@v5
34+
with:
35+
version: "latest"
2936
- name: Install Poetry
3037
uses: snok/install-poetry@v1
38+
with:
39+
version: 'latest'
3140
- name: Install test dependencies
3241
run: |
33-
poetry add "numpy${{ matrix.numpy-version }}"
34-
poetry install --with dev,nbtools
42+
poetry self add poetry-plugin-export
43+
poetry export -f requirements.txt --with dev,nbtools --without-hashes --output requirements-dev.txt
44+
echo "numpy${{ matrix.numpy-version }}" >> constraints.txt
45+
uv pip compile requirements-dev.txt --output-file requirements.txt \
46+
--python-version ${{ matrix.python-version }} \
47+
--override constraints.txt
48+
poetry run pip install -r requirements.txt
49+
poetry install --only-root
3550
- name: Test with pytest
3651
run: |
3752
poetry run pytest --cov-report xml --cov=bayes_opt/

pyproject.toml

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
1-
[tool.poetry]
1+
[project]
22
name = "bayesian-optimization"
33
version = "3.0.0b1"
44
description = "Bayesian Optimization package"
5-
authors = ["Fernando Nogueira"]
6-
license = "MIT"
5+
authors = [{ name = "Fernando Nogueira", email = "[email protected]" }]
6+
license = { file = "LICENSE" }
77
readme = "README.md"
8-
packages = [{include = "bayes_opt"}]
9-
10-
[tool.poetry.dependencies]
11-
python = "^3.9"
12-
scikit-learn = "^1.0.0"
13-
numpy = ">=1.25"
14-
scipy = [
15-
{version = "^1.0.0", python = "<3.13"},
16-
{version = "^1.14.1", python = ">=3.13"}
8+
requires-python = ">=3.9,<4.0"
9+
classifiers = [
10+
"License :: OSI Approved :: MIT License",
11+
"Programming Language :: Python",
12+
"Programming Language :: Python :: 3",
13+
"Programming Language :: Python :: 3.9",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: 3.12",
17+
"Programming Language :: Python :: 3.13",
18+
]
19+
dependencies = [
20+
"scikit-learn>=1.0.0,<2.0.0",
21+
"numpy>=1.25; python_version<'3.13'",
22+
"numpy>=2.1.3; python_version>='3.13'",
23+
"scipy>=1.0.0,<2.0.0; python_version<'3.13'",
24+
"scipy>=1.14.1,<2.0.0; python_version>='3.13'",
25+
"colorama>=0.4.6,<1.0.0",
1726
]
18-
colorama = "^0.4.6"
27+
28+
[tool.poetry]
29+
requires-poetry = ">=2.0"
30+
packages = [{ include = "bayes_opt" }]
1931

2032

21-
[tool.poetry.group.dev] # for testing/developing
33+
[tool.poetry.group.dev] # for testing/developing
2234
optional = true
2335
[tool.poetry.group.dev.dependencies]
2436
pytest = "^8.0.0"
@@ -28,7 +40,7 @@ ruff = "0.6.6"
2840
pre-commit = "^3.7.1"
2941

3042

31-
[tool.poetry.group.nbtools] # for running/converting notebooks
43+
[tool.poetry.group.nbtools] # for running/converting notebooks
3244
optional = true
3345
[tool.poetry.group.nbtools.dependencies]
3446
nbformat = "^5.9.2"
@@ -38,17 +50,17 @@ matplotlib = "^3.0"
3850
nbsphinx = "^0.9.4"
3951
sphinx-immaterial = "^0.12.0"
4052
sphinx = [
41-
{version = "^7.0.0", python = "<3.10"},
42-
{version = "^8.0.0", python = ">=3.10"}
53+
{ version = "^7.0.0", python = "<3.10" },
54+
{ version = "^8.0.0", python = ">=3.10" },
4355
]
4456
sphinx-autodoc-typehints = [
45-
{version = "^2.3.0", python = "<3.10"},
46-
{version = "^2.4.0", python = ">=3.10"}
57+
{ version = "^2.3.0", python = "<3.10" },
58+
{ version = "^2.4.0", python = ">=3.10" },
4759
]
4860

4961

5062
[build-system]
51-
requires = ["poetry-core"]
63+
requires = ["poetry-core>=2.0"]
5264
build-backend = "poetry.core.masonry.api"
5365

5466
[tool.coverage.report]

0 commit comments

Comments
 (0)