Skip to content

Move getFormattedStacksForAllThreads from watchdog to logHandler, to fix build of developer documentation. #15616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lukaszgo1
Copy link
Contributor

Link to issue number:

None, related to #12971 problem caused by PR #14899

Summary of the issue:

When trying to build developer documentation with Sphinx, many modules failed to be parsed with one of the following errors:

WARNING: autodoc: failed to import module 'IAccessibleHandler'; the following exception was raised:
cannot import name 'getFormattedStacksForAllThreads' from 'watchdog' (D:\my_repos\nvda\source\watchdog.py)
WARNING: autodoc: failed to import module 'NVDAObjects'; the following exception was raised:
Traceback (most recent call last):
  File "D:\my_repos\nvda\.venv\lib\site-packages\sphinx\ext\autodoc\importer.py", line 58, in import_module
    return importlib.import_module(modname)
  File "C:\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\my_repos\nvda\source\NVDAObjects\__init__.py", line 23, in <module>
    import review
  File "D:\my_repos\nvda\source\review.py", line 11, in <module>
    import api
  File "D:\my_repos\nvda\source\api.py", line 21, in <module>
    from NVDAObjects.window import Window
  File "D:\my_repos\nvda\source\NVDAObjects\window\__init__.py", line 16, in <module>
    import displayModel
  File "D:\my_repos\nvda\source\displayModel.py", line 17, in <module>
    import mouseHandler
  File "D:\my_repos\nvda\source\mouseHandler.py", line 10, in <module>
    import gui
  File "D:\my_repos\nvda\source\gui\__init__.py", line 37, in <module>
    from .speechDict import (
  File "D:\my_repos\nvda\source\gui\speechDict.py", line 20, in <module>
    from .settingsDialogs import SettingsDialog
  File "D:\my_repos\nvda\source\gui\settingsDialogs.py", line 66, in <module>
    import updateCheck
  File "D:\my_repos\nvda\source\updateCheck.py", line 345, in <module>
    gui.contextHelp.ContextHelpMixin,AttributeError: module 'gui' has no attribute 'contextHelp'

I've tracked this down to PR #14899, which imported stuff from watchdog in the hwIo package.

Description of user facing changes

None - this only moves code used internally for logging.

Description of development approach

getFormattedStacksForAllThreads is moved from watchdog to the logHandler, which avoids these warnings. Appropriate backwards compatibility is added to watchdog, to make sure add-on authors are warned to use the moved function from logHandler in the future.

Testing strategy:

Ensured that for affected modules developer documentation can once again be created.

Known issues with pull request:

  • If someone has better suggestions as to where getFormattedStacksForAllThreads should be placed I'd be happy to hear them
  • While this PR makes developer documentation buildable once again, it only covers the underlying issue. There is a circular import somewhere in NVDA's code base which should be found and fixed separately

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@lukaszgo1 lukaszgo1 marked this pull request as ready for review October 12, 2023 15:42
@lukaszgo1 lukaszgo1 requested a review from a team as a code owner October 12, 2023 15:42
@lukaszgo1 lukaszgo1 requested a review from seanbudd October 12, 2023 15:42
Copy link
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lukaszgo1

@seanbudd seanbudd merged commit 03c8abe into nvaccess:master Oct 12, 2023
@nvaccessAuto nvaccessAuto added this to the 2024.1 milestone Oct 12, 2023
@lukaszgo1 lukaszgo1 deleted the movegetFormattedStacksForAllThreads branch October 13, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants