From 0e11e113b55d8e4d73f3c888d7d6b4729383143d Mon Sep 17 00:00:00 2001 From: Mathieu Poliquin Date: Sun, 17 Dec 2023 20:54:08 +0800 Subject: [PATCH] Integrate Farama Notifications --- retro/__init__.py | 11 +++++++++++ setup.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/retro/__init__.py b/retro/__init__.py index 726782060..42fe52fbd 100644 --- a/retro/__init__.py +++ b/retro/__init__.py @@ -1,4 +1,5 @@ import os +import sys import retro.data from retro._retro import Movie, RetroEmulator, core_path @@ -61,3 +62,13 @@ def make(game, state=State.DEFAULT, inttype=retro.data.Integrations.DEFAULT, **k f"Game not found: {game}. Did you make sure to import the ROM?", ) return RetroEnv(game, state, inttype=inttype, **kwargs) + + +try: + from farama_notifications import notifications + + if "stable-retro" in notifications and __version__ in notifications["stable-retro"]: + print(notifications["stable-retro"][__version__], file=sys.stderr) + +except Exception: # nosec + pass \ No newline at end of file diff --git a/setup.py b/setup.py index b9970c520..6d45f0afb 100644 --- a/setup.py +++ b/setup.py @@ -90,7 +90,7 @@ def run(self): url="https://github.com/farama-foundation/stable-retro", version=open(VERSION_PATH).read().strip(), license="MIT", - install_requires=["gymnasium>=0.27.1", "pyglet>=1.3.2,==1.*"], + install_requires=["gymnasium>=0.27.1", "pyglet>=1.3.2,==1.*", "farama-notifications >=0.0.1"], python_requires=">=3.8.0,<3.13", ext_modules=[Extension("retro._retro", ["CMakeLists.txt", "src/*.cpp"])], cmdclass={"build_ext": CMakeBuild},