Pydoc custom tools for Haystack docs
Project description
haystack-pydoc-tools
Tool to generate Docusaurus-compatible Markdown API references from Python docstrings. It uses griffe to parse source code and griffe2md to render the output.
Installation
pip install haystack-pydoc-tools
Usage
The tool reads YAML configuration files and generates Markdown API docs.
Process a single config file:
haystack-pydoc config.yml [output-directory]
Process a directory of config files (in parallel):
haystack-pydoc pydoc/ output/
A pydoc-markdown alias is also available for backward compatibility.
Output behavior
Each config must specify a filename.
By default, the file is written in the current working directory; if an output directory
is provided, the file is written there instead.
Configuration
Each .yml file describes which modules to document and how to render the output.
Minimal example
loaders:
- search_path: [src]
modules:
- haystack.components.generators.chat.openai
- haystack.components.generators.chat.azure
renderer:
title: Generators
id: generators-api
description: Enables text generation using LLMs.
filename: generators_api.md
Full example
loaders:
- search_path: [../src]
modules:
- haystack.components.generators.chat.openai
- haystack.components.generators.chat.azure
processors:
- type: filter
documented_only: false # include objects without docstrings
skip_empty_modules: false # keep modules even if they have no content
renderer:
title: Generators API
id: generators-api
description: Enables text generation using LLMs.
filename: generators_api.md
When the processors section is omitted, defaults apply: documented_only: true, skip_empty_modules: true.
Legacy example
The tool also accepts the older pydoc-markdown-style configs. Most fields are ignored but don't cause errors.
loaders:
- type: haystack_pydoc_tools.loaders.CustomPythonLoader # ignored
search_path: [../src]
modules:
- haystack.components.generators.chat.openai
- haystack.components.generators.chat.azure
ignore_when_discovered: ["__init__"] # ignored
processors:
- type: filter
expression: # ignored
documented_only: true
do_not_filter_modules: false # ignored
skip_empty_modules: true
- type: smart # ignored
- type: crossref # ignored
renderer:
type: haystack_pydoc_tools.renderers.DocusaurusRenderer # ignored
title: Generators API
id: generators-api
description: Enables text generation using LLMs.
markdown:
descriptive_class_title: false # ignored
classdef_code_block: false # ignored
descriptive_module_title: true # ignored
add_method_class_prefix: true # ignored
add_member_class_prefix: false # ignored
filename: generators_api.md
License
haystack-pydoc-tools is distributed under the terms of the Apache-2.0 license.
Release process
To release version x.y.z:
- Manually update the version in
src/haystack_pydoc_tools/__about__.py(via a PR or a direct push tomain). - From the
mainbranch, create a tag locally:git tag vx.y.z. - Push the tag:
git push --tags. - Wait for the CI to release the package on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file haystack_pydoc_tools-0.7.0.tar.gz.
File metadata
- Download URL: haystack_pydoc_tools-0.7.0.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.12.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef23eef95baae3fcbd73ad6e8cf3c0ae757c301437a3a540fde4aa322d9f4e6f
|
|
| MD5 |
9cad261472c1bfbb2601d09a72e75841
|
|
| BLAKE2b-256 |
cf2d1173be4a621a4c1e1bfd87079ec37c29ab25953b7c0e359f682f19c2c45b
|
File details
Details for the file haystack_pydoc_tools-0.7.0-py3-none-any.whl.
File metadata
- Download URL: haystack_pydoc_tools-0.7.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.12.3 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96bcc6c304f6657829c54de1def7904764c9afd04b6e3261ff0d8f3b7f09a301
|
|
| MD5 |
65249e4161f8399d71944ac20ad41073
|
|
| BLAKE2b-256 |
9fdb12d03aff7ad47286d20c414738fd029829b06e53024f9e9c05356af00ee5
|