diff --git a/pyproject.toml b/pyproject.toml index 45b2c77..389e546 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,9 @@ Source = "https://github.com/max-models/patchwork" [project.scripts] patchwork = "patchwork.main:main" +[project.entry-points."scope_profiler.opt_in_tags"] +patchwork = "patchwork" + [tool.setuptools.packages.find] where = [ "src" ] diff --git a/src/patchwork/tests/unit/test_profiling.py b/src/patchwork/tests/unit/test_profiling.py index 3cb0cbe..0c2a9b0 100644 --- a/src/patchwork/tests/unit/test_profiling.py +++ b/src/patchwork/tests/unit/test_profiling.py @@ -43,3 +43,17 @@ def test_enable_tags_records_the_patchwork_regions(): "patchwork.exchange_halos", "patchwork.build_schedule", } <= names + + +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 patchwork._profiling 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("patchwork") == "patchwork" + assert "patchwork" in PROFILE_TAGS