From 29fd970b3b062589599a9bd15ff006dbb0ea05d0 Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Tue, 25 Aug 2026 23:20:13 +0000 Subject: [PATCH 1/3] rename `eyeGestures` modules to `eye_gestures` --- README.md | 4 ++-- examples/legacy/PupilLabDry.py | 4 ++-- examples/legacy/display_calibration.py | 4 ++-- examples/legacy/simple_example.py | 4 ++-- examples/simple_example_v2.py | 4 ++-- examples/simple_example_v2_fast.py | 4 ++-- examples/simple_example_v3.py | 4 ++-- examples/simple_example_v4.py | 4 ++-- examples/troubleshooting_camera.py | 2 +- ...yegesturesEngine.cpython-313-x86_64-linux-gnu.so | Bin ...yegesturesEngine.cpython-314-x86_64-linux-gnu.so | Bin {eyeGestures => eye_gestures}/Fixation.py | 0 {eyeGestures => eye_gestures}/__init__.py | 7 ++++--- {eyeGestures => eye_gestures}/eye.py | 2 +- {eyeGestures => eye_gestures}/face.py | 2 +- {eyeGestures => eye_gestures}/gevent.py | 2 +- {eyeGestures => eye_gestures}/processing.py | 0 {eyeGestures => eye_gestures}/requirements.txt | 0 {eyeGestures => eye_gestures}/utils.py | 0 pyproject.toml | 4 ++-- 20 files changed, 26 insertions(+), 25 deletions(-) rename {eyeGestures => eye_gestures}/EyegesturesEngine.cpython-313-x86_64-linux-gnu.so (100%) rename {eyeGestures => eye_gestures}/EyegesturesEngine.cpython-314-x86_64-linux-gnu.so (100%) rename {eyeGestures => eye_gestures}/Fixation.py (100%) rename {eyeGestures => eye_gestures}/__init__.py (97%) rename {eyeGestures => eye_gestures}/eye.py (99%) rename {eyeGestures => eye_gestures}/face.py (99%) rename {eyeGestures => eye_gestures}/gevent.py (97%) rename {eyeGestures => eye_gestures}/processing.py (100%) rename {eyeGestures => eye_gestures}/requirements.txt (100%) rename {eyeGestures => eye_gestures}/utils.py (100%) diff --git a/README.md b/README.md index c3588a4..4bb4fa6 100644 --- a/README.md +++ b/README.md @@ -104,8 +104,8 @@ gestures.start(); ##### Python ```python -from eyeGestures.utils import VideoCapture -from eyeGestures import EyeGestures_v4 +from eye_gestures.utils import VideoCapture +from eye_gestures import EyeGestures_v4 # Initialize gesture engine and video capture gestures = EyeGestures_v3() diff --git a/examples/legacy/PupilLabDry.py b/examples/legacy/PupilLabDry.py index 879d217..28b8aa8 100644 --- a/examples/legacy/PupilLabDry.py +++ b/examples/legacy/PupilLabDry.py @@ -1,5 +1,5 @@ -from eyeGestures.utils import VideoCapture -from eyeGestures.eyegestures import EyeGestures +from eye_gestures.utils import VideoCapture +from eye_gestures.eyegestures import EyeGestures from screeninfo import get_monitors if __name__ == '__main__': diff --git a/examples/legacy/display_calibration.py b/examples/legacy/display_calibration.py index 49e06dd..99be1f5 100644 --- a/examples/legacy/display_calibration.py +++ b/examples/legacy/display_calibration.py @@ -7,8 +7,8 @@ dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(f'{dir_path}/..') -from eyeGestures.utils import VideoCapture -from eyeGestures.eyegestures import EyeGestures_v2 +from eye_gestures.utils import VideoCapture +from eye_gestures.eyegestures import EyeGestures_v2 gestures = EyeGestures_v2() gestures.uploadCalibrationMap([[0,0],[0,1],[1,0],[1,1]]) diff --git a/examples/legacy/simple_example.py b/examples/legacy/simple_example.py index d9db98b..920dd17 100644 --- a/examples/legacy/simple_example.py +++ b/examples/legacy/simple_example.py @@ -7,8 +7,8 @@ dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(f'{dir_path}/..') -from eyeGestures.utils import VideoCapture -from eyeGestures.eyegestures import EyeGestures_v1 +from eye_gestures.utils import VideoCapture +from eye_gestures.eyegestures import EyeGestures_v1 gestures = EyeGestures_v1(285,115,80,15) diff --git a/examples/simple_example_v2.py b/examples/simple_example_v2.py index d066bf7..385e04b 100644 --- a/examples/simple_example_v2.py +++ b/examples/simple_example_v2.py @@ -22,8 +22,8 @@ dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(f'{dir_path}/..') -from eyeGestures.utils import VideoCapture -from eyeGestures import EyeGestures_v2 +from eye_gestures.utils import VideoCapture +from eye_gestures import EyeGestures_v2 gestures = EyeGestures_v2() cap = VideoCapture(0) diff --git a/examples/simple_example_v2_fast.py b/examples/simple_example_v2_fast.py index 71d44ed..5a691ed 100644 --- a/examples/simple_example_v2_fast.py +++ b/examples/simple_example_v2_fast.py @@ -22,8 +22,8 @@ dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(f'{dir_path}/..') -from eyeGestures.utils import VideoCapture -from eyeGestures import EyeGestures_v2 +from eye_gestures.utils import VideoCapture +from eye_gestures import EyeGestures_v2 gestures = EyeGestures_v2() cap = VideoCapture(0) diff --git a/examples/simple_example_v3.py b/examples/simple_example_v3.py index 1198d92..ceb3d9a 100644 --- a/examples/simple_example_v3.py +++ b/examples/simple_example_v3.py @@ -22,8 +22,8 @@ dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(f'{dir_path}/..') -from eyeGestures.utils import VideoCapture -from eyeGestures import EyeGestures_v3 +from eye_gestures.utils import VideoCapture +from eye_gestures import EyeGestures_v3 gestures = EyeGestures_v3() cap = VideoCapture(0) diff --git a/examples/simple_example_v4.py b/examples/simple_example_v4.py index d7db1b0..3887646 100644 --- a/examples/simple_example_v4.py +++ b/examples/simple_example_v4.py @@ -22,8 +22,8 @@ dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(f'{dir_path}/..') -from eyeGestures.utils import VideoCapture -from eyeGestures import EyeGestures_v4 +from eye_gestures.utils import VideoCapture +from eye_gestures import EyeGestures_v4 gestures = EyeGestures_v4() cap = VideoCapture(0) diff --git a/examples/troubleshooting_camera.py b/examples/troubleshooting_camera.py index 091cecf..fd0cc8f 100644 --- a/examples/troubleshooting_camera.py +++ b/examples/troubleshooting_camera.py @@ -16,7 +16,7 @@ screen = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption("EyeGestures v3 example") -from eyeGestures.utils import VideoCapture +from eye_gestures.utils import VideoCapture cap = VideoCapture(0) diff --git a/eyeGestures/EyegesturesEngine.cpython-313-x86_64-linux-gnu.so b/eye_gestures/EyegesturesEngine.cpython-313-x86_64-linux-gnu.so similarity index 100% rename from eyeGestures/EyegesturesEngine.cpython-313-x86_64-linux-gnu.so rename to eye_gestures/EyegesturesEngine.cpython-313-x86_64-linux-gnu.so diff --git a/eyeGestures/EyegesturesEngine.cpython-314-x86_64-linux-gnu.so b/eye_gestures/EyegesturesEngine.cpython-314-x86_64-linux-gnu.so similarity index 100% rename from eyeGestures/EyegesturesEngine.cpython-314-x86_64-linux-gnu.so rename to eye_gestures/EyegesturesEngine.cpython-314-x86_64-linux-gnu.so diff --git a/eyeGestures/Fixation.py b/eye_gestures/Fixation.py similarity index 100% rename from eyeGestures/Fixation.py rename to eye_gestures/Fixation.py diff --git a/eyeGestures/__init__.py b/eye_gestures/__init__.py similarity index 97% rename from eyeGestures/__init__.py rename to eye_gestures/__init__.py index d550605..fe00d63 100644 --- a/eyeGestures/__init__.py +++ b/eye_gestures/__init__.py @@ -4,9 +4,9 @@ import numpy as np import numpy.typing as npt -from eyeGestures.face import Face, FaceFinder -from eyeGestures.Fixation import Fixation -from eyeGestures.utils import recoverable +from eye_gestures.face import Face, FaceFinder +from eye_gestures.Fixation import Fixation +from eye_gestures.utils import recoverable try: from .EyegesturesEngine import EyeGesturesEnginePython as RustEyeGesturesEngine # type: ignore[import-untyped] @@ -136,3 +136,4 @@ def step( calib_x = min(max(calib_x, 0), width) calib_y = min(max(calib_y, 0), height) return [x, y], is_calibrating, [calib_x, calib_y] + diff --git a/eyeGestures/eye.py b/eye_gestures/eye.py similarity index 99% rename from eyeGestures/eye.py rename to eye_gestures/eye.py index 490f838..ec7c8c3 100644 --- a/eyeGestures/eye.py +++ b/eye_gestures/eye.py @@ -7,7 +7,7 @@ import numpy.typing as npt from mediapipe.tasks.python.vision.face_landmarker import FaceLandmarksConnections -from eyeGestures.utils import Buffor +from eye_gestures.utils import Buffor class Eye: diff --git a/eyeGestures/face.py b/eye_gestures/face.py similarity index 99% rename from eyeGestures/face.py rename to eye_gestures/face.py index ef481ec..9219bd6 100644 --- a/eyeGestures/face.py +++ b/eye_gestures/face.py @@ -12,7 +12,7 @@ from mediapipe.tasks import python from mediapipe.tasks.python import vision -from eyeGestures.eye import Eye +from eye_gestures.eye import Eye FACE_LANDMARKER_MODEL_URL = ( "https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task" diff --git a/eyeGestures/gevent.py b/eye_gestures/gevent.py similarity index 97% rename from eyeGestures/gevent.py rename to eye_gestures/gevent.py index 7bc0181..393b6b2 100644 --- a/eyeGestures/gevent.py +++ b/eye_gestures/gevent.py @@ -6,7 +6,7 @@ import numpy as np import numpy.typing as npt -from eyeGestures.eye import Eye +from eye_gestures.eye import Eye class Gevent: diff --git a/eyeGestures/processing.py b/eye_gestures/processing.py similarity index 100% rename from eyeGestures/processing.py rename to eye_gestures/processing.py diff --git a/eyeGestures/requirements.txt b/eye_gestures/requirements.txt similarity index 100% rename from eyeGestures/requirements.txt rename to eye_gestures/requirements.txt diff --git a/eyeGestures/utils.py b/eye_gestures/utils.py similarity index 100% rename from eyeGestures/utils.py rename to eye_gestures/utils.py diff --git a/pyproject.toml b/pyproject.toml index 2aa061a..d718e81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ manifest-path = "engine/Cargo.toml" features = ["python"] no-default-features = true python-source = "." -module-name = "eyeGestures.EyegesturesEngine" +module-name = "eye_gestures.EyegesturesEngine" [project.urls] Homepage = "https://github.com/NativeSensors/EyeGestures" @@ -87,5 +87,5 @@ module = ["sklearn.*", "mediapipe.*"] ignore_missing_imports = true [[tool.mypy.overrides]] -module = ["EyegesturesEngine", "eyeGestures.EyegesturesEngine"] +module = ["EyegesturesEngine", "eye_gestures.EyegesturesEngine"] ignore_missing_imports = true From d065b91745a900279913c3faae56ac62856b978b Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Tue, 25 Aug 2026 23:51:56 +0000 Subject: [PATCH 2/3] gracefully deprecate `eyeGestures` module --- Makefile | 16 ++++++++-------- eyeGestures/__init__.py | 36 ++++++++++++++++++++++++++++++++++++ pyproject.toml | 2 ++ 3 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 eyeGestures/__init__.py diff --git a/Makefile b/Makefile index 6c16178..22153a5 100644 --- a/Makefile +++ b/Makefile @@ -10,17 +10,17 @@ JS_SRC = web/src/eyegestures.js MIN = $(JS_SRC:.js=.min.js) format: - $(FORMAT_TOOLS) python -m isort eyeGestures - $(FORMAT_TOOLS) python -m black eyeGestures + $(FORMAT_TOOLS) python -m isort eye_gestures eyeGestures + $(FORMAT_TOOLS) python -m black eye_gestures eyeGestures format_check: - $(CHECK_TOOLS) python -m isort eyeGestures --check - $(CHECK_TOOLS) python -m black eyeGestures --check + $(CHECK_TOOLS) python -m isort eye_gestures eyeGestures --check + $(CHECK_TOOLS) python -m black eye_gestures eyeGestures --check check: format_check - $(CHECK_TOOLS) python -m pylint eyeGestures - $(CHECK_TOOLS) python -m flake8 eyeGestures - $(CHECK_TOOLS) python -m mypy eyeGestures + $(CHECK_TOOLS) python -m pylint eye_gestures eyeGestures + $(CHECK_TOOLS) python -m flake8 eye_gestures eyeGestures + $(CHECK_TOOLS) python -m mypy eye_gestures eyeGestures # Web build min: @@ -61,4 +61,4 @@ test: ${PYTHON} -m unittest discover -s tests -p 'test_*.py'; \ else \ echo "No test files found in tests/; skipping test execution."; \ - fi \ No newline at end of file + fi diff --git a/eyeGestures/__init__.py b/eyeGestures/__init__.py new file mode 100644 index 0000000..2b51ab5 --- /dev/null +++ b/eyeGestures/__init__.py @@ -0,0 +1,36 @@ +"""Deprecated alias for :mod:`eye_gestures`. + +The module was renamed from ``eyeGestures`` to ``eye_gestures``. Importing it +under the old name still works but emits a :class:`DeprecationWarning`. +""" + +import importlib +import pkgutil +import sys +import warnings + +warnings.warn( + "the 'eyeGestures' package has been renamed to 'eye_gestures'; " + "importing 'eyeGestures' is deprecated and will be removed in the future. " + "Please update your imports to use `eye_gestures`.", + DeprecationWarning, + stacklevel=2, +) + +import eye_gestures # noqa: E402 # pylint: disable=wrong-import-position + +# Alias `eyeGestures` to `eye_gestures` +sys.modules[__name__] = eye_gestures + +# Recursively alias `eyeGestures.*` to `eye_gestures.*` (incl. subsubmodules) +for _submodule in pkgutil.walk_packages( + eye_gestures.__path__, + prefix="eye_gestures.", + onerror=lambda _: None, # otherwise swallows ImportError throws +): + try: + _module = importlib.import_module(_submodule.name) + except ImportError: + continue + _alias = __name__ + _submodule.name.removeprefix("eye_gestures") + sys.modules[_alias] = _module diff --git a/pyproject.toml b/pyproject.toml index d718e81..3ed2320 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,8 @@ features = ["python"] no-default-features = true python-source = "." module-name = "eye_gestures.EyegesturesEngine" +# Also include deprecated `eyeGestures` alias package alongside `eye_gestures` +include = ["eyeGestures/**/*.py"] [project.urls] Homepage = "https://github.com/NativeSensors/EyeGestures" From ea695e528729c1b9d0f098df8e3772dc2f36f192 Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Tue, 25 Aug 2026 23:52:52 +0000 Subject: [PATCH 3/3] tests: add `eyeGestures` module deprecation unit test --- tests/test_package_rename.py | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/test_package_rename.py diff --git a/tests/test_package_rename.py b/tests/test_package_rename.py new file mode 100644 index 0000000..96c47bd --- /dev/null +++ b/tests/test_package_rename.py @@ -0,0 +1,52 @@ +import importlib +import sys +import unittest +import warnings + + +def _import_old_name_fresh(): + """Import `eyeGestures` from scratch, returning (module, caught warnings).""" + for name in [ + n for n in sys.modules + if n == "eyeGestures" or n.startswith("eyeGestures.") + ]: + del sys.modules[name] + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + module = importlib.import_module("eyeGestures") + return module, caught + + +class TestPackageRename(unittest.TestCase): + def test_old_name_emits_deprecation_warning(self): + _, caught = _import_old_name_fresh() + self.assertTrue( + any( + issubclass(w.category, DeprecationWarning) and + "eye_gestures" in str(w.message) + for w in caught + ) + ) + + def test_old_name_is_alias_of_new_package(self): + old, _ = _import_old_name_fresh() + new = importlib.import_module("eye_gestures") + self.assertIs(old, new) + + def test_submodules_are_shared_objects(self): + _import_old_name_fresh() + old_utils = importlib.import_module("eyeGestures.utils") + new_utils = importlib.import_module("eye_gestures.utils") + self.assertIs(old_utils, new_utils) + self.assertEqual(new_utils.__name__, "eye_gestures.utils") + + def test_from_import_of_public_api(self): + _import_old_name_fresh() + old = importlib.import_module("eyeGestures") + new = importlib.import_module("eye_gestures") + self.assertIs(old.EyeGestures_v4, new.EyeGestures_v4) + + +if __name__ == "__main__": + unittest.main() +