Skip to content
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

Move hints to their own place, with API and unicorns #3495

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

happz
Copy link
Collaborator

@happz happz commented Jan 29, 2025

I wanted to change a couple of things about "hints" tmt shows to users when when a package is missing and functionality is limited:

  • Static, stored in a single function. That made them detached from their origin, and 3rd party plugins would have no chance to add their own hints.
  • A bit confined text of hints did not cover all possible venues. PyPI installation was ignored by some, other hints spoke just about using pip install.
  • Hints are interesting and useful, but visible only when error strikes.

The patch turns the function into a "registry", a simple dictionary storing them. Plugins and tmt code in general can "register" their hints, and a nice tools are available for showing them.

Hints wow have IDs, and there are dedicated IDs for step-specific (report, ...) and plugin-specific (report/foo) hints, allowing tmt core to print them when step or plugins crashes on import.

Plugin-specific hints are now rendered both in their CLI and HTML documentation.

In the future, I would like to provide hints not just as "a package foo is missing, install it" guide, but also explaining various errors and issues tmt would report, e.g. pairing them with exceptions, "To learn more, run tmt about E1234".

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • include a release note

@happz happz added code | style Code style changes not affecting functionality code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. labels Jan 29, 2025
@happz happz added this to the 1.43 milestone Jan 29, 2025
@happz happz added ci | full test Pull request is ready for the full test execution status | blocked The merging of PR is blocked on some other issue labels Jan 31, 2025
@happz
Copy link
Collaborator Author

happz commented Jan 31, 2025

Adding blocked, I think I can do something with dedent() calls.

@happz happz force-pushed the hints-everywhere branch 4 times, most recently from a010e3b to 176d9dd Compare February 3, 2025 19:51
I wanted to change a couple of things about "hints" tmt shows to users
when when a package is missing and functionality is limited:

* Static, stored in a single function. That made them detached from
  their origin, and 3rd party plugins would have no chance to add
  their own hints.
* A bit confined text of hints did not cover all possible venues. PyPI
  installation was ignored by some, other hints spoke just about using
  `pip install`.
* Hints are interesting and useful, but visible only when error strikes.

The patch turns the function into a "registry", a simple dictionary
storing them. Plugins and tmt code in general can "register" their
hints, and a nice tools are available for showing them.

Hints wow have IDs, and there are dedicated IDs for step-specific
(``report``, ...) and plugin-specific (``report/foo``) hints, allowing
tmt core to print them when step or plugins crashes on import.

Plugin-specific hints are now rendered both in their CLI and HTML
documentation.

In the future, I would like to provide hints not just as "a package foo
is missing, install it" guide, but also explaining various errors and
issues tmt would report, e.g. pairing them with exceptions, "To learn
more, run `tmt about E1234`".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. code | style Code style changes not affecting functionality status | blocked The merging of PR is blocked on some other issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant