-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
Report integration with Sphinx #1730
Comments
Where can I find the documentation of |
Update: Source: https://pytooling.github.io/sphinx-reports/coverage/index.html |
I think you've already worked this out, but status.json is not meant for external code to consume: it's a caching mechanism to speed up the HTML report. The I'm not sure the simplest way to get what you need. It seem to me like a niche need to have these reports included in Sphinx generated pages, so I want to find a path for you that doesn't change coverage too much. |
As I transitioned to the "bigger" JSON, I'm already in the phase reading and using all coverage data. I hoped to get along with So I think ReST output or so from Coverage.py is not needed. At next I want to figure out how to create subpages in Sphinx and how to colorize source code. This is currently black magic in Sphinx. What might be interesting for me is the sorting feature that you use in your HTML tables. Do you have suggestions on level for the coloring? |
…ce to look In nedbat/coveragepy#1730 and nedbat/coveragepy#1732, it's clear that people might poke around and find apparently useful information in the htmlcov/status.json file. Add a note to try to get them to the place they want to be. https://htmlpreview.github.io/?https://github.com/nedbat/coverage-reports/blob/main/reports/20240115_1a416b6786/htmlcov/index.html 1a416b6786: master
Hi, I don't have suggestions for the levels for various colors. Probably people will want it to be configurable, but that's up to you. It sounds like you have everything you need from me? |
Yes, the number of levels and the percentage can be configured. I plan to have some kind of default coloring, but otherwise the user colors are used. Actually it's a percentage, description text (good, bad, very bad, ..) and a CSS class name.
May be this part:
The Javascript and column sorting is this code written/owned by you or some kind of library? I think it might be good to have a hierarchy and a sorted view. I see Coverage.py add a JS file into the out put directory. |
Is your feature request related to a problem? Please describe.
Usually, all my Python projects are documented using Sphinx. Such a documentation contains also an auto generated Python Class Reference as well as multiple code quality indications / analysis reports. Currently this is: code coverage by
coveragypy
, unit tests bypytest
, static typing analysis bymypy
and documentation coverage bydocstr_coverage
.Most tools provide a machine readable output format (e.g. in XML or JSON) and almost all are writing or converting them to an HTML report. This can be a single file or multiple files in a directory.
For integration into the overall documentation, multiple CI jobs generate the results and generated HTML pages and then a final CI job combines all artifacts to a combined static website for e.g. GitHub Pages.
In the last days I investigated and prototyped a new Sphinx extension, which integrates a documentation coverage report directly as native Sphinx content into the documentation. This offers some huge benefits:
I would like to discuss if and how to integrate
coveragepy
into such a Sphinx extension. My extensionsphinx-reports
is open to more report formats like code coverage.This is an example from my prototype for documentation coverage:
Describe the solution you'd like
I would like to read and render code coverage results into Sphinx documentation pages.
I would like to address it in 2 steps:
coveragepy
's summary page and then link to auto generated coverage pages.(I haven't figured out how to write complex Sphinx content like colored source code.)
The extensions alpha code is here: https://pytooling.github.io/sphinx-reports
Describe alternatives you've considered
I checked, if auto generated HTML code from
coveragepy
could be copied into a placeholder Sphinx page. While content was transferred, I found huge problems with CSS and Javascript contents. It would results in dozens - if not hundreds - of regex-based rewrite and transformation rules. This can't be maintained.An other alternative would be
coveragepy
offering ReST (Restructured Text) output and such files could be referenced by atoctree
directive.Additional context
I believe that expressing the quality of an open-source project is a need to convince others to use and maybe invest time in someone open-source project. It also can shorten some discussions if a library can be used easily and safely.
The text was updated successfully, but these errors were encountered: