Draft
Conversation
Phase 2 of the hub registry migration. Validators registered in .guardrails/hub_registry.json are now resolved lazily via PEP 562 __getattr__ on first attribute access and cached for subsequent imports. Changes: - guardrails/hub/__init__.py: Replace barrel imports with __getattr__, __dir__, and cached export map built from hub_registry.json - guardrails/hub/install.py: Remove add_to_hub_inits call (registry is now the sole source of truth) - guardrails/hub/validator_package_service.py: Add unregister_validator to remove entries from the registry on uninstall - guardrails/cli/hub/uninstall.py: Use unregister_validator instead of remove_from_hub_inits - guardrails/cli/hub/list.py: Read from registry JSON instead of parsing hub/__init__.py with regex Tested with 99 passing tests covering happy path, edge cases (corrupt registry, missing exports, name collisions, missing modules), caching, and full install/uninstall/list CLI regression. Signed-off-by: debu-sinha <debusinha2009@gmail.com>
Replace barrel imports with dynamic registry-based loading (Phase 2)
Auto-generate stub file for hub imports
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Collaborator
Author
|
Notebooks show runtime issues with RAIL since the validators are not explicitly imported. Fix incoming |
Collaborator
Author
Fix pushed, specific notebooks that were failing are now working. Need to address test failures due to code moving around. |
Contributor
|
Nice, glad #1422 is part of this. Let me know if anything comes up during the server CI validation or if the dynamic resolution needs tweaks for edge cases I didn't cover. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Includes
Checks
NOTE
In order for Server CI to pass we need the following fixes released: guardrails-ai/guardrails-api#105
These fixes are unrelated to this PR, but are blocking successful sync chat completions in the tests.