sphinx-reports


Namesphinx-reports JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://GitHub.com/pyTooling/sphinx_reports
SummaryA Sphinx extension providing reports and summaries embedded in documentation pages.
upload_time2024-01-22 22:55:00
maintainer
docs_urlNone
authorPatrick Lehmann
requires_python>=3.9
licenseApache-2.0
keywords python3 sphinx extension report doc-string interrogate
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Sourcecode on GitHub](https://img.shields.io/badge/pyTooling-sphinx--reports-323131.svg?logo=github&longCache=true)](https://github.com/pyTooling/sphinx-reports)
[![License](https://img.shields.io/badge/code%20license-Apache%20License%2C%202.0-lightgrey?logo=GitHub)](LICENSE.md)
[![GitHub tag (latest SemVer incl. pre-release)](https://img.shields.io/github/v/tag/pyTooling/sphinx-reports?logo=GitHub&include_prereleases)](https://github.com/pyTooling/sphinx-reports/tags)
[![GitHub release (latest SemVer incl. including pre-releases)](https://img.shields.io/github/v/release/pyTooling/sphinx-reports?logo=GitHub&include_prereleases)](https://github.com/pyTooling/sphinx-reports/releases/latest)
[![GitHub release date](https://img.shields.io/github/release-date/pyTooling/sphinx-reports?logo=GitHub&)](https://github.com/pyTooling/sphinx-reports/releases)  
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pyTooling/sphinx-reports/Test,%20Coverage%20and%20Release?label=Workflow&logo=GitHub)](https://github.com/pyTooling/sphinx-reports/actions?query=workflow%3A%22Test%2C+Coverage+and+Release%22)
[![PyPI](https://img.shields.io/pypi/v/sphinx-reports?logo=PyPI)](https://pypi.org/project/sphinx-reports/)
![PyPI - Status](https://img.shields.io/pypi/status/sphinx-reports?logo=PyPI)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-reports?logo=PyPI)
[![Dependent repos (via libraries.io)](https://img.shields.io/librariesio/dependent-repos/pypi/sphinx-reports)](https://github.com/pyTooling/sphinx-reports/network/dependents)  
[![Libraries.io status for latest release](https://img.shields.io/librariesio/release/pypi/sphinx-reports)](https://libraries.io/github/pyTooling/sphinx-reports)
[![Requires.io](https://img.shields.io/requires/github/pyTooling/sphinx-reports)](https://requires.io/github/pyTooling/sphinx-reports/requirements/?branch=master)  
[![Codacy - Quality](https://img.shields.io/codacy/grade/9a89bbc1d2c04a699ea14abea75588c7?logo=Codacy)](https://www.codacy.com/manual/pyTooling/sphinx-reports)
[![Codacy - Coverage](https://img.shields.io/codacy/coverage/9a89bbc1d2c04a699ea14abea75588c7?logo=Codacy)](https://www.codacy.com/manual/pyTooling/sphinx-reports)
[![Codecov - Branch Coverage](https://img.shields.io/codecov/c/github/pyTooling/sphinx-reports?logo=Codecov)](https://codecov.io/gh/pyTooling/sphinx-reports)
[![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/pypi/sphinx-reports)](https://libraries.io/github/pyTooling/sphinx-reports/sourcerank)  
<!-- [![Read the Docs](https://img.shields.io/readthedocs/sphinx-reports)](https://pyVersioning.readthedocs.io/en/latest/) -->


# Sphinx Reports

The Sphinx extension `sphinx_reports` offers a set of directives to integrate reports and summaries into the
documentation generated by Sphinx.

Supported format reports are:
* ✅ Documentation coverage (by [docstr_coverage](https://github.com/HunterMcGushion/docstr_coverage) (or `interrogate`?))
* 🚧 Code coverage (by [Coverage.py](https://github.com/nedbat/coveragepy))
  * ✅ Summary page (displaying `coverage.json`)
  * 🚧 Highlighted source code
* ✅🚧 Unit Test summaries (by [pytest](https://github.com/pytest-dev/pytest))
  * ✅ Summary page (displaying `unittest.xml`)
  * 🚧 Show logging, output and error messages.
* 🚧 Dependencies (reading `requirements.txt` files)

![Code Coverage Summary Page](.github/CodeCoverage.png)


## Extension Configuration

This README demonstrates a quick and minimal configuration for the Sphinx extension and it's provided directives. See
the [sphinx-reports documentation](https://pyTooling.github.io/sphinx-reports) for more details.

At first, add the extension name to the list of extensions in `conf.py`, so the extension is loaded by Sphinx.

```Python
# Sphinx extensions
extensions = [
  # ...
  "sphinx_reports",
]
```

Each report directive might require an individual configuration, therefore see the next sections for details.

## Documentation Coverage

*Documentation Coverage* counts how many publicly accessible members are documented using a Python *doc-string*. Based
on the count of possibly documented public members and the actual number of non-empty *doc-strings*, a percentage of
documentation coverage can be computed.

Documentation coverage is a measure of code quality, which expresses how well documented (completeness or documentation,
but not necessarily quality/helpfulness of documentation) source code is. Well documented code helps to use and maintain
the existing code base. It also allows for automated documentation generation.


### Quick Configuration

This is a quick and minimal configuration for the *documentation coverage* directives.
See [documentation coverage](https://pyTooling.github.io/sphinx-reports/DocCov/index.html) documentation for more
details.

1. Configure one or more Python packages for documentation coverage analysis in `conf.py` by adding a new 'section' 
   defining some configuration variables. Each package is identified by an ID, which is later referred to by the report
   directive. Here, the ID is called `src` (dictionary key). Each package needs 4 configuration entries:

   * `name` - Name of the Python package[^1].
   * `directory` - The directory of the package to analyze.
   * `fail_below` - An integer value in range 0..100, for when a documentation coverage is considered FAILED.
   * `levels` - A dictionary of coverage limits, their description and CSS style classes.

   ```Python
   # ==============================================================================
   # Sphinx-reports - DocCov
   # ==============================================================================
   report_doccov_packages = {
     "src": {
       "name":       "myPackage",
       "directory":  "../myPackage",
       "fail_below": 80,
       "levels": {
         30:      {"class": "report-cov-below30",  "desc": "almost undocumented"},
         50:      {"class": "report-cov-below50",  "desc": "poorly documented"},
         80:      {"class": "report-cov-below80",  "desc": "roughly documented"},
         90:      {"class": "report-cov-below90",  "desc": "well documented"},
         100:     {"class": "report-cov-below100", "desc": "excellent documented"},
         "error": {"class": "report-cov-error",    "desc": "internal error"},
       },
     }
   }
   ```
2. Add the `doc-coverage` directive into your Restructured Text (ReST) document.
   
   * `packageid` - The ID used in `conf.py` to describe a Python package.
   * `legend` (optional) - Position of the legend (`no_legend`, `top`, `bottom`, `both`)

   ```Python
   .. report:doc-coverage::
      :packageid: src
   ```

## Code Coverage

*Code Coverage* checks if a source code was used during execution. Usually, testcases are run by a testcase execution
framework like [pytest](https://github.com/pytest-dev/pytest), which also offers to instrument the code for code
coverage collection using the `pytest-cov` plugin. For Python, coverage collection is usually based on
[Coverage.py](https://github.com/nedbat/coveragepy>), which supports statement and branch coverage collection.

### Quick Configuration

This is a quick and minimal configuration for the *code coverage* directives.
See [code coverage](https://pyTooling.github.io/sphinx-reports/CodeCov/index.html) documentation for more
details.

1. Configure one or more coverage analysis reports in `conf.py` by adding a new 'section' defining some configuration
   variables. Each analysis report is identified by an ID, which is later referred to by the report directive. Here, the
   ID is called ``src`` (dictionary key). Each analysis report needs 4 configuration entries:

   * `name` - Name of the Python package[^1].
   * `json_report` - The code coverage report as JSON file as generated by *Coverage.py*.
   * `fail_below` - An integer value in range 0..100, for when a code coverage is considered FAILED.
   * `levels` - A dictionary of coverage limits, their description and CSS style classes.

   ```Python
   # ==============================================================================
   # Sphinx-reports - CodeCov
   # ==============================================================================
   report_codecov_packages = {
     "src": {
       "name":        "myPackage",
       "json_report": "../report/coverage/coverage.json",
       "fail_below":  80,
       "levels": {
         30:      {"class": "report-cov-below30",  "desc": "almost unused"},
         50:      {"class": "report-cov-below50",  "desc": "poorly used"},
         80:      {"class": "report-cov-below80",  "desc": "medium used"},
         90:      {"class": "report-cov-below90",  "desc": "well well"},
         100:     {"class": "report-cov-below100", "desc": "excellent used"},
         "error": {"class": "report-cov-error",    "desc": "internal error"},
       },
     }
   }
   ```
2. Add the `code-coverage` directive into your Restructured Text (ReST) document.
   
   * `packageid` - The ID used in `conf.py` to describe a Python package.
   * `legend` (optional) - Position of the legend (`no_legend`, `top`, `bottom`, `both`)

   ```Python
   .. report:code-coverage::
      :packageid: src
   ```

## Unit Test Summary

```
UnitTest: write introduction
```


## Dependencies

```
Dep: write introduction
```


## Contributors

* [Patrick Lehmann](https://github.com/Paebbels) (Maintainer)
* [and more...](https://GitHub.com/pyTooling/sphinx-reports/graphs/contributors)


## License

This Python package (source code) is licensed under [Apache License 2.0](LICENSE.md).  
The accompanying documentation is licensed under Creative Commons - Attribution-4.0 (CC-BY 4.0).


-------------------------

SPDX-License-Identifier: Apache-2.0


[^1]: Toplevel Python packages can reside in a directory not matching the package name. This is possible because the
      toplevel package name is set in the package installation description. This is not good practice, but possible and
      unfortunately widely used. E.g. `src` as directory name.

            

Raw data

            {
    "_id": null,
    "home_page": "https://GitHub.com/pyTooling/sphinx_reports",
    "name": "sphinx-reports",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "Python3,Sphinx,Extension,Report,doc-string,interrogate",
    "author": "Patrick Lehmann",
    "author_email": "Paebbels@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/e0/ac612b21e2ac2d627cb112c840fbacc212d5633ad5cca3647f14bb7db5f0/sphinx_reports-0.6.0.tar.gz",
    "platform": null,
    "description": "[![Sourcecode on GitHub](https://img.shields.io/badge/pyTooling-sphinx--reports-323131.svg?logo=github&longCache=true)](https://github.com/pyTooling/sphinx-reports)\n[![License](https://img.shields.io/badge/code%20license-Apache%20License%2C%202.0-lightgrey?logo=GitHub)](LICENSE.md)\n[![GitHub tag (latest SemVer incl. pre-release)](https://img.shields.io/github/v/tag/pyTooling/sphinx-reports?logo=GitHub&include_prereleases)](https://github.com/pyTooling/sphinx-reports/tags)\n[![GitHub release (latest SemVer incl. including pre-releases)](https://img.shields.io/github/v/release/pyTooling/sphinx-reports?logo=GitHub&include_prereleases)](https://github.com/pyTooling/sphinx-reports/releases/latest)\n[![GitHub release date](https://img.shields.io/github/release-date/pyTooling/sphinx-reports?logo=GitHub&)](https://github.com/pyTooling/sphinx-reports/releases)  \n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pyTooling/sphinx-reports/Test,%20Coverage%20and%20Release?label=Workflow&logo=GitHub)](https://github.com/pyTooling/sphinx-reports/actions?query=workflow%3A%22Test%2C+Coverage+and+Release%22)\n[![PyPI](https://img.shields.io/pypi/v/sphinx-reports?logo=PyPI)](https://pypi.org/project/sphinx-reports/)\n![PyPI - Status](https://img.shields.io/pypi/status/sphinx-reports?logo=PyPI)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-reports?logo=PyPI)\n[![Dependent repos (via libraries.io)](https://img.shields.io/librariesio/dependent-repos/pypi/sphinx-reports)](https://github.com/pyTooling/sphinx-reports/network/dependents)  \n[![Libraries.io status for latest release](https://img.shields.io/librariesio/release/pypi/sphinx-reports)](https://libraries.io/github/pyTooling/sphinx-reports)\n[![Requires.io](https://img.shields.io/requires/github/pyTooling/sphinx-reports)](https://requires.io/github/pyTooling/sphinx-reports/requirements/?branch=master)  \n[![Codacy - Quality](https://img.shields.io/codacy/grade/9a89bbc1d2c04a699ea14abea75588c7?logo=Codacy)](https://www.codacy.com/manual/pyTooling/sphinx-reports)\n[![Codacy - Coverage](https://img.shields.io/codacy/coverage/9a89bbc1d2c04a699ea14abea75588c7?logo=Codacy)](https://www.codacy.com/manual/pyTooling/sphinx-reports)\n[![Codecov - Branch Coverage](https://img.shields.io/codecov/c/github/pyTooling/sphinx-reports?logo=Codecov)](https://codecov.io/gh/pyTooling/sphinx-reports)\n[![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/pypi/sphinx-reports)](https://libraries.io/github/pyTooling/sphinx-reports/sourcerank)  \n<!-- [![Read the Docs](https://img.shields.io/readthedocs/sphinx-reports)](https://pyVersioning.readthedocs.io/en/latest/) -->\n\n\n# Sphinx Reports\n\nThe Sphinx extension `sphinx_reports` offers a set of directives to integrate reports and summaries into the\ndocumentation generated by Sphinx.\n\nSupported format reports are:\n* \u2705 Documentation coverage (by [docstr_coverage](https://github.com/HunterMcGushion/docstr_coverage) (or `interrogate`?))\n* \ud83d\udea7 Code coverage (by [Coverage.py](https://github.com/nedbat/coveragepy))\n  * \u2705 Summary page (displaying `coverage.json`)\n  * \ud83d\udea7 Highlighted source code\n* \u2705\ud83d\udea7 Unit Test summaries (by [pytest](https://github.com/pytest-dev/pytest))\n  * \u2705 Summary page (displaying `unittest.xml`)\n  * \ud83d\udea7 Show logging, output and error messages.\n* \ud83d\udea7 Dependencies (reading `requirements.txt` files)\n\n![Code Coverage Summary Page](.github/CodeCoverage.png)\n\n\n## Extension Configuration\n\nThis README demonstrates a quick and minimal configuration for the Sphinx extension and it's provided directives. See\nthe [sphinx-reports documentation](https://pyTooling.github.io/sphinx-reports) for more details.\n\nAt first, add the extension name to the list of extensions in `conf.py`, so the extension is loaded by Sphinx.\n\n```Python\n# Sphinx extensions\nextensions = [\n  # ...\n  \"sphinx_reports\",\n]\n```\n\nEach report directive might require an individual configuration, therefore see the next sections for details.\n\n## Documentation Coverage\n\n*Documentation Coverage* counts how many publicly accessible members are documented using a Python *doc-string*. Based\non the count of possibly documented public members and the actual number of non-empty *doc-strings*, a percentage of\ndocumentation coverage can be computed.\n\nDocumentation coverage is a measure of code quality, which expresses how well documented (completeness or documentation,\nbut not necessarily quality/helpfulness of documentation) source code is. Well documented code helps to use and maintain\nthe existing code base. It also allows for automated documentation generation.\n\n\n### Quick Configuration\n\nThis is a quick and minimal configuration for the *documentation coverage* directives.\nSee [documentation coverage](https://pyTooling.github.io/sphinx-reports/DocCov/index.html) documentation for more\ndetails.\n\n1. Configure one or more Python packages for documentation coverage analysis in `conf.py` by adding a new 'section' \n   defining some configuration variables. Each package is identified by an ID, which is later referred to by the report\n   directive. Here, the ID is called `src` (dictionary key). Each package needs 4 configuration entries:\n\n   * `name` - Name of the Python package[^1].\n   * `directory` - The directory of the package to analyze.\n   * `fail_below` - An integer value in range 0..100, for when a documentation coverage is considered FAILED.\n   * `levels` - A dictionary of coverage limits, their description and CSS style classes.\n\n   ```Python\n   # ==============================================================================\n   # Sphinx-reports - DocCov\n   # ==============================================================================\n   report_doccov_packages = {\n     \"src\": {\n       \"name\":       \"myPackage\",\n       \"directory\":  \"../myPackage\",\n       \"fail_below\": 80,\n       \"levels\": {\n         30:      {\"class\": \"report-cov-below30\",  \"desc\": \"almost undocumented\"},\n         50:      {\"class\": \"report-cov-below50\",  \"desc\": \"poorly documented\"},\n         80:      {\"class\": \"report-cov-below80\",  \"desc\": \"roughly documented\"},\n         90:      {\"class\": \"report-cov-below90\",  \"desc\": \"well documented\"},\n         100:     {\"class\": \"report-cov-below100\", \"desc\": \"excellent documented\"},\n         \"error\": {\"class\": \"report-cov-error\",    \"desc\": \"internal error\"},\n       },\n     }\n   }\n   ```\n2. Add the `doc-coverage` directive into your Restructured Text (ReST) document.\n   \n   * `packageid` - The ID used in `conf.py` to describe a Python package.\n   * `legend` (optional) - Position of the legend (`no_legend`, `top`, `bottom`, `both`)\n\n   ```Python\n   .. report:doc-coverage::\n      :packageid: src\n   ```\n\n## Code Coverage\n\n*Code Coverage* checks if a source code was used during execution. Usually, testcases are run by a testcase execution\nframework like [pytest](https://github.com/pytest-dev/pytest), which also offers to instrument the code for code\ncoverage collection using the `pytest-cov` plugin. For Python, coverage collection is usually based on\n[Coverage.py](https://github.com/nedbat/coveragepy>), which supports statement and branch coverage collection.\n\n### Quick Configuration\n\nThis is a quick and minimal configuration for the *code coverage* directives.\nSee [code coverage](https://pyTooling.github.io/sphinx-reports/CodeCov/index.html) documentation for more\ndetails.\n\n1. Configure one or more coverage analysis reports in `conf.py` by adding a new 'section' defining some configuration\n   variables. Each analysis report is identified by an ID, which is later referred to by the report directive. Here, the\n   ID is called ``src`` (dictionary key). Each analysis report needs 4 configuration entries:\n\n   * `name` - Name of the Python package[^1].\n   * `json_report` - The code coverage report as JSON file as generated by *Coverage.py*.\n   * `fail_below` - An integer value in range 0..100, for when a code coverage is considered FAILED.\n   * `levels` - A dictionary of coverage limits, their description and CSS style classes.\n\n   ```Python\n   # ==============================================================================\n   # Sphinx-reports - CodeCov\n   # ==============================================================================\n   report_codecov_packages = {\n     \"src\": {\n       \"name\":        \"myPackage\",\n       \"json_report\": \"../report/coverage/coverage.json\",\n       \"fail_below\":  80,\n       \"levels\": {\n         30:      {\"class\": \"report-cov-below30\",  \"desc\": \"almost unused\"},\n         50:      {\"class\": \"report-cov-below50\",  \"desc\": \"poorly used\"},\n         80:      {\"class\": \"report-cov-below80\",  \"desc\": \"medium used\"},\n         90:      {\"class\": \"report-cov-below90\",  \"desc\": \"well well\"},\n         100:     {\"class\": \"report-cov-below100\", \"desc\": \"excellent used\"},\n         \"error\": {\"class\": \"report-cov-error\",    \"desc\": \"internal error\"},\n       },\n     }\n   }\n   ```\n2. Add the `code-coverage` directive into your Restructured Text (ReST) document.\n   \n   * `packageid` - The ID used in `conf.py` to describe a Python package.\n   * `legend` (optional) - Position of the legend (`no_legend`, `top`, `bottom`, `both`)\n\n   ```Python\n   .. report:code-coverage::\n      :packageid: src\n   ```\n\n## Unit Test Summary\n\n```\nUnitTest: write introduction\n```\n\n\n## Dependencies\n\n```\nDep: write introduction\n```\n\n\n## Contributors\n\n* [Patrick Lehmann](https://github.com/Paebbels) (Maintainer)\n* [and more...](https://GitHub.com/pyTooling/sphinx-reports/graphs/contributors)\n\n\n## License\n\nThis Python package (source code) is licensed under [Apache License 2.0](LICENSE.md).  \nThe accompanying documentation is licensed under Creative Commons - Attribution-4.0 (CC-BY 4.0).\n\n\n-------------------------\n\nSPDX-License-Identifier: Apache-2.0\n\n\n[^1]: Toplevel Python packages can reside in a directory not matching the package name. This is possible because the\n      toplevel package name is set in the package installation description. This is not good practice, but possible and\n      unfortunately widely used. E.g. `src` as directory name.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Sphinx extension providing reports and summaries embedded in documentation pages.",
    "version": "0.6.0",
    "project_urls": {
        "Documentation": "https://pyTooling.GitHub.io/sphinx_reports",
        "Homepage": "https://GitHub.com/pyTooling/sphinx_reports",
        "Issue Tracker": "https://GitHub.com/pyTooling/sphinx_reports/issues",
        "Source Code": "https://GitHub.com/pyTooling/sphinx_reports"
    },
    "split_keywords": [
        "python3",
        "sphinx",
        "extension",
        "report",
        "doc-string",
        "interrogate"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3053e76e8b25b9387efb34dd9acf2de469ceea118f4ee0481735b5c9ca22d1f5",
                "md5": "4ab2b955114e889f6f42cbfbad4506f8",
                "sha256": "2e3d1b2bda73b7822a6635d33e1ec178284360fcc5975914ba0ee58396d00bf2"
            },
            "downloads": -1,
            "filename": "sphinx_reports-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4ab2b955114e889f6f42cbfbad4506f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 39947,
            "upload_time": "2024-01-22T22:55:03",
            "upload_time_iso_8601": "2024-01-22T22:55:03.758194Z",
            "url": "https://files.pythonhosted.org/packages/30/53/e76e8b25b9387efb34dd9acf2de469ceea118f4ee0481735b5c9ca22d1f5/sphinx_reports-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7e0ac612b21e2ac2d627cb112c840fbacc212d5633ad5cca3647f14bb7db5f0",
                "md5": "b696dc0b8ee16dd50e98a953a7ad9d7f",
                "sha256": "5907da648670a9c512da082de028929d80e32631ace7e5dd882ed24e1a050530"
            },
            "downloads": -1,
            "filename": "sphinx_reports-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b696dc0b8ee16dd50e98a953a7ad9d7f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 29272,
            "upload_time": "2024-01-22T22:55:00",
            "upload_time_iso_8601": "2024-01-22T22:55:00.904509Z",
            "url": "https://files.pythonhosted.org/packages/b7/e0/ac612b21e2ac2d627cb112c840fbacc212d5633ad5cca3647f14bb7db5f0/sphinx_reports-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-22 22:55:00",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sphinx-reports"
}
        
Elapsed time: 0.18132s