Skip to content

Commit c33b8f3

Browse files
authored
docs: simplify API reference config and remove script (#441)
1 parent 0c94a14 commit c33b8f3

14 files changed

Lines changed: 86 additions & 244 deletions

.github/utils/pydoc-markdown.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/CI_check_api_ref.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
node-version: "22"
3030

3131
- name: Run Docusaurus md/mdx checker
32-
working-directory: pydoc/temp
32+
working-directory: tmp_api_reference
3333
run: |
3434
npx docusaurus-mdx-checker -v || {
3535
echo ""

.github/workflows/docusaurus_sync.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: actions/upload-artifact@v6
3838
with:
3939
name: experimental-api-reference
40-
path: pydoc/temp
40+
path: tmp_api_reference
4141
if-no-files-found: error
4242
retention-days: 1
4343
overwrite: true
@@ -64,15 +64,15 @@ jobs:
6464
uses: actions/download-artifact@v7
6565
with:
6666
name: experimental-api-reference
67-
path: temp_api_reference
67+
path: tmp_api_reference
6868

6969
- name: Sync API reference
7070
run: |
7171
# Function to sync generated API reference to a destination
7272
sync_to_dest() {
7373
echo "Syncing to $1"
7474
mkdir -p "$1"
75-
rsync -av --delete --exclude='.git/' "temp_api_reference/" "$1/"
75+
rsync -av --delete --exclude='.git/' "tmp_api_reference/" "$1/"
7676
}
7777
7878
# Sync to main reference

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ instance/
7474
# Scrapy stuff:
7575
.scrapy
7676

77-
# documentation
77+
# API reference
7878
pydoc/temp/
79+
tmp_api_reference/
7980

8081
# PyBuilder
8182
target/

pydoc/README.md

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,12 @@ You can find Haystack's documentation at https://docs.haystack.deepset.ai/.
44

55
# API Reference
66

7-
We use Pydoc-Markdown to create Markdown files from the docstrings in our code. There is a Github Action that regenerates the API pages when tags are pushed or when manually triggered.
7+
We use [haystack-pydoc-tools](https://github.com/deepset-ai/haystack-pydoc-tools) to create Markdown files from the docstrings in our code. There is a [Github workflow](https://github.com/deepset-ai/haystack-experimental/blob/main/.github/workflows/docusaurus_sync.yml) that regenerates the API reference at release time.
88

9-
If you want to generate a new Markdown file for a new Haystack module, create a `.yml` file in `pydoc` which configures how Pydoc-Markdown will generate the page and commit it to main.
9+
If you want to generate a new Markdown file for a new Haystack module, create a `.yml` file in `pydoc` which configures how haystack-pydoc-tools will generate the page and commit it to main.
1010

11-
All the updates to docstrings get pushed to documentation when a new version is released.
11+
All the updates to API reference get pushed to documentation when a new version is released.
1212

1313
### Configuration
1414

15-
Pydoc will read the configuration from a `.yml` file which is located under `pydoc`. Our files contain three main sections:
16-
17-
- **loaders**: A list of plugins that load API objects from python source files.
18-
- **type**: Loader for python source files (we use `haystack_pydoc_tools.loaders.CustomPythonLoader`)
19-
- **search_path**: Location of source files (relative to the config file)
20-
- **modules**: Modules which are used for generating the markdown file
21-
- **ignore_when_discovered**: Define which files should be ignored
22-
- **processors**: A list of plugins that process API objects to modify their docstrings (e.g. to adapt them from a documentation format to Markdown or to remove items that should not be rendered into the documentation).
23-
- **type: filter**: Filter for specific modules
24-
- **documented_only**: Only documented API objects
25-
- **do_not_filter_modules**: Do not filter module objects
26-
- **skip_empty_modules**: Skip modules without content
27-
- **type: smart**: Smart processor for docstring processing
28-
- **type: crossref**: Cross-reference processor
29-
- **renderer**: A plugin that produces the output files. We use a custom DocusaurusRenderer based on the Markdown renderer. It makes sure the Markdown files comply with Docusaurus requirements.
30-
- **type**: Define the renderer which you want to use. We are using the DocusaurusRenderer to make sure the files display properly in Docusaurus.
31-
- **description**: Add a short description of the page. It shows up right below the page title.
32-
- **id**: This is the Docusaurus page ID to make sure the doc lands in the right section of Haystack docs.
33-
- **title**: The title of the doc as it will appear on the website. Make sure you always add "API" at the end.
34-
- **markdown**:
35-
- **descriptive_class_title**: Remove the word "Object" from class titles.
36-
- **descriptive_module_title**: Adding the word "Module" before the module name.
37-
- **add_method_class_prefix**: Add the class name as a prefix to method names.
38-
- **add_member_class_prefix**: Add the class name as a prefix to member names.
39-
- **filename**: File name of the generated file, use underscores to separate each word.
15+
For configuration details, see the [haystack-pydoc-tools documentation](https://github.com/deepset-ai/haystack-pydoc-tools/blob/main/README.md#configuration) or inspect the existing `.yml` files in `pydoc`.

pydoc/agents_api.yml

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
11
loaders:
2-
- ignore_when_discovered:
3-
- __init__
4-
modules:
5-
- haystack_experimental.components.agents.agent
6-
- haystack_experimental.components.agents.human_in_the_loop.breakpoint
7-
- haystack_experimental.components.agents.human_in_the_loop.errors
8-
- haystack_experimental.components.agents.human_in_the_loop.strategies
9-
search_path:
10-
- ../
11-
type: haystack_pydoc_tools.loaders.CustomPythonLoader
2+
- search_path: [../]
3+
modules:
4+
- haystack_experimental.components.agents.agent
5+
- haystack_experimental.components.agents.human_in_the_loop.breakpoint
6+
- haystack_experimental.components.agents.human_in_the_loop.errors
7+
- haystack_experimental.components.agents.human_in_the_loop.strategies
128
processors:
13-
- do_not_filter_modules: false
14-
documented_only: true
15-
expression: null
16-
skip_empty_modules: true
17-
type: filter
18-
- type: smart
19-
- type: crossref
9+
- type: filter
10+
documented_only: true
11+
skip_empty_modules: true
2012
renderer:
21-
description: Tool-using agents with provider-agnostic chat model support.
22-
id: experimental-agents-api
23-
markdown:
24-
add_member_class_prefix: false
25-
add_method_class_prefix: true
26-
classdef_code_block: false
27-
descriptive_class_title: false
28-
descriptive_module_title: true
29-
filename: experimental_agents_api.md
3013
title: Agents
31-
type: haystack_pydoc_tools.renderers.DocusaurusRenderer
14+
id: experimental-agents-api
15+
description: Tool-using agents with provider-agnostic chat model support.
16+
filename: experimental_agents_api.md

pydoc/chat_message_stores_api.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
loaders:
2-
- ignore_when_discovered:
3-
- __init__
4-
modules:
5-
- haystack_experimental.chat_message_stores.in_memory
6-
search_path:
7-
- ../
8-
type: haystack_pydoc_tools.loaders.CustomPythonLoader
2+
- search_path: [../]
3+
modules:
4+
- haystack_experimental.chat_message_stores.in_memory
95
processors:
10-
- do_not_filter_modules: false
11-
documented_only: true
12-
expression: null
13-
skip_empty_modules: true
14-
type: filter
15-
- type: smart
16-
- type: crossref
6+
- type: filter
7+
documented_only: true
8+
skip_empty_modules: true
179
renderer:
18-
description: Storage for the chat messages.
19-
id: experimental-chatmessage-store-api
20-
markdown:
21-
add_member_class_prefix: false
22-
add_method_class_prefix: true
23-
classdef_code_block: false
24-
descriptive_class_title: false
25-
descriptive_module_title: true
26-
filename: experimental_chatmessage_store_api.md
2710
title: ChatMessage Store
28-
type: haystack_pydoc_tools.renderers.DocusaurusRenderer
11+
id: experimental-chatmessage-store-api
12+
description: Storage for the chat messages.
13+
filename: experimental_chatmessage_store_api.md

pydoc/generators_api.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
loaders:
2-
- ignore_when_discovered:
3-
- __init__
4-
modules:
5-
- haystack_experimental.components.generators.chat.openai
6-
search_path:
7-
- ../
8-
type: haystack_pydoc_tools.loaders.CustomPythonLoader
2+
- search_path: [../]
3+
modules:
4+
- haystack_experimental.components.generators.chat.openai
95
processors:
10-
- do_not_filter_modules: false
11-
documented_only: true
12-
expression: null
13-
skip_empty_modules: true
14-
type: filter
15-
- type: smart
16-
- type: crossref
6+
- type: filter
7+
documented_only: true
8+
skip_empty_modules: true
179
renderer:
18-
description: Enables text generation using LLMs.
19-
id: experimental-generators-api
20-
markdown:
21-
add_member_class_prefix: false
22-
add_method_class_prefix: true
23-
classdef_code_block: false
24-
descriptive_class_title: false
25-
descriptive_module_title: true
26-
filename: experimental_generators_api.md
2710
title: Generators
28-
type: haystack_pydoc_tools.renderers.DocusaurusRenderer
11+
id: experimental-generators-api
12+
description: Enables text generation using LLMs.
13+
filename: experimental_generators_api.md

pydoc/memory_store_api.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
loaders:
2-
- ignore_when_discovered:
3-
- __init__
4-
modules:
5-
- haystack_experimental.memory_stores.mem0.memory_store
6-
search_path:
7-
- ../
8-
type: haystack_pydoc_tools.loaders.CustomPythonLoader
2+
- search_path: [../]
3+
modules:
4+
- haystack_experimental.memory_stores.mem0.memory_store
95
processors:
10-
- do_not_filter_modules: false
11-
documented_only: true
12-
expression: null
13-
skip_empty_modules: true
14-
type: filter
15-
- type: smart
16-
- type: crossref
6+
- type: filter
7+
documented_only: true
8+
skip_empty_modules: true
179
renderer:
18-
description: Storage for the memories using Mem0 as the backend.
19-
id: experimental-mem0-memory-store-api
20-
markdown:
21-
add_member_class_prefix: false
22-
add_method_class_prefix: true
23-
classdef_code_block: false
24-
descriptive_class_title: false
25-
descriptive_module_title: true
26-
filename: experimental_mem0_memory_store_api.md
2710
title: Mem0 Memory Store
28-
type: haystack_pydoc_tools.renderers.DocusaurusRenderer
11+
id: experimental-mem0-memory-store-api
12+
description: Storage for the memories using Mem0 as the backend.
13+
filename: experimental_mem0_memory_store_api.md

pydoc/preprocessors_api.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
loaders:
2-
- ignore_when_discovered:
3-
- __init__
4-
modules:
5-
- haystack_experimental.components.preprocessors.md_header_level_inferrer
6-
search_path:
7-
- ../
8-
type: haystack_pydoc_tools.loaders.CustomPythonLoader
2+
- search_path: [../]
3+
modules:
4+
- haystack_experimental.components.preprocessors.md_header_level_inferrer
95
processors:
10-
- do_not_filter_modules: false
11-
documented_only: true
12-
expression: null
13-
skip_empty_modules: true
14-
type: filter
15-
- type: smart
16-
- type: crossref
6+
- type: filter
7+
documented_only: true
8+
skip_empty_modules: true
179
renderer:
18-
description: Pipelines wrapped as components.
19-
id: experimental-preprocessors-api
20-
markdown:
21-
add_member_class_prefix: false
22-
add_method_class_prefix: true
23-
classdef_code_block: false
24-
descriptive_class_title: false
25-
descriptive_module_title: true
26-
filename: experimental_preprocessors_api.md
2710
title: Preprocessors
28-
type: haystack_pydoc_tools.renderers.DocusaurusRenderer
11+
id: experimental-preprocessors-api
12+
description: Pipelines wrapped as components.
13+
filename: experimental_preprocessors_api.md

0 commit comments

Comments
 (0)