gleandoc
Convenience functions to extract docstring and write README
Intent: store one copy of top-level docstring in <package>/__init__.py
Allows generation of top level gitub README based on the package docstring
Features
Determine package name from current directory
Extract docstring using Python semantics and standards
No dependencies outside standard library
Uses abstract syntax tree parsing for relative __init__.py files
Examples
Print the first line of a docstring:
>>> import gleandoc
>>> docstring = gleandoc.docstring('re')
>>> docstring.splitlines()[0]
'Support for regular expressions (RE).'
>>>
Do the same thing from the command line:
$ gleandoc re | head -1
Support for regular expressions (RE).
$
Interpolate template README.rst.fstr and write results to README.rst, replacing {__doc__} with extracted docstring based on the name of the current directory:
$ gleandoc README.rst.fstr README.rst
gleandoc: WARNING: replacing README.rst
gleandoc: INFO: wrote README.rst
$
The -h option at the command line will show supported options:
$ gleandoc -h
Usage: gleandoc [-h] [NAME]
Extract docstring from module [NAME]
-h, --help show this help message and exit
- If unspecified, NAME defaults to the basename of the current directory
- This is designed for use in build systems to construct README files
Alternative two argument usage: gleandoc TEMPLATE README
Interpolate docstring into TEMPLATE and write results to README
- In this mode, always derives NAME from basename of current directory
- Template uses style similar to f-string
- Supported variables which will be interpolated include: {__doc__}
- For literal (single) braces, use double braces: {{ or }}
Limitations
Embedded backslash-n newlines are treated as actual newlines
Relies on various pseudo-internals: locals(), exec()
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Metadata
Release files for gleandoc 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gleandoc-0.3.0.tar.gz | 12.9 kB | Without provenance | Details for gleandoc-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gleandoc-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for gleandoc-0.3.0-py3-none-any.whl |
Total release size: 18.9 kB
Release files / gleandoc-0.3.0.tar.gz
| Download URL | gleandoc-0.3.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23ed1a4444ea2f46c55d6d9dd9d7f3eb9fd34b27c02d59113abc858d65c00b85
|
|
BLAKE2b-256 checksum How to use checksums |
ada442ceac07adcd6f12b561f0391fc9bcbae8d76c3b7eebdfc052745b064e3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / gleandoc-0.3.0-py3-none-any.whl
| Download URL | gleandoc-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e992838a1113b00c144937c078f8085a65b4d62a9fcd6ea4a2ce5d535e36465e
|
|
BLAKE2b-256 checksum How to use checksums |
8f77108f1f86f440fb1c3cd689fca3ebe067541852ed2e19a600dca1af6bd877
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Security for gleandoc 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.