Skip to main content

Add processing of sphinx-like docstring specs to pdoc via preprocessor.

Project description

pdoc_prep: Add sphinx-like function doc specs to pdoc

Prepares Python files that use sphinx-like parameter and return specifications for input to the pdoc documentation tool (https://pypi.org/project/pdoc/).

Motivation:

The pdoc HTML output does not recognize function/method parameter and return specifications in doc strings as special. So,

   :param foo: controls whether bar is set to None
   :type foo: int
   :return True for success, else False
   :rtype bool

will show up literally. If a module to be documentated is instead preprocessed using this script, then the pdoc documentation will look like this:

          foo (int): controls whether bar is set to None
          returns True for success, else False
          return type: bool

The keywords, such as returns, and parameters, such as foo (int) will be bold faced.

Note: whether ':' is used to introduce a specification, or '@' is controlled from a command line option. See main section below.

Usage

shell> pdoc_run.py --html-dir docs src/pdoc_prep/pdoc_prep.py

This command may be run from the project root, from within the evolving docs directory, or in the package directory. Obviously, the paths need to be adjusted accordingly.

Notes

Note 1: You may see:

DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp

This warning occurs in pdoc, which is not modified by this preprocessor. To suppress the warning, you can define an environment variable:

export PYTHONWARNINGS=ignore

in the shell where you are working.

Note2: It would be more sensible to include this functionality in the pdoc HTML production code itself. Alas, not enough time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdoc_prep-0.0.4.tar.gz (60.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdoc_prep-0.0.4-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file pdoc_prep-0.0.4.tar.gz.

File metadata

  • Download URL: pdoc_prep-0.0.4.tar.gz
  • Upload date:
  • Size: 60.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for pdoc_prep-0.0.4.tar.gz
Algorithm Hash digest
SHA256 27318826a66e6bbd0cec44917c9222e365586a2274cb9005dafd374f58936ae3
MD5 40a327ae046ce151b864eb22152b0216
BLAKE2b-256 628251579f0ca8908ef9d5c22dba35087d1fd3bc7874d318768c095473a7b33b

See more details on using hashes here.

File details

Details for the file pdoc_prep-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pdoc_prep-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for pdoc_prep-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fb3f01a174e5bf254f46f127487b7be1aca77aa54e6c488e0d1f41904c80713f
MD5 a3143fd4f2d5133c2d31c2cc0dc881e2
BLAKE2b-256 ee04462f34d89f03f12641f76d718fa7ad15af38f36fcc20776ca4ec15c40c3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page