Skip to content

[bug] Importing guardrails raises a deprecation warning for old validators #637

@ShreyaR

Description

@ShreyaR

Describe the bug
Running import guardrails as gd results in

[/Users/shreyarajpal/guardrails/guardrails/validators/__init__.py:50](https://file+.vscode-resource.vscode-cdn.net/Users/shreyarajpal/guardrails/guardrails/validators/__init__.py:50): FutureWarning: 
    Importing validators from `guardrails.validators` is deprecated.
    All validators are now available in the Guardrails Hub. Please install
    and import them from the hub instead. All validators will be
    removed from this module in the next major release.

    Install with: `guardrails hub install hub://<namespace>/<validator_name>`
    Import as: from guardrails.hub import `ValidatorName`
    
  warn(

Expected behavior
The warning should only be raised when a user imports a validator from the hub, not just by a guardrails import.

Library version:
Latest master

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions