Skip to content

feat: expose Data Designer run config#203

Open
lipikaramaswamy wants to merge 3 commits into
mainfrom
lipikaramaswamy/feature/data-designer-run-config
Open

feat: expose Data Designer run config#203
lipikaramaswamy wants to merge 3 commits into
mainfrom
lipikaramaswamy/feature/data-designer-run-config

Conversation

@lipikaramaswamy

@lipikaramaswamy lipikaramaswamy commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds an optional data_designer_run_config parameter to Anonymizer(...) so callers can configure Data Designer runtime controls such as buffer_size and max_in_flight_tasks while still using Anonymizer's normal model config/provider loading path.

The name is intentionally explicit: it sits next to the existing advanced data_designer constructor parameter and avoids overloading run_config, which could be confused with AnonymizerConfig or anonymizer.run(config=...).

This keeps execution/backpressure tuning on the runtime constructor instead of putting it on AnonymizerConfig, which remains focused on anonymization behavior. The PR also re-exports RunConfig from anonymizer so examples can use the public Anonymizer import path.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Testing

  • make test passes locally
  • make check passes locally (format + lint + typecheck + lock-check)
  • Added/updated tests for changes

Targeted validation run:

  • uv run pytest tests/interface/test_anonymizer_interface.py -q
  • uv run ruff check src/anonymizer/interface/anonymizer.py tests/interface/test_anonymizer_interface.py

Documentation

  • If docs changed: make docs-build passes locally

No docs changed. This small API hook is intended to support self-hosted Data Designer runtime/backpressure configuration without bypassing Anonymizer's provider setup.

Related Issues

@lipikaramaswamy lipikaramaswamy force-pushed the lipikaramaswamy/feature/data-designer-run-config branch from 04ded89 to b73f6d6 Compare July 2, 2026 00:45
@lipikaramaswamy lipikaramaswamy marked this pull request as ready for review July 7, 2026 03:13
@lipikaramaswamy lipikaramaswamy requested a review from a team as a code owner July 7, 2026 03:13
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an optional data_designer_run_config: RunConfig | None parameter to Anonymizer.__init__ so callers can configure Data Designer runtime knobs (e.g. buffer_size, max_in_flight_tasks) without bypassing Anonymizer's provider-loading path. RunConfig is also re-exported from the top-level anonymizer package for discoverability.

  • RunConfig is correctly placed under TYPE_CHECKING in anonymizer.py (guarded from runtime import) while being eagerly imported in __init__.py for public API exposure, consistent with the ModelProvider pattern.
  • set_run_config is applied unconditionally to whichever DataDesigner instance ends up in self._data_designer — both the Anonymizer-managed and caller-supplied paths — and both are covered by new unit tests.

Confidence Score: 5/5

Safe to merge — the change is a small, additive parameter with no breaking surface and no mutations to existing paths when the new parameter is omitted.

The new data_designer_run_config parameter is fully opt-in and defaults to None, so all existing call sites are unaffected. The RunConfig import is correctly annotation-only in anonymizer.py and correctly eager in __init__.py for public API re-export. Both DataDesigner paths (managed and caller-supplied) are exercised by dedicated unit tests. No logic is removed or restructured.

No files require special attention.

Important Files Changed

Filename Overview
src/anonymizer/init.py Exports RunConfig as a top-level public symbol with an eager import, consistent with the existing ModelProvider pattern.
src/anonymizer/interface/anonymizer.py Adds data_designer_run_config parameter; RunConfig is correctly placed under TYPE_CHECKING so it is annotation-only; set_run_config is applied after the managed/supplied DataDesigner branch and before NddAdapter construction.
tests/interface/test_anonymizer_interface.py Two new tests cover both code paths (Anonymizer-managed DataDesigner and caller-supplied DataDesigner), asserting set_run_config is called with the supplied RunConfig.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Caller
    participant Anonymizer
    participant DataDesigner

    Caller->>Anonymizer: "__init__(data_designer_run_config=RunConfig(...))"
    alt data_designer is None (managed)
        Anonymizer->>DataDesigner: DataDesigner(artifact_path, model_providers)
        DataDesigner-->>Anonymizer: instance
    else data_designer supplied by caller
        Caller->>Anonymizer: "__init__(data_designer=existing_dd, data_designer_run_config=RunConfig(...))"
        Anonymizer->>Anonymizer: "self._data_designer = existing_dd"
    end
    Anonymizer->>DataDesigner: set_run_config(data_designer_run_config)
    Anonymizer->>Anonymizer: "NddAdapter(data_designer=self._data_designer)"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Caller
    participant Anonymizer
    participant DataDesigner

    Caller->>Anonymizer: "__init__(data_designer_run_config=RunConfig(...))"
    alt data_designer is None (managed)
        Anonymizer->>DataDesigner: DataDesigner(artifact_path, model_providers)
        DataDesigner-->>Anonymizer: instance
    else data_designer supplied by caller
        Caller->>Anonymizer: "__init__(data_designer=existing_dd, data_designer_run_config=RunConfig(...))"
        Anonymizer->>Anonymizer: "self._data_designer = existing_dd"
    end
    Anonymizer->>DataDesigner: set_run_config(data_designer_run_config)
    Anonymizer->>Anonymizer: "NddAdapter(data_designer=self._data_designer)"
Loading

Reviews (3): Last reviewed commit: "refactor: defer run config type import" | Re-trigger Greptile

Comment on lines 15 to 17
from data_designer.config.models import ModelProvider
from data_designer.config.run_config import RunConfig
from data_designer.config.utils.io_helpers import load_config_file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 RunConfig is only used in the type annotation for data_designer_run_config — it is never instantiated or called at runtime. The file already uses from __future__ import annotations (PEP 563), which stringifies all annotations so the class doesn't need to be present at import time. The existing convention in this file is to put annotation-only data_designer imports under TYPE_CHECKING (see DataDesignerConfigBuilder on line 89). Moving RunConfig there avoids an unnecessary eager import of data_designer.config.run_config on every module load.

Suggested change
from data_designer.config.models import ModelProvider
from data_designer.config.run_config import RunConfig
from data_designer.config.utils.io_helpers import load_config_file
from data_designer.config.models import ModelProvider
from data_designer.config.utils.io_helpers import load_config_file

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Signed-off-by: lipikaramaswamy <lramaswamy@nvidia.com>
Signed-off-by: lipikaramaswamy <lramaswamy@nvidia.com>

@asteier2026 asteier2026 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants