From d477a21e56b216c937bcd1363b43d8981ac7a7ac Mon Sep 17 00:00:00 2001 From: Daria Fokina Date: Fri, 2 Feb 2024 08:38:01 +0100 Subject: [PATCH] astra: generate api docs (#327) --- .github/workflows/astra.yml | 4 ++++ integrations/astra/pydoc/config.yml | 30 +++++++++++++++++++++++++++++ integrations/astra/pyproject.toml | 5 ++++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 integrations/astra/pydoc/config.yml diff --git a/.github/workflows/astra.yml b/.github/workflows/astra.yml index b751550de..a1aab7154 100644 --- a/.github/workflows/astra.yml +++ b/.github/workflows/astra.yml @@ -53,6 +53,10 @@ jobs: if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run lint:all + - name: Generate docs + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run docs + - name: Run tests env: ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} diff --git a/integrations/astra/pydoc/config.yml b/integrations/astra/pydoc/config.yml new file mode 100644 index 000000000..68cc1c809 --- /dev/null +++ b/integrations/astra/pydoc/config.yml @@ -0,0 +1,30 @@ +loaders: + - type: haystack_pydoc_tools.loaders.CustomPythonLoader + search_path: [../src] + modules: [ + "haystack_integrations.components.retrievers.astra.retriever", + "haystack_integrations.document_stores.astra.document_store", + "haystack_integrations.document_stores.astra.errors", + ] + ignore_when_discovered: ["__init__"] +processors: + - type: filter + expression: + documented_only: true + do_not_filter_modules: false + skip_empty_modules: true + - type: smart + - type: crossref +renderer: + type: haystack_pydoc_tools.renderers.ReadmePreviewRenderer + excerpt: Astra integration for Haystack + category_slug: haystack-integrations + title: Astra + slug: integrations-astra + order: 20 + markdown: + descriptive_class_title: false + descriptive_module_title: true + add_method_class_prefix: true + add_member_class_prefix: false + filename: _readme_astra.md \ No newline at end of file diff --git a/integrations/astra/pyproject.toml b/integrations/astra/pyproject.toml index 6b4e2565d..7599797a8 100644 --- a/integrations/astra/pyproject.toml +++ b/integrations/astra/pyproject.toml @@ -50,6 +50,7 @@ git_describe_command = 'git describe --tags --match="integrations/astra-v[0-9]*" dependencies = [ "coverage[toml]>=6.5", "pytest", + "haystack-pydoc-tools", ] [tool.hatch.envs.default.scripts] test = "pytest {args:tests}" @@ -62,7 +63,9 @@ cov = [ "test-cov", "cov-report", ] - +docs = [ + "pydoc-markdown pydoc/config.yml" +] [[tool.hatch.envs.all.matrix]] python = ["3.7", "3.8", "3.9", "3.10", "3.11"]