Skip to content

Conversation

aksg87
Copy link
Collaborator

@aksg87 aksg87 commented Aug 7, 2025

Description

Fix IPython import warnings and improve notebook detection to ensure visualize() returns the correct type (HTML object in notebooks, string elsewhere).

Fixes #65

Bug fix

How Has This Been Tested?

$ pytest tests/visualization_test.py -v
$ python test_isolated.py  # All tests 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.

@github-actions github-actions bot added size/XS Pull request with less than 50 lines changed size/S Pull request with 50-150 lines changed labels Aug 7, 2025
- Add type ignore comments for IPython imports
- Fix return type annotation (remove unnecessary quotes)
- Add _is_jupyter() to properly detect notebook environments
- Replace lambda with def function for pylint compliance

Fixes #65
@aksg87 aksg87 force-pushed the fix-visualize-return-type branch from 709d9ee to 7ab71a3 Compare August 7, 2025 03:35
@aksg87 aksg87 self-assigned this Aug 7, 2025
@aksg87 aksg87 merged commit 6b02efb into main Aug 7, 2025
11 checks passed
aksg87 added a commit that referenced this pull request Aug 21, 2025
- Add type ignore comments for IPython imports
- Fix return type annotation (remove unnecessary quotes)
- Add _is_jupyter() to properly detect notebook environments
- Replace lambda with def function for pylint compliance

Fixes #65
sinnaj pushed a commit to sinnaj/langextract that referenced this pull request Sep 3, 2025
- Add type ignore comments for IPython imports
- Fix return type annotation (remove unnecessary quotes)
- Add _is_jupyter() to properly detect notebook environments
- Replace lambda with def function for pylint compliance

Fixes google#65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Pull request with 50-150 lines changed size/XS Pull request with less than 50 lines changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error while writing to HTML file for visualization
1 participant