Skip to main content

Some custom tweaks to the results produced by pytkdocs (part of mkdocstrings).

Project description

pytkdocs_tweaks

Some custom tweaks for pytkdocs.

For use as part of the documentation-generation-for-Python stack that comprises mkdocs, mkdocs-material, mkdocstrings and pytkdocs.

  • Types are ubiquitously displayed in the way you import them: package.Foo (rather than being a mix of where they're defined: package.subpackage.foomodule.Foo or just their name: Foo).
  • Only public base classes are shown (rather than every base class).
  • Adds short documentation for inherited and implemented methods, e.g. "Inherited from package.Foo." (Rather than nothing at all.)
    • An inherited method is one inherited from a base class. An implemented method is one overriding an abstract method on a base class.
  • Sets a custom typing.GENERATING_DOCUMENTATION = True flag that you can use to detect when documentation generation is happening and customise things if desired (documentation generation imports the library you're documenting).
  • Adds an abstractmethod/abstractproperty property to appear in the documentation instead. (Useful when specifying abstract base classes.)
  • Removed the dataclass and special properties that appear in the documentation. (I find that these just add visual noise.)
  • Removed the -> None return annotation on __init__ methods.
  • Function-valued defaults now display as just <function foo> rather than <function foo at 0x7f5428d27a60>.

Note that you must run the mkdocs command twice, as these custom tweaks write a cache to disk -- listing all the public objects -- that are then used on the second run. If you see a .all_objects.cache file appear -- this is why. (You may wish to add the file to your .gitignore.)

Installation

pip install pytkdocs_tweaks

Requires Python 3.8+ and pytkdocs>=0.15.0.

Usage

In your mkdocs.yml:

plugins:
    - search  # default plugin, need to re-enable when using manual plugins
    - mkdocstrings:
        handlers:
            python:
                setup_commands:
                    - import pytkdocs_tweaks
                    - pytkdocs_tweaks.main()
                selection:
                    inherited_members: true  # allow looking up inherited members
                rendering:
                    show_root_heading: true    #
                    show_root_full_path: true  # have e.g. `package.Foo` display correctly, rather than e.g. just `Foo`.

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

pytkdocs_tweaks-0.0.5.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

pytkdocs_tweaks-0.0.5-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pytkdocs_tweaks-0.0.5.tar.gz.

File metadata

  • Download URL: pytkdocs_tweaks-0.0.5.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for pytkdocs_tweaks-0.0.5.tar.gz
Algorithm Hash digest
SHA256 303d5da264cbc01b09fcfe14884cb1a1e520757ab84772621a78cba434986a72
MD5 f9417f493840ca284f346563fbb32160
BLAKE2b-256 4872484dec01a73c041dfbabac9ad04b21f8c6db772e22a0dfc5becf215eab35

See more details on using hashes here.

File details

Details for the file pytkdocs_tweaks-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pytkdocs_tweaks-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for pytkdocs_tweaks-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 125a7933f0d5981dba6667e529516140bf3b5b3cf5f84eb75e24bb4def520a51
MD5 bfc5ac93b1a9b2bd672e477a4d071a14
BLAKE2b-256 882f28a0929732c446915fd6b5974bf18edc90127517f8e60d81238f85abb244

See more details on using hashes here.

Supported by

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