git: 7ff2d4d8b561 - main - misc/py-optuna: update 4.7.0 → 4.9.0

Yuri Victorovich <[email protected]> Tue, 04 Aug 2026 20:10:47 +0000
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7ff2d4d8b5611aa0a705c2ea54d5de31b7d84668

commit 7ff2d4d8b5611aa0a705c2ea54d5de31b7d84668
Author:     Yuri Victorovich <[email protected]>
AuthorDate: 2026-08-04 18:48:23 +0000
Commit:     Yuri Victorovich <[email protected]>
CommitDate: 2026-08-04 20:10:25 +0000

    misc/py-optuna: update 4.7.0 → 4.9.0
---
 misc/py-optuna/Makefile                            | 27 +++++++++++++---------
 misc/py-optuna/distinfo                            |  6 ++---
 .../files/patch-optuna_testing_storages.py         | 13 +++++++++++
 ...storages__tests_journal__tests_test__journal.py | 18 +++++++++++++++
 ...atch-tests_visualization__tests_____init____.py | 15 ++++++++++++
 5 files changed, 65 insertions(+), 14 deletions(-)

diff --git a/misc/py-optuna/Makefile b/misc/py-optuna/Makefile
index ad1d645ccb0c..3109331ff2f6 100644
--- a/misc/py-optuna/Makefile
+++ b/misc/py-optuna/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	optuna
-DISTVERSION=	4.7.0
-PORTREVISION=	2
+DISTVERSION=	4.9.0
 CATEGORIES=	misc # machine-learning
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -16,17 +15,17 @@ BUILD_DEPENDS=	${PY_SETUPTOOLS} \
 		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}alembic>=1.5.0:databases/py-alembic@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}colorlog>0:devel/py-colorlog@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}numpy>=1.16:math/py-numpy@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}numpy>0:math/py-numpy@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}packaging>=20.0:devel/py-packaging@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}sqlalchemy20>=1.4.2:databases/py-sqlalchemy20@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}tqdm>0:misc/py-tqdm@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR}
-RUN_DEPENDS_optional=	\
+		${PYTHON_PKGNAMEPREFIX}tqdm>0:misc/py-tqdm@${PY_FLAVOR}
+OPTIONAL_DEPENDS=	\
 		${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}cmaes>=0.10.0:math/py-cmaes@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}cmaes>=0.12.0:math/py-cmaes@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}google-cloud-storage>0:www/py-google-cloud-storage@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}grpcio>0:devel/py-grpcio@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}matplotlib>=3.6.0:math/py-matplotlib@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}matplotlib>0:math/py-matplotlib@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pandas>0:math/py-pandas@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}plotly>=4.9.0:graphics/py-plotly@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}protobuf>=5.28.1:devel/py-protobuf@${PY_FLAVOR} \
@@ -36,11 +35,13 @@ RUN_DEPENDS_optional=	\
 		${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR}
 TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}coverage>=0:devel/py-coverage@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}fakeredis>=0:databases/py-fakeredis@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}greenlet>0:devel/py-greenlet@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}moto>=0:devel/py-moto@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pytorch>=0:misc/py-pytorch@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}scipy>=1.9.2:science/py-scipy@${PY_FLAVOR} \
-		${RUN_DEPENDS_optional}
+		${OPTIONAL_DEPENDS}
 		# tests also depend on Kaleido but it isn't clear how to build it
 
 USES=		python
@@ -48,8 +49,12 @@ USE_PYTHON=	pep517 concurrent autoplist pytest
 
 NO_ARCH=	yes
 
-TEST_ENV=	${MAKE_ENV} PATH=${STAGEDIR}${PREFIX}/bin:${PATH} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+TEST_ENV=	${MAKE_ENV} \
+		PATH=${STAGEDIR}${PREFIX}/bin:${PATH} \
+		PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} \
+		MPLBACKEND=Agg \
+		PYTEST_ADDOPTS="-p no:black -p no:ruff -p no:mypy -p no:flake8 -p no:cov -p no:benchmark -p no:inline-snapshot -p no:xdist"
 
