Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
sphinx-autopackagesummary
Advanced tools
Sphinx extension to automatically generate autosummary tables for Python packages
This is a Sphinx extension that makes it possible to automatically generate API documentation for deeply nested Python packages using the built-in autosummary extension.
The problem with the built-in autosummary directive is that it does not automatically pick up nested sub-modules, requiring tedious manual work to specify the entire module tree.
Instead of this:
.. autosummary::
:toctree: _autosummary
mypackage.submodule1
mypackage.submodule2
mypackage.submodule3
You can now simply use this:
.. autopackagesummary:: mypackage
:toctree: _autosummary
To make use of this extension, the following steps are needed:
pip install sphinx-autopackagesummary
conf.py
.extensions = ['sphinx.ext.autosummary', 'sphinx_autopackagesummary']
autosummary_generate = True
The autopackagesummary
directive accepts all options that are supported by
autosummary
, which are simply passed on.
To exclude packages from being imported, add them to the config setting
autosummary_mock_imports
.
If your packages have subpackages, it is possible to use this recursively by customizing the autosummary template. For example, you could have your root package documented like so:
.. py:package:: mypackage
This is my package.
.. autopackagesummary:: mypackage
:toctree: _autosummary
:template: autosummary/package.rst
And then create a _templates/autosummary/package.rst
like so:
{{ fullname | escape | underline }}
.. automodule:: {{ fullname }}
.. autopackagesummary:: {{ fullname }}
:toctree: .
:template: autosummary/package.rst
Alternatively, you can override the default module.rst
template.
Note the use of .
for the toctree setting: otherwise, the _autosummary
directories would keep nesting, like _autosummary/_autosummary/module.rst
.
This extension has been placed into the public domain. If you make a contribution to this repository, you are placing your modifications into the public domain as well.
FAQs
Sphinx extension to automatically generate autosummary tables for Python packages
We found that sphinx-autopackagesummary demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.