diff --git a/.actions/assistant.py b/.actions/assistant.py index e54e69e4860e7..6d1e50e26f587 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 tomlkit + + with open(pyproject_toml, encoding="utf-8") as fopen: + content = fopen.read() + pyproject = tomlkit.parse(content) + filterwarnings = pyproject.get("tool", {}).get("pytest", {}).get("ini_options", {}).get("filterwarnings", []) + if not filterwarnings: + return + 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: + fopen.write(tomlkit.dumps(pyproject)) + if __name__ == "__main__": import jsonargparse diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index ef1ce3aea089c..882fea6c965c6 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -99,11 +99,14 @@ 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 + uv pip install -r requirements/ci.txt + 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 17f73aba3305d..168a6783514c3 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -98,11 +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 + uv pip install -r requirements/ci.txt + python .actions/assistant.py prune_pytest_as_errors - 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" diff --git a/requirements/ci.txt b/requirements/ci.txt index 4aeb4e48db55c..32303d25dbe8c 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