Skip to content

Suggestion: Support inline/manual config & execution without external imports #10

Description

@aidankhogg

Problem to solve

Type: Enhancement / Feature Request

Description:
It would be useful if redactable supported a mode of configuration and execution that does not rely on importing external policy/config files.

Motivation:

  • Easier quick-start usage (drop into an app or script with minimal setup).
  • More developer-friendly for rapid prototyping and testing.
  • Helps when external file I/O or imports are restricted (e.g., serverless environments, locked containers).

Proposal

  • Allow passing policy definitions/config directly as Python dicts, JSON strings, or inline YAML strings.
  • Provide a convenience function or method for “manual execution” (e.g., redactable.apply(text, policy=inline_policy_dict)).
  • Ensure parity with existing file-based policy loading.

Alternatives considered

No response

Additional context

Example usage:

from redactable import apply

policy = {
    "detectors": ["EMAIL", "PHONE"],
    "transforms": {"EMAIL": "[REDACTED:EMAIL]"}
}

text = "email aidan@example.com"
print(apply(text, policy=policy))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions