Skip to content

Commit

Permalink
upgrade poetry2.0 & apply pep621 (#545)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
phi-friday authored Feb 27, 2025
1 parent dc6f251 commit 232f9d9
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
run: sudo apt-get install -y pandoc
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 'latest'
- name: Install package and test dependencies
run: |
poetry install --with dev,nbtools
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/format_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
python-version: "3.9"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 'latest'
- name: Install dependencies
run: |
poetry install --with dev
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,34 @@ 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
- name: Set up Python
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
with:
version: 'latest'
- 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
poetry install --only-root
- name: Test with pytest
run: |
poetry run pytest --cov-report xml --cov=bayes_opt/
Expand Down
52 changes: 32 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
[tool.poetry]
[project]
name = "bayesian-optimization"
version = "3.0.0b1"
description = "Bayesian Optimization package"
authors = ["Fernando Nogueira"]
license = "MIT"
authors = [{ name = "Fernando Nogueira", email = "[email protected]" }]
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; 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",
]
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"
Expand All @@ -28,7 +40,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"
Expand All @@ -38,17 +50,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]
Expand Down

0 comments on commit 232f9d9

Please sign in to comment.