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

Merged
merged 2 commits into from
Feb 26, 2025
Merged

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
  • extend the test coverage - I plan to connect these to tmt about, together with listing all discovered plugins it should give me enough tools to test the features

Sorry, something went wrong.

@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 5 times, most recently from 176d9dd to d54ed6d Compare February 5, 2025 13:02
@happz happz force-pushed the hints-everywhere branch 3 times, most recently from a08c302 to 1d6b965 Compare February 14, 2025 09:58
@happz happz removed the status | blocked The merging of PR is blocked on some other issue label Feb 17, 2025
@happz happz force-pushed the hints-everywhere branch 2 times, most recently from ae6f753 to af70e2e Compare February 19, 2025 08:04
Copy link
Collaborator

@therazix therazix left a comment

Choose a reason for hiding this comment

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

A couple of f prefixes are missing for f-strings. Otherwise, looks good.

@lukaszachy lukaszachy modified the milestones: 1.43, 1.44 Feb 25, 2025
@happz happz added the status | blocking other work An important pull request, blocking other pull requests or issues label Feb 25, 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`".
@happz happz added the status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish. label Feb 26, 2025
@happz happz enabled auto-merge (squash) February 26, 2025 13:22
@happz happz merged commit e994780 into main Feb 26, 2025
22 checks passed
@happz happz deleted the hints-everywhere branch February 26, 2025 14:48
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 | blocking other work An important pull request, blocking other pull requests or issues status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants