diff --git a/Pipfile b/Pipfile index db2e9bf8..ba03e378 100644 --- a/Pipfile +++ b/Pipfile @@ -5,18 +5,19 @@ name = "pypi" [packages] absl-py = "==2.1.0" +dm-reverb = "==0.14.0" gin-config = "==0.5.0" psutil = "==6.1.0" -tf-agents = "==0.19.0" +setuptools = {version = "75.8.0", markers="python_version >= '3.12'"} tensorflow = "==2.15.0" -dm-reverb = "==0.14.0" +tf-agents = "==0.19.0" [dev-packages] pylint = "==3.3.2" pytest = "==8.3.4" pytype = "==2024.10.11" +ruff = "==0.9.6" yapf = "==0.43.0" -ruff = "==0.9.3" [ci] joblib = "==1.4.2" diff --git a/compiler_opt/rl/compilation_runner.py b/compiler_opt/rl/compilation_runner.py index ef022f8c..6dac760d 100644 --- a/compiler_opt/rl/compilation_runner.py +++ b/compiler_opt/rl/compilation_runner.py @@ -20,6 +20,7 @@ import shlex import signal import subprocess +import sys import tempfile import threading from typing import Callable, Dict, List, Optional, Tuple @@ -80,6 +81,12 @@ def __exit__(self, exc, value, tb): pass +if sys.version_info >= (3, 12): + from functools import partial + + NonTemporaryDirectory = partial(tempfile.TemporaryDirectory, delete=False) + + def get_workdir_context(explicit_temps_dir: Optional[str] = None): """Return a context which manages how the temperory directories are handled. diff --git a/pyproject.toml b/pyproject.toml index 2ff17d88..e9d13365 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,10 +21,7 @@ filterwarnings = [ "ignore:Using or importing the ABCs from 'collections':DeprecationWarning", # Issue #119 "ignore:Encoding a StructuredValue with type tfp.distributions.Deterministic_ACTTypeSpec:UserWarning", - # This warning stems from tensorflow and tf-agents and will presumably - # be fixed by them before v3.12 - "ignore:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning", - # Also an issue internal to tensorflow + # An issue internal to tensorflow "ignore:Call to deprecated create function .*Descriptor.*:DeprecationWarning", # Also internal to tensorflow "ignore:non-integer arguments to randrange.*:DeprecationWarning",