From f0a1a9418244181f638e144d74e678bed0ef4b09 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 28 Oct 2026 22:13:39 +0100 Subject: [PATCH] Declare the scope_profiler.opt_in_tags entry point. --- pyproject.toml | 3 +++ tests/unit/test_opt_in_profiling.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f26fe5a..061995b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,9 @@ optional-dependencies.test = [ "coverage", "pytest", "scipy" ] optional-dependencies.test-compiled = [ "cunumpy[test]", "pyccel" ] urls."Source" = "https://github.com/max-models/cunumpy" +[project.entry-points."scope_profiler.opt_in_tags"] +cunumpy = "cunumpy" + [tool.setuptools.packages.find] where = [ "src" ] diff --git a/tests/unit/test_opt_in_profiling.py b/tests/unit/test_opt_in_profiling.py index e4b6c50..60860ce 100644 --- a/tests/unit/test_opt_in_profiling.py +++ b/tests/unit/test_opt_in_profiling.py @@ -35,3 +35,17 @@ def test_regions_are_off_by_default(profiler): def test_enabled_tag_records_regions(profiler, tags): regions = _cunumpy_regions(enable_tags=tags) assert sorted(regions) == ["cunumpy.kernel.noop", "cunumpy.sort_by_key"] + + +def test_the_opt_in_tag_has_an_entry_point(): + """``scope-profiler tags`` finds the tag through the package's entry point.""" + from importlib.metadata import entry_points + + from cunumpy._profile_tags import _PROFILE_TAGS + + found = { + entry_point.name: entry_point.value + for entry_point in entry_points(group="scope_profiler.opt_in_tags") + } + assert found.get("cunumpy") == "cunumpy" + assert "cunumpy" in _PROFILE_TAGS