From 06177a2b95155833c934ba357ea850620ef10462 Mon Sep 17 00:00:00 2001 From: Jirka B Date: Mon, 8 Sep 2025 20:32:24 +0200 Subject: [PATCH 1/8] tests: ignore future warning for oldest configurations --- .github/workflows/ci-tests-fabric.yml | 2 ++ .github/workflows/ci-tests-pytorch.yml | 3 +++ pyproject.toml | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index ef1ce3aea089c..d0c1ca31dd095 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -104,6 +104,8 @@ jobs: python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt', 'test.txt']" uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation + # This script removes any line containing "error::FutureWarning" from pyproject.toml + sed -i '/error::FutureWarning/d' pyproject.toml - name: Adjust PyTorch versions in requirements files if: ${{ matrix.config.requires != 'oldest' }} diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index 17f73aba3305d..1babb88e22c15 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -103,6 +103,9 @@ jobs: python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt']" uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation + # This script removes any line containing "error::FutureWarning" from pyproject.toml + sed -i '/error::FutureWarning/d' pyproject.toml + - name: Adjust PyTorch versions in requirements files if: ${{ matrix.config.requires != 'oldest' }} diff --git a/pyproject.toml b/pyproject.toml index bec03d8164ad4..b4d5d0b1638f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -182,7 +182,6 @@ filterwarnings = [ # "error::DeprecationWarning", "error::FutureWarning", "ignore::FutureWarning:onnxscript", # Temporary ignore until onnxscript is updated - "ignore:The pynvml package is deprecated:FutureWarning", # Ignore pynvml deprecation warning, since it is not installed by PL directly ] xfail_strict = true junit_duration_report = "call" From a79bc8ce6b7cc05cecd93db45971b16f7d8f3ae4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 18:35:16 +0000 Subject: [PATCH 2/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/ci-tests-pytorch.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index 1babb88e22c15..044e7211e0230 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -106,7 +106,6 @@ jobs: # This script removes any line containing "error::FutureWarning" from pyproject.toml sed -i '/error::FutureWarning/d' pyproject.toml - - name: Adjust PyTorch versions in requirements files if: ${{ matrix.config.requires != 'oldest' }} run: | From fd8c355efb7d05e3c20c2da640f1fd114e3a5cd9 Mon Sep 17 00:00:00 2001 From: Jirka B Date: Mon, 8 Sep 2025 20:41:12 +0200 Subject: [PATCH 3/8] folder --- .github/workflows/ci-tests-fabric.yml | 4 ++-- .github/workflows/ci-tests-pytorch.yml | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index d0c1ca31dd095..6a4d54af21a06 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -99,9 +99,9 @@ jobs: - name: Set min. dependencies if: ${{ matrix.config.requires == 'oldest' }} run: | - cd requirements/fabric uv pip install -U "lightning-utilities[cli]" - python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt', 'test.txt']" + python -m lightning_utilities.cli requirements set-oldest \ + --req_files "['requirements/fabric/base.txt', 'requirements/fabric/strategies.txt', 'requirements/fabric/test.txt']" uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index 1babb88e22c15..a32e797133264 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -98,15 +98,14 @@ jobs: - name: Set min. dependencies if: ${{ matrix.config.requires == 'oldest' }} run: | - cd requirements/pytorch uv pip install -U "lightning-utilities[cli]" - python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt']" + python -m lightning_utilities.cli requirements set-oldest \ + --req_files "['requirements/pytorch/base.txt', 'requirements/pytorch/extra.txt', 'requirements/pytorch/strategies.txt', 'requirements/pytorch/examples.txt', 'requirements/pytorch/test.txt']" uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml sed -i '/error::FutureWarning/d' pyproject.toml - - name: Adjust PyTorch versions in requirements files if: ${{ matrix.config.requires != 'oldest' }} run: | From 2c73ce70d6fdacce2e5a980c4be7400dd8383206 Mon Sep 17 00:00:00 2001 From: Jirka B Date: Mon, 8 Sep 2025 21:30:18 +0200 Subject: [PATCH 4/8] prune_pytest_as_errors --- .actions/assistant.py | 19 +++++++++++++++++++ .github/workflows/ci-tests-fabric.yml | 2 +- .github/workflows/ci-tests-pytorch.yml | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.actions/assistant.py b/.actions/assistant.py index e54e69e4860e7..0040d49961706 100644 --- a/.actions/assistant.py +++ b/.actions/assistant.py @@ -459,6 +459,25 @@ def generate_docker_tags( tags = [f"{docker_project}:{tag}" for tag in tags] print(",".join(tags)) + @staticmethod + def prune_pytest_as_errors( + pyproject_toml: str = "pyproject.toml", errors: tuple = ("FutureWarning", "DeprecationWarning") + ) -> None: + """Prune pytest warnings as errors from the pyproject.toml file.""" + import toml + + with open(pyproject_toml, encoding="utf-8") as fopen: + pyproject = toml.load(fopen) + filterwarnings = pyproject.get("tool", {}).get("pytest", {}).get("ini_options", {}).get("filterwarnings", []) + if not filterwarnings: + return + print(filterwarnings) + print([f"error::{err}" for err in errors]) + filterwarnings = [wrn for wrn in filterwarnings if not any(f"error::{err}" in wrn for err in errors)] + pyproject["tool"]["pytest"]["ini_options"]["filterwarnings"] = filterwarnings + with open(pyproject_toml, "w", encoding="utf-8") as fopen: + toml.dump(pyproject, fopen) + if __name__ == "__main__": import jsonargparse diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index 6a4d54af21a06..9122fbb9a5930 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -105,7 +105,7 @@ jobs: uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml - sed -i '/error::FutureWarning/d' pyproject.toml + python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files if: ${{ matrix.config.requires != 'oldest' }} diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index a32e797133264..79edea968ed03 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -104,7 +104,7 @@ jobs: uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml - sed -i '/error::FutureWarning/d' pyproject.toml + python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files if: ${{ matrix.config.requires != 'oldest' }} From 8ea00b8a5cb2f8576ab930bb2be852117c972975 Mon Sep 17 00:00:00 2001 From: Jirka B Date: Mon, 8 Sep 2025 21:45:15 +0200 Subject: [PATCH 5/8] req. --- .github/workflows/ci-tests-fabric.yml | 1 + .github/workflows/ci-tests-pytorch.yml | 1 + requirements/ci.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index 9122fbb9a5930..882fea6c965c6 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -105,6 +105,7 @@ jobs: uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml + uv pip install -r requirements/ci.txt python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index 79edea968ed03..168a6783514c3 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -104,6 +104,7 @@ jobs: uv pip install "cython<3.0" wheel uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml + uv pip install -r requirements/ci.txt python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files diff --git a/requirements/ci.txt b/requirements/ci.txt index 4aeb4e48db55c..feb008c792b3d 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -6,3 +6,4 @@ importlib-metadata <9.0.0 wget pkginfo ==1.12.1.2 packaging <25.1 +tomlkit \ No newline at end of file From 59d48c99295a8c23e1ee077f1f09918e67fe68a2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 19:45:42 +0000 Subject: [PATCH 6/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- requirements/ci.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/ci.txt b/requirements/ci.txt index feb008c792b3d..32303d25dbe8c 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -6,4 +6,4 @@ importlib-metadata <9.0.0 wget pkginfo ==1.12.1.2 packaging <25.1 -tomlkit \ No newline at end of file +tomlkit From bf0f7386d12fb99d1fd418a04686d8e3f3bf35e5 Mon Sep 17 00:00:00 2001 From: Jirka B Date: Mon, 8 Sep 2025 21:59:11 +0200 Subject: [PATCH 7/8] debugging --- .github/workflows/ci-tests-fabric.yml | 1 + .github/workflows/ci-tests-pytorch.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index 882fea6c965c6..3cfbbc5daf8ee 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -106,6 +106,7 @@ jobs: uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml uv pip install -r requirements/ci.txt + uv pip list # debugging python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index 168a6783514c3..a3be841178595 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -105,6 +105,7 @@ jobs: uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml uv pip install -r requirements/ci.txt + uv pip list # debugging python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files From e46a70d224d9d8458dfe0cab7d306d94bad61a61 Mon Sep 17 00:00:00 2001 From: Jirka B Date: Mon, 8 Sep 2025 22:07:05 +0200 Subject: [PATCH 8/8] update --- .actions/assistant.py | 10 +++++----- .github/workflows/ci-tests-fabric.yml | 1 - .github/workflows/ci-tests-pytorch.yml | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.actions/assistant.py b/.actions/assistant.py index 0040d49961706..6d1e50e26f587 100644 --- a/.actions/assistant.py +++ b/.actions/assistant.py @@ -464,19 +464,19 @@ def prune_pytest_as_errors( pyproject_toml: str = "pyproject.toml", errors: tuple = ("FutureWarning", "DeprecationWarning") ) -> None: """Prune pytest warnings as errors from the pyproject.toml file.""" - import toml + import tomlkit with open(pyproject_toml, encoding="utf-8") as fopen: - pyproject = toml.load(fopen) + content = fopen.read() + pyproject = tomlkit.parse(content) filterwarnings = pyproject.get("tool", {}).get("pytest", {}).get("ini_options", {}).get("filterwarnings", []) if not filterwarnings: return - print(filterwarnings) - print([f"error::{err}" for err in errors]) filterwarnings = [wrn for wrn in filterwarnings if not any(f"error::{err}" in wrn for err in errors)] pyproject["tool"]["pytest"]["ini_options"]["filterwarnings"] = filterwarnings + with open(pyproject_toml, "w", encoding="utf-8") as fopen: - toml.dump(pyproject, fopen) + fopen.write(tomlkit.dumps(pyproject)) if __name__ == "__main__": diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index 3cfbbc5daf8ee..882fea6c965c6 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -106,7 +106,6 @@ jobs: uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml uv pip install -r requirements/ci.txt - uv pip list # debugging python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index a3be841178595..168a6783514c3 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -105,7 +105,6 @@ jobs: uv pip install "pyyaml==5.4" --no-build-isolation # This script removes any line containing "error::FutureWarning" from pyproject.toml uv pip install -r requirements/ci.txt - uv pip list # debugging python .actions/assistant.py prune_pytest_as_errors - name: Adjust PyTorch versions in requirements files