From d92c996e383a91da8b258a6c30d46097fcf10b7a Mon Sep 17 00:00:00 2001 From: ZanSara Date: Wed, 31 Jan 2024 17:32:34 +0100 Subject: [PATCH] add api docs --- .github/workflows/elasticsearch.yml | 4 +++ integrations/elasticsearch/pydoc/config.yml | 31 +++++++++++++++++++++ integrations/elasticsearch/pyproject.toml | 4 +++ 3 files changed, 39 insertions(+) create mode 100644 integrations/elasticsearch/pydoc/config.yml diff --git a/.github/workflows/elasticsearch.yml b/.github/workflows/elasticsearch.yml index eb2c1748d..486c418c8 100644 --- a/.github/workflows/elasticsearch.yml +++ b/.github/workflows/elasticsearch.yml @@ -47,6 +47,10 @@ jobs: - name: Run ElasticSearch container working-directory: integrations/elasticsearch run: docker-compose up -d + + - name: Generate docs + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run docs - name: Run tests working-directory: integrations/elasticsearch diff --git a/integrations/elasticsearch/pydoc/config.yml b/integrations/elasticsearch/pydoc/config.yml new file mode 100644 index 000000000..aac626908 --- /dev/null +++ b/integrations/elasticsearch/pydoc/config.yml @@ -0,0 +1,31 @@ +loaders: + - type: haystack_pydoc_tools.loaders.CustomPythonLoader + search_path: [../src] + modules: [ + "haystack_integrations.components.retrievers.elasticsearch.bm25_retriever", + "haystack_integrations.components.retrievers.elasticsearch.embedding_retriever", + "haystack_integrations.document_store.elasticsearch.document_store", + "haystack_integrations.document_store.elasticsearch.filters", + ] + 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: Elasticsearch integration for Haystack + category_slug: haystack-integrations + title: Elasticsearch + slug: integrations-elasticsearch + order: 50 + markdown: + descriptive_class_title: false + descriptive_module_title: true + add_method_class_prefix: true + add_member_class_prefix: false + filename: _readme_elasticsearch.md \ No newline at end of file diff --git a/integrations/elasticsearch/pyproject.toml b/integrations/elasticsearch/pyproject.toml index af3d89c0c..b67df7e03 100644 --- a/integrations/elasticsearch/pyproject.toml +++ b/integrations/elasticsearch/pyproject.toml @@ -49,6 +49,7 @@ dependencies = [ "coverage[toml]>=6.5", "pytest", "pytest-xdist", + "haystack-pydoc-tools", ] [tool.hatch.envs.default.scripts] test = "pytest {args:tests}" @@ -61,6 +62,9 @@ cov = [ "test-cov", "cov-report", ] +docs = [ + "pydoc-markdown pydoc/config.yml" +] [[tool.hatch.envs.all.matrix]] python = ["3.8", "3.9", "3.10", "3.11"]