diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 373ad8f3..dce1ec4e 100755 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -29,5 +29,5 @@ jobs: - name: Test with pytest run: | - pytest tests + pytest -s tests diff --git a/tabpy/tabpy_tools/client.py b/tabpy/tabpy_tools/client.py index 684fdc0e..b459e559 100644 --- a/tabpy/tabpy_tools/client.py +++ b/tabpy/tabpy_tools/client.py @@ -1,4 +1,5 @@ import copy +import inspect from re import compile import time import requests @@ -390,6 +391,7 @@ def _gen_endpoint(self, name, obj, description, version=1, schema=None, is_publi "methods": endpoint_object.get_methods(), "required_files": [], "required_packages": [], + "docstring": endpoint_object.get_doc_string(), "schema": copy.copy(schema), "is_public": is_public, } diff --git a/tabpy/tabpy_tools/custom_query_object.py b/tabpy/tabpy_tools/custom_query_object.py index 18a149b8..25bcf755 100644 --- a/tabpy/tabpy_tools/custom_query_object.py +++ b/tabpy/tabpy_tools/custom_query_object.py @@ -1,4 +1,5 @@ import logging +import sys from .query_object import QueryObject as _QueryObject @@ -71,10 +72,17 @@ def query(self, *args, **kwargs): def get_doc_string(self): """Get doc string from customized query""" - if self.custom_query.__doc__ is not None: - return self.custom_query.__doc__ - else: - return "-- no docstring found in query function --" + default_docstring = "-- no docstring found in query function --" + + # TODO: fix docstring parsing on Windows systems + # if sys.platform == 'win32': + # return default_docstring + try: + ds = getattr(self.custom_query, '__doc__', None) + return ds if ds and isinstance(ds, str) else default_docstring + except Exception as e: + print(e) + return default_docstring def get_methods(self): return [self.get_query_method()] diff --git a/tabpy/tabpy_tools/rest_client.py b/tabpy/tabpy_tools/rest_client.py index c3b7a526..5f1bb0a0 100644 --- a/tabpy/tabpy_tools/rest_client.py +++ b/tabpy/tabpy_tools/rest_client.py @@ -41,6 +41,7 @@ class Endpoint(RESTObject): version = RESTProperty(int) description = RESTProperty(str) dependencies = RESTProperty(list) + docstring = RESTProperty(str) methods = RESTProperty(list) creation_time = RESTProperty(datetime, from_epoch, to_epoch) last_modified_time = RESTProperty(datetime, from_epoch, to_epoch) @@ -64,6 +65,7 @@ def __eq__(self, other): and self.version == other.version and self.description == other.description and self.dependencies == other.dependencies + and self.docstring == other.docstring and self.methods == other.methods and self.evaluator == other.evaluator and self.schema_version == other.schema_version