diff --git a/docs/getting_started/installation.md b/docs/getting_started/installation.md index d61c4ac8..7898ae05 100644 --- a/docs/getting_started/installation.md +++ b/docs/getting_started/installation.md @@ -73,6 +73,9 @@ TensorBoard extras require >=2.21,<3. Earlier versions can fail hyperparameter event writing with NumPy 2 or import the removed `pkg_resources` module with patched setuptools. +MLflow extras require >=3.9,<4. Earlier versions fail at the start of `fit()` +with SQLAlchemy 2.1. + ```{important} DeepTab 2.1 no longer supports Python 3.10. Recreate your environment with Python 3.11, 3.12 or 3.13 before upgrading; an older DeepTab release is not a security diff --git a/poetry.lock b/poetry.lock index f5980a44..98396ad2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -7383,4 +7383,4 @@ tracking = ["mlflow", "tensorboard"] [metadata] lock-version = "2.1" python-versions = ">=3.11,<3.14" -content-hash = "5a25e83babd7ea0ba8bdb58543d24f6be93c428f0b81b1214fe710498a46679f" +content-hash = "ec78507eead90a79450a5e1b9668fea57d8def8ad33b58d7d6890e88111c9c32" diff --git a/pyproject.toml b/pyproject.toml index 16d3db39..c94a3fda 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,10 +13,10 @@ dynamic = ["dependencies"] [project.optional-dependencies] logs = ["structlog>=24.0,<27.0"] -mlflow = ["mlflow>=2.10,<4.0"] +mlflow = ["mlflow>=3.9,<4.0"] tensorboard = ["tensorboard>=2.21,<3.0"] -tracking = ["mlflow>=2.10,<4.0", "tensorboard>=2.21,<3.0"] -all = ["structlog>=24.0,<27.0", "mlflow>=2.10,<4.0", "tensorboard>=2.21,<3.0"] +tracking = ["mlflow>=3.9,<4.0", "tensorboard>=2.21,<3.0"] +all = ["structlog>=24.0,<27.0", "mlflow>=3.9,<4.0", "tensorboard>=2.21,<3.0"] tabr = ["delu>=0.0.26,<0.1.0", "faiss-cpu>=1.13.0,<2.0.0"] [project.urls] diff --git a/tests/environments/test_installation_environments.py b/tests/environments/test_installation_environments.py index 03468918..34e37ed1 100644 --- a/tests/environments/test_installation_environments.py +++ b/tests/environments/test_installation_environments.py @@ -15,6 +15,7 @@ from packaging.specifiers import SpecifierSet from deeptab.configs import MLPConfig, TrainerConfig +from deeptab.core.observability import ObservabilityConfig, build_lightning_loggers from deeptab.core.optional_deps import require_mlflow, require_structlog, require_tensorboard from deeptab.models import MLPClassifier @@ -61,6 +62,21 @@ def test_security_dependency_minima(package, minimum, older): assert "2.20.0" not in tensorboard.specifier +@pytest.mark.parametrize("extra", ["mlflow", "tracking", "all"]) +def test_mlflow_extra_minimum_supports_sqlalchemy_2_1(extra): + path = Path(__file__).resolve().parents[2] / "pyproject.toml" + with path.open("rb") as stream: + config = tomllib.load(stream) + mlflow = next( + Requirement(value) + for value in config["project"]["optional-dependencies"][extra] + if Requirement(value).name == "mlflow" + ) + # MLflow < 3.9 imports sqlalchemy.pool.FallbackAsyncAdaptedQueuePool, which SQLAlchemy 2.1 removed. + assert "3.9.0" in mlflow.specifier + assert "3.8.1" not in mlflow.specifier + + def test_readthedocs_html_cleaner_matches_patched_lock(): root = Path(__file__).resolve().parents[2] requirements = [ @@ -263,6 +279,12 @@ def test_declared_dependency_profile(pytestconfig, tmp_path, package, extra, req with require_tensorboard()(log_dir=str(tmp_path)) as writer: writer.add_hparams({"learning_rate": 0.001}, {"accuracy": 0.75}) assert any(tmp_path.rglob("events.out.tfevents.*")) + elif package == "mlflow": + assert dependency.__name__ == package + config = ObservabilityConfig(root_dir=str(tmp_path), experiment_trackers=["mlflow"]) + (logger,) = build_lightning_loggers(config) + assert logger.run_id is not None + assert (tmp_path / "mlflow" / "backend" / "mlflow.db").is_file() else: assert dependency.__name__ == package