Skip to content

docs: replace plugin matrix #4374

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
merged 4 commits into from
Mar 4, 2022
Merged

Conversation

bastimeyer
Copy link
Member

@bastimeyer bastimeyer commented Mar 3, 2022

Resolves #4369

This replaces the plugin matrix with a dynamically generated list of plugins via a custom sphinx extension that parses a mandatory header comment in each plugin. See #4369 for the motivation of this.


First commit

This adds the metadata header comment to each plugin. The data was copied from the old plugin matrix and in some cases adjusted a bit. Some plugins received additional/missing data, like zattoo for example, where URLs were copied from the plugin matcher regex. In case of zatto, this was very obvious, because of the large number of URLs and the previous notes. It's very likely that there are similar plugins that did not get updated. This can be fixed in the future.

The metadata currently also does not include any $description tags. These need to be added later and then be made mandatory once every plugin has got one. Some of the plugin descriptions can be found in each plugin's git history, because lots of old header comments got removed in the past. Checking GitHub issues and pull requests can also help.

The metadata format is very strict and gets linted via the tests added in the third commit.

Second commit

This renames the doc's plugin_matrix page to plugins and will thus make old links go 404 once merged. Since the plugin data is not represented as a table anymore, it doesn't really make sense calling the menu "plugin_matrix". The link in the main menu has always been called "Plugins" because it refers to the page's top header text.

Third commit

This finally removes the plugin matrix and replaces it with the new sphinx extension, and it also adds tests which lint the plugin files and their strict metadata format.

The sphinx extension does not lint/validate the metadata and relies on the tests for validity. Since we're building docs and are running tests in parallel, this could cause confusion, but I don't think it's a problem. The tests are all atomic and parametrized, so any errors when something gets changed or added should be trivial to resolve, and it doesn't matter if the docs fail or produce broken output.

Plugin arguments which get read from each plugin's AST are also not 100% safe, as it's just a simple lexical analysis. Extending it with more validations where the plugin arguments are defined (and that the imports are actually correct) would be possible, but it would bloat up the extension's logic by quite a bit and it's not worth it. This issue shouldn't matter too much, as plugins get reviewed before merging anyway.

Fourth commit

Updates the "developing" docs page.

The metadata is copied from the documentation's plugin_matrix, which is
going to be replaced by a sphinx extension which parses the metadata
in each plugin file and dynamically generates the plugins document.

Metadata tests will be added with sphinx extension.

TODO:
- Add $description metadata tags. Some of the plugin descriptions can be
  found in the git history, while others have to be retrieved from
  issues and pull requests on GitHub, or they have to be looked up.
- Add URLs to metadata which were previously missing in the
  plugin matrix due to space constraints (see the matcher regexes).
and fix links in other documents
@bastimeyer
Copy link
Member Author

bastimeyer commented Mar 3, 2022

@bastimeyer bastimeyer added the WIP Work in process label Mar 3, 2022
@bastimeyer
Copy link
Member Author

Not sure why the preview doesn't include any plugin arguments.
This could be caused by netlify running on an older python version. I'll check this tomorrow.

Implement custom "plugins" sphinx extension which parses metadata from
plugin files and which outputs a list of plugins with datalists that
include the annotated metadata in addition to plugin arguments and
links to plugin files + issues on GitHub.

Add plugin metadata linting tests and remove old plugin matrix tests.
@bastimeyer
Copy link
Member Author

Instead of bumping the python version on netlify, I made the AST parsing in the sphinx extension python 3.6 and 3.7 compatible. This now correctly builds with plugin arguments.

I've also updated the developing page in the docs.

@bastimeyer bastimeyer removed the WIP Work in process label Mar 3, 2022
@gravyboat
Copy link
Member

Finally had some time to review the various commits this evening. Looks good and the format makes sense to me!

@gravyboat gravyboat merged commit 64c9bd6 into streamlink:master Mar 4, 2022
@bastimeyer bastimeyer deleted the plugins/metadata branch March 4, 2022 04:35
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Mar 5, 2022
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Mar 5, 2022
Implement custom "plugins" sphinx extension which parses metadata from
plugin files and which outputs a list of plugins with datalists that
include the annotated metadata in addition to plugin arguments and
links to plugin files + issues on GitHub.

Add plugin metadata linting tests and remove old plugin matrix tests.
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Mar 5, 2022
Implement custom "plugins" sphinx extension which parses metadata from
plugin files and which outputs a list of plugins with datalists that
include the annotated metadata in addition to plugin arguments and
links to plugin files + issues on GitHub.

Add plugin metadata linting tests and remove old plugin matrix tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: replace plugin matrix with metadata comment block in each plugin file
2 participants