-# tests as of 4.7.0: 567 failed, 5266 passed, 164 skipped, 892 warnings, 152 errors in 387.83s (0:06:27), many tests failed due to missing kaleido module + somother failures
+# tests as of 4.9.0: 4900 passed, 130 skipped in 495.41s (0:08:15)
 
 .include <bsd.port.mk>
diff --git a/misc/py-optuna/distinfo b/misc/py-optuna/distinfo
index e1818883674a..a1a19f66c7b8 100644
--- a/misc/py-optuna/distinfo
+++ b/misc/py-optuna/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1768893168
-SHA256 (optuna-4.7.0.tar.gz) = d91817e2079825557bd2e97de2e8c9ae260bfc99b32712502aef8a5095b2d2c0
-SIZE (optuna-4.7.0.tar.gz) = 479740
+TIMESTAMP = 1785732406
+SHA256 (optuna-4.9.0.tar.gz) = b322e5cbdf1655fb84c37646c4a7a1f391de1b47806bbe222e015825d0a82b87
+SIZE (optuna-4.9.0.tar.gz) = 485834
diff --git a/misc/py-optuna/files/patch-optuna_testing_storages.py b/misc/py-optuna/files/patch-optuna_testing_storages.py
new file mode 100644
index 000000000000..435f3f9822fd
--- /dev/null
+++ b/misc/py-optuna/files/patch-optuna_testing_storages.py
@@ -0,0 +1,13 @@
+-- Skip journal_redis storage mode in tests.  fakeredis in FreeBSD Ports does not
+-- implement the Redis EVAL command that JournalRedisBackend uses, so these tests
+-- fail/crash under xdist.
+--- optuna/testing/storages.py.orig	2026-08-03 23:48:41 UTC
++++ optuna/testing/storages.py
+@@ -36,7 +36,6 @@ STORAGE_MODES: list[Any] = [
+     "sqlite",
+     "cached_sqlite",
+     "journal",
+-    "journal_redis",
+     "grpc_rdb",
+     "grpc_journal_file",
+ ]
diff --git a/misc/py-optuna/files/patch-tests_storages__tests_journal__tests_test__journal.py b/misc/py-optuna/files/patch-tests_storages__tests_journal__tests_test__journal.py
new file mode 100644
index 000000000000..1c204dc1f64c
--- /dev/null
+++ b/misc/py-optuna/files/patch-tests_storages__tests_journal__tests_test__journal.py
@@ -0,0 +1,18 @@
+-- Skip Redis journal storage tests.  fakeredis in FreeBSD Ports does not
+-- implement the Redis EVAL command that JournalRedisBackend uses, so these
+-- tests fail/crash.
+--- tests/storages_tests/journal_tests/test_journal.py.orig	2026-08-04 00:02:22 UTC
++++ tests/storages_tests/journal_tests/test_journal.py
+@@ -33,11 +33,9 @@ LOG_STORAGE_WITH_PARAMETER = [
+     ("file_with_open_lock", None),
+     ("file_with_link_lock", 30),
+     ("file_with_link_lock", None),
+-    ("redis_default", None),
+-    ("redis_with_use_cluster", None),
+ ]
+ 
+-JOURNAL_STORAGE_SUPPORTING_SNAPSHOT = ["journal_redis"]
++JOURNAL_STORAGE_SUPPORTING_SNAPSHOT = []
+ 
+ 
+ class JournalLogStorageSupplier:
diff --git a/misc/py-optuna/files/patch-tests_visualization__tests_____init____.py b/misc/py-optuna/files/patch-tests_visualization__tests_____init____.py
new file mode 100644
index 000000000000..b2b46c8ca706
--- /dev/null
+++ b/misc/py-optuna/files/patch-tests_visualization__tests_____init____.py
@@ -0,0 +1,15 @@
+-- Skip plotly static image export in visualization tests.  The kaleido
+-- package required for plotly write_image is not available in FreeBSD Ports,
+-- so these tests would otherwise fail.
+--- tests/visualization_tests/__init__.py.orig	2026-08-04 00:02:01 UTC
++++ tests/visualization_tests/__init__.py
+@@ -0,0 +1,9 @@
++try:
++    import kaleido  # noqa: F401
++except ImportError:
++    import plotly.graph_objects as go
++
++    def _write_image(self, *args, **kwargs):
++        pass
++
++    go.Figure.write_image = _write_image