Skip to content

fix: make IssueKind public and export it in __all__#426

Open
kredd2506 wants to merge 1 commit intogoogle:mainfrom
kredd2506:fix/make-issuekind-public
Open

fix: make IssueKind public and export it in __all__#426
kredd2506 wants to merge 1 commit intogoogle:mainfrom
kredd2506:fix/make-issuekind-public

Conversation

@kredd2506
Copy link
Copy Markdown

Description

Rename _IssueKindIssueKind (drop the leading underscore) and add it to __all__ in prompt_validation.py.

ValidationIssue.issue_kind is a public field typed as _IssueKind, a private enum not included in __all__. This forces users to import a private symbol to filter individual issues:

# Before (accessing private symbol)
from langextract.prompt_validation import _IssueKind
failed = [i for i in report.issues if i.issue_kind == _IssueKind.FAILED]

# After (clean public API)
from langextract.prompt_validation import IssueKind
failed = [i for i in report.issues if i.issue_kind == IssueKind.FAILED]

Fixes #389

Bug fix

How Has This Been Tested?

$ pytest tests/prompt_validation_test.py -q
15 passed in 1.18s

$ pytest tests/ -q --ignore=tests/inference_test.py
370 passed, 76 warnings, 29 subtests passed

Checklist:

  • I have read and acknowledged Google's Open Source Code of conduct.
  • I have read the Contributing page, and I either signed the Google Individual CLA or am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have made any needed documentation changes, or noted in the linked issue(s) that documentation elsewhere needs updating.
  • I have added tests, or I have ensured existing tests cover the changes
  • I have followed Google's Python Style Guide and ran pylint over the affected code.

Rename _IssueKind to IssueKind so users can filter individual
ValidationIssue objects without importing a private symbol.

Fixes google#389
@github-actions github-actions bot added the size/XS Pull request with less than 50 lines changed label Mar 26, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

⚠️ Branch Update Required

Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

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

Labels

size/XS Pull request with less than 50 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: _IssueKind is private/unexported but used in public ValidationIssue.issue_kind field

1 participant