From 016534a311cb2d4752e6dd6bc46d6f5a277c854c Mon Sep 17 00:00:00 2001 From: Sh1nku <42642351+Sh1nku@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:43:29 +0200 Subject: [PATCH] Remove python pdoc documentation --- .github/workflows/generate_docs.yml | 7 ----- .github/workflows/publish_docs.yml | 7 ----- README.md | 2 +- docs/src/index.md | 2 +- wrappers/python/README.md | 1 - wrappers/python/generate_documentation.py | 31 ---------------------- wrappers/python/solrstice/alias.pyi | 32 ++++++++++++++++------- wrappers/python/solrstice/collection.pyi | 32 ++++++++++++++++------- wrappers/python/solrstice/config.pyi | 31 +++++++++++++++------- wrappers/python/solrstice/models.pyi | 19 +++++++++++--- wrappers/python/src/queries/alias.rs | 2 +- wrappers/python/src/queries/collection.rs | 2 +- wrappers/python/src/queries/config.rs | 2 +- 13 files changed, 85 insertions(+), 85 deletions(-) delete mode 100755 wrappers/python/generate_documentation.py diff --git a/.github/workflows/generate_docs.yml b/.github/workflows/generate_docs.yml index 8783071..1b877ac 100644 --- a/.github/workflows/generate_docs.yml +++ b/.github/workflows/generate_docs.yml @@ -29,10 +29,3 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Build Python documentation - working-directory: ./wrappers/python - run: | - pip install -r requirements-dev.txt - ./generate_documentation.py - mkdir ../../docs/docs_built/python - mv docs/* ../../docs/docs_built/python diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index 6037925..75cf0ac 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -38,13 +38,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Build Python documentation - working-directory: ./wrappers/python - run: | - pip install -r requirements-dev.txt - ./generate_documentation.py - mkdir ../../docs/docs_built/python - mv docs/* ../../docs/docs_built/python - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: diff --git a/README.md b/README.md index 92db2ae..740d437 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Solrstice is a SolrCloud aware client library written in rust. It also provides a wrapper to python. Use the [Rust documentation](https://docs.rs/solrstice) or -the [Python documentation](https://sh1nku.github.io/solrstice/python) for more information. +the [Python documentation](https://pypi.org/project/solrstice/) for more information. ## Features diff --git a/docs/src/index.md b/docs/src/index.md index 5fa07cc..377dfcb 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -17,7 +17,7 @@ If the `blocking` feature is not provided, only async will work. ```bash pip install solrstice ``` -* [Python docs](https://sh1nku.github.io/solrstice/python) +* [Python docs](https://pypi.org/project/solrstice/) ## Getting started diff --git a/wrappers/python/README.md b/wrappers/python/README.md index 57e2daf..d767557 100644 --- a/wrappers/python/README.md +++ b/wrappers/python/README.md @@ -3,7 +3,6 @@ Solrstice is a solr client library written in rust. With this wrapper you can use it in python. Both asyncio and blocking clients are provided. All apis have type hints. -Documentation can be found at [sh1nku.github.io/solrstice/python](https://sh1nku.github.io/solrstice/python) ## Features diff --git a/wrappers/python/generate_documentation.py b/wrappers/python/generate_documentation.py deleted file mode 100755 index 677cb56..0000000 --- a/wrappers/python/generate_documentation.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import os -import shutil -import tempfile -from pathlib import Path - -import pdoc - -if __name__ == '__main__': - tmpdir = tempfile.TemporaryDirectory() - package_name = 'solrstice' - package_path = os.path.join(tmpdir.name, package_name) - current_directory = os.path.dirname(os.path.realpath(__file__)) - docs_directory = Path(os.path.join(Path(current_directory), 'docs')) - - os.mkdir(package_path) - for filename in os.listdir(package_name): - f = os.path.join(package_name, filename) - if os.path.isfile(f) and filename.endswith('.pyi'): - shutil.copyfile(f, os.path.join(package_path, filename[:-1])) - shutil.copyfile('README.md', os.path.join(tmpdir.name, 'README.md')) - with open(os.path.join(package_path, '__init__.py'), 'w') as f: - f.write(''' -""" -.. include:: ../README.md -""" - ''') - - pdoc.pdoc(os.path.join(tmpdir.name, package_name), output_directory=docs_directory) diff --git a/wrappers/python/solrstice/alias.pyi b/wrappers/python/solrstice/alias.pyi index 21f14e7..dd79e2c 100644 --- a/wrappers/python/solrstice/alias.pyi +++ b/wrappers/python/solrstice/alias.pyi @@ -1,9 +1,10 @@ -from typing import Dict, List +from typing import TYPE_CHECKING, Dict, List -from solrstice import SolrServerContext +if TYPE_CHECKING: + from solrstice import SolrServerContext async def create_alias( - context: SolrServerContext, name: str, collections: List[str] + context: "SolrServerContext", name: str, collections: List[str] ) -> None: """ Create an alias for a collection on the Solr server @@ -14,7 +15,7 @@ async def create_alias( """ def create_alias_blocking( - context: SolrServerContext, name: str, collections: List[str] + context: "SolrServerContext", name: str, collections: List[str] ) -> None: """ Create an alias for a collection on the Solr server @@ -24,7 +25,7 @@ def create_alias_blocking( :param collections: The collections to alias """ -async def get_aliases(context: SolrServerContext) -> Dict[str, List[str]]: +async def get_aliases(context: "SolrServerContext") -> Dict[str, List[str]]: """ Get all aliases on the Solr server @@ -32,7 +33,7 @@ async def get_aliases(context: SolrServerContext) -> Dict[str, List[str]]: :return: A dictionary of aliases to collections """ -def get_aliases_blocking(context: SolrServerContext) -> Dict[str, List[str]]: +def get_aliases_blocking(context: "SolrServerContext") -> Dict[str, List[str]]: """ Get all aliases on the Solr server @@ -40,7 +41,7 @@ def get_aliases_blocking(context: SolrServerContext) -> Dict[str, List[str]]: :return: A dictionary of aliases to collections """ -async def alias_exists(context: SolrServerContext, name: str) -> bool: +async def alias_exists(context: "SolrServerContext", name: str) -> bool: """ Check if an alias exists on the Solr server @@ -49,7 +50,7 @@ async def alias_exists(context: SolrServerContext, name: str) -> bool: :return: True if the alias exists, False otherwise """ -def alias_exists_blocking(context: SolrServerContext, name: str) -> bool: +def alias_exists_blocking(context: "SolrServerContext", name: str) -> bool: """ Check if an alias exists on the Solr server @@ -58,7 +59,7 @@ def alias_exists_blocking(context: SolrServerContext, name: str) -> bool: :return: True if the alias exists, False otherwise """ -async def delete_alias(context: SolrServerContext, name: str) -> None: +async def delete_alias(context: "SolrServerContext", name: str) -> None: """ Delete an alias from the Solr server @@ -66,10 +67,21 @@ async def delete_alias(context: SolrServerContext, name: str) -> None: :param name: The name of the alias to delete """ -def delete_alias_blocking(context: SolrServerContext, name: str) -> None: +def delete_alias_blocking(context: "SolrServerContext", name: str) -> None: """ Delete an alias from the Solr server :param context: The Solr server context :param name: The name of the alias to delete """ + +__all__ = [ + "create_alias", + "create_alias_blocking", + "get_aliases", + "get_aliases_blocking", + "alias_exists", + "alias_exists_blocking", + "delete_alias", + "delete_alias_blocking", +] diff --git a/wrappers/python/solrstice/collection.pyi b/wrappers/python/solrstice/collection.pyi index c4ebe27..d086dd4 100644 --- a/wrappers/python/solrstice/collection.pyi +++ b/wrappers/python/solrstice/collection.pyi @@ -1,9 +1,10 @@ -from typing import List, Optional +from typing import TYPE_CHECKING, List, Optional -from solrstice import SolrServerContext +if TYPE_CHECKING: + from solrstice import SolrServerContext async def create_collection( - context: SolrServerContext, + context: "SolrServerContext", name: str, config: str, shards: Optional[int] = 1, @@ -20,7 +21,7 @@ async def create_collection( """ def create_collection_blocking( - context: SolrServerContext, + context: "SolrServerContext", name: str, config: str, shards: Optional[int] = 1, @@ -36,7 +37,7 @@ def create_collection_blocking( :param replication_factor: The replication factor to use. """ -async def get_collections(context: SolrServerContext) -> List[str]: +async def get_collections(context: "SolrServerContext") -> List[str]: """ Get the list of collections on the Solr server. @@ -44,7 +45,7 @@ async def get_collections(context: SolrServerContext) -> List[str]: :return: The list of collections on the Solr server. """ -def get_collections_blocking(context: SolrServerContext) -> List[str]: +def get_collections_blocking(context: "SolrServerContext") -> List[str]: """ Get the list of collections on the Solr server. @@ -52,7 +53,7 @@ def get_collections_blocking(context: SolrServerContext) -> List[str]: :return: The list of collections on the Solr server. """ -async def collection_exists(context: SolrServerContext, name: str) -> bool: +async def collection_exists(context: "SolrServerContext", name: str) -> bool: """ Check if a collection exists on the Solr server. @@ -61,7 +62,7 @@ async def collection_exists(context: SolrServerContext, name: str) -> bool: :return: True if the collection exists, False otherwise. """ -def collection_exists_blocking(context: SolrServerContext, name: str) -> bool: +def collection_exists_blocking(context: "SolrServerContext", name: str) -> bool: """ Check if a collection exists on the Solr server. @@ -70,7 +71,7 @@ def collection_exists_blocking(context: SolrServerContext, name: str) -> bool: :return: True if the collection exists, False otherwise. """ -async def delete_collection(context: SolrServerContext, name: str) -> None: +async def delete_collection(context: "SolrServerContext", name: str) -> None: """ Delete a config from the Solr server. @@ -78,10 +79,21 @@ async def delete_collection(context: SolrServerContext, name: str) -> None: :param name: The name of the collection to delete. """ -def delete_collection_blocking(context: SolrServerContext, name: str) -> None: +def delete_collection_blocking(context: "SolrServerContext", name: str) -> None: """ Delete a config from the Solr server. :param context: The Solr server context. :param name: The name of the collection to delete. """ + +__all__ = [ + "create_collection", + "create_collection_blocking", + "get_collections", + "get_collections_blocking", + "collection_exists", + "collection_exists_blocking", + "delete_collection", + "delete_collection_blocking", +] diff --git a/wrappers/python/solrstice/config.pyi b/wrappers/python/solrstice/config.pyi index 1e9d7c1..61b5f20 100644 --- a/wrappers/python/solrstice/config.pyi +++ b/wrappers/python/solrstice/config.pyi @@ -1,15 +1,15 @@ from os import PathLike from typing import TYPE_CHECKING, List, Union -from solrstice import SolrServerContext - if TYPE_CHECKING: + from solrstice import SolrServerContext + Somepath = Union[PathLike[str], str] else: Somepath = Union[PathLike, str] async def upload_config( - context: SolrServerContext, config_name: str, config_path: Somepath + context: "SolrServerContext", config_name: str, config_path: Somepath ) -> None: """Uploads a Solr config to a Solr instance @@ -20,7 +20,7 @@ async def upload_config( pass def upload_config_blocking( - context: SolrServerContext, config_name: str, config_path: Somepath + context: "SolrServerContext", config_name: str, config_path: Somepath ) -> None: """Uploads a Solr config to a Solr instance @@ -30,7 +30,7 @@ def upload_config_blocking( """ pass -async def delete_config(context: SolrServerContext, config_name: str) -> None: +async def delete_config(context: "SolrServerContext", config_name: str) -> None: """Deletes a Solr config from a Solr instance :param context: SolrServerRequest context @@ -38,7 +38,7 @@ async def delete_config(context: SolrServerContext, config_name: str) -> None: """ pass -def delete_config_blocking(context: SolrServerContext, config_name: str) -> None: +def delete_config_blocking(context: "SolrServerContext", config_name: str) -> None: """Deletes a Solr config from a Solr instance :param context: SolrServerRequest context @@ -46,7 +46,7 @@ def delete_config_blocking(context: SolrServerContext, config_name: str) -> None """ pass -async def config_exists(context: SolrServerContext, config_name: str) -> bool: +async def config_exists(context: "SolrServerContext", config_name: str) -> bool: """Checks if a Solr config exists on a Solr instance :param context: SolrServerRequest context @@ -54,7 +54,7 @@ async def config_exists(context: SolrServerContext, config_name: str) -> bool: """ pass -def config_exists_blocking(context: SolrServerContext, config_name: str) -> bool: +def config_exists_blocking(context: "SolrServerContext", config_name: str) -> bool: """Checks if a Solr config exists on a Solr instance :param context: SolrServerRequest context @@ -62,16 +62,27 @@ def config_exists_blocking(context: SolrServerContext, config_name: str) -> bool """ pass -async def get_configs(context: SolrServerContext) -> List[str]: +async def get_configs(context: "SolrServerContext") -> List[str]: """Gets a list of Solr configs on a Solr instance :param context: SolrServerRequest context """ pass -def get_configs_blocking(context: SolrServerContext) -> List[str]: +def get_configs_blocking(context: "SolrServerContext") -> List[str]: """Gets a list of Solr configs on a Solr instance :param context: SolrServerRequest builder """ pass + +__all__ = [ + "upload_config", + "upload_config_blocking", + "delete_config", + "delete_config_blocking", + "config_exists", + "config_exists_blocking", + "get_configs", + "get_configs_blocking", +] diff --git a/wrappers/python/solrstice/models.pyi b/wrappers/python/solrstice/models.pyi index 8566ec4..c023e9e 100644 --- a/wrappers/python/solrstice/models.pyi +++ b/wrappers/python/solrstice/models.pyi @@ -85,7 +85,7 @@ class SolrGroupFieldResult: :return: Group value """ - def get_doc_list(self) -> SolrDocsResponse: + def get_doc_list(self) -> "SolrDocsResponse": """ Gets the document response from solr :return: Document response @@ -102,13 +102,13 @@ class SolrGroupResult: :return: List of group field results """ - def get_query_result(self) -> Optional[SolrDocsResponse]: + def get_query_result(self) -> Optional["SolrDocsResponse"]: """ Gets the query result from a group query :return: Query result """ - def get_simple_result(self) -> Optional[SolrDocsResponse]: + def get_simple_result(self) -> Optional["SolrDocsResponse"]: """ Gets the result from a group query where `GroupFormatting.Simple` was used :return: Simple result @@ -177,7 +177,7 @@ class SolrDocsResponse: class SolrResponse: """The response from a solr query""" - def get_docs_response(self) -> Optional[SolrDocsResponse]: + def get_docs_response(self) -> Optional["SolrDocsResponse"]: """Get the response from a solr query""" def get_groups(self) -> Dict[str, "SolrGroupResult"]: @@ -191,3 +191,14 @@ class SolrResponse: def get_json_facets(self) -> Optional["SolrJsonFacetResponse"]: """Get json facets""" + +__all__ = [ + "SolrFacetSetResult", + "SolrPivotFacetResult", + "SolrFieldFacetResult", + "SolrGroupFieldResult", + "SolrGroupResult", + "SolrJsonFacetResponse", + "SolrDocsResponse", + "SolrResponse", +] diff --git a/wrappers/python/src/queries/alias.rs b/wrappers/python/src/queries/alias.rs index 8cfde49..7460bc5 100644 --- a/wrappers/python/src/queries/alias.rs +++ b/wrappers/python/src/queries/alias.rs @@ -1,7 +1,6 @@ use crate::models::context::SolrServerContextWrapper; use crate::models::error::PyErrWrapper; use pyo3::prelude::*; -use solrstice::SolrServerContext; use solrstice::queries::alias::{ alias_exists as alias_exists_rs, create_alias as create_alias_rs, delete_alias as delete_alias_rs, get_aliases as get_aliases_rs, @@ -12,6 +11,7 @@ use solrstice::queries::alias::{ delete_alias_blocking as delete_alias_blocking_rs, get_aliases_blocking as get_aliases_blocking_rs, }; +use solrstice::SolrServerContext; use std::collections::HashMap; #[pymodule] diff --git a/wrappers/python/src/queries/collection.rs b/wrappers/python/src/queries/collection.rs index d24f5ff..ecc7d6b 100644 --- a/wrappers/python/src/queries/collection.rs +++ b/wrappers/python/src/queries/collection.rs @@ -1,7 +1,6 @@ use crate::models::context::SolrServerContextWrapper; use crate::models::error::PyErrWrapper; use pyo3::prelude::*; -use solrstice::SolrServerContext; use solrstice::queries::collection::{ collection_exists as collection_exists_rs, create_collection as create_collection_rs, delete_collection as delete_collection_rs, get_collections as get_collections_rs, @@ -12,6 +11,7 @@ use solrstice::queries::collection::{ delete_collection_blocking as delete_collection_blocking_rs, get_collections_blocking as get_collections_blocking_rs, }; +use solrstice::SolrServerContext; #[pymodule] pub fn collection(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { diff --git a/wrappers/python/src/queries/config.rs b/wrappers/python/src/queries/config.rs index 0333239..ab72fa1 100644 --- a/wrappers/python/src/queries/config.rs +++ b/wrappers/python/src/queries/config.rs @@ -1,7 +1,6 @@ use crate::models::context::SolrServerContextWrapper; use crate::models::error::PyErrWrapper; use pyo3::prelude::*; -use solrstice::SolrServerContext; use solrstice::queries::config::{ config_exists as config_exists_rs, delete_config as delete_config_rs, get_configs as get_configs_rs, upload_config as upload_config_rs, @@ -12,6 +11,7 @@ use solrstice::queries::config::{ get_configs_blocking as get_configs_blocking_rs, upload_config_blocking as upload_config_blocking_rs, }; +use solrstice::SolrServerContext; use std::path::PathBuf; #[pymodule]