Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.1.0"
".": "3.2.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 68
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f8d4f4ee9ccccf65054df0c205156f6022a8d207441b1494fa56bd950b44593b.yml
configured_endpoints: 74
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2501e64cd24ad589fc833556bbecd5f54321add8f57b18c6af3503a75be0101f.yml
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 3.2.0 (2024-11-12)

Full Changelog: [v3.1.0...v3.2.0](https://github.com/DataMini/asktable-python/compare/v3.1.0...v3.2.0)

### Features

* **api:** api update ([#15](https://github.com/DataMini/asktable-python/issues/15)) ([0bd4771](https://github.com/DataMini/asktable-python/commit/0bd477131ac8185904589a971e78023c254f88fc))
* **api:** api update ([#17](https://github.com/DataMini/asktable-python/issues/17)) ([6e24354](https://github.com/DataMini/asktable-python/commit/6e24354e23a176d8afccb60c0cc11bb1ebdf33ab))
* **api:** api update ([#18](https://github.com/DataMini/asktable-python/issues/18)) ([8492bb7](https://github.com/DataMini/asktable-python/commit/8492bb7e705d0c60343a272ab7fb5e9cf28d5ecb))
* **api:** api update ([#19](https://github.com/DataMini/asktable-python/issues/19)) ([e9ffbf7](https://github.com/DataMini/asktable-python/commit/e9ffbf7f64390dac45ea2454f06280baab45aa7f))
* **api:** api update ([#20](https://github.com/DataMini/asktable-python/issues/20)) ([eb8d8c1](https://github.com/DataMini/asktable-python/commit/eb8d8c159ec9f6db0cb3400fd28da376a362054f))
* **api:** api update ([#23](https://github.com/DataMini/asktable-python/issues/23)) ([6527b96](https://github.com/DataMini/asktable-python/commit/6527b963f43a6b608283dfaa7f9d90d1140f5fe5))
* **api:** api update ([#24](https://github.com/DataMini/asktable-python/issues/24)) ([83045c6](https://github.com/DataMini/asktable-python/commit/83045c6a90f350182f9c022d74ebb9d3c23f0b59))
* **api:** api update ([#27](https://github.com/DataMini/asktable-python/issues/27)) ([c16037f](https://github.com/DataMini/asktable-python/commit/c16037f8c580a56c5348c82baf04d3f0e1980dff))
* **api:** manual updates ([#28](https://github.com/DataMini/asktable-python/issues/28)) ([a75217e](https://github.com/DataMini/asktable-python/commit/a75217ea3d433687573070480ef7381bd3f2d887))
* **api:** manual updates ([#29](https://github.com/DataMini/asktable-python/issues/29)) ([35884cc](https://github.com/DataMini/asktable-python/commit/35884ccfecaf87c60899ea1a143a8640125d4e8c))


### Chores

* rebuild project due to codegen change ([#21](https://github.com/DataMini/asktable-python/issues/21)) ([911dd76](https://github.com/DataMini/asktable-python/commit/911dd760e7d4022725fcd8607d3c7907d3a7fae3))
* rebuild project due to codegen change ([#22](https://github.com/DataMini/asktable-python/issues/22)) ([9df1755](https://github.com/DataMini/asktable-python/commit/9df175567613a324478980242eee95cacf64a34d))
* rebuild project due to codegen change ([#25](https://github.com/DataMini/asktable-python/issues/25)) ([c5804aa](https://github.com/DataMini/asktable-python/commit/c5804aa3ad70a4470ca30a75460cd12b145fddc4))
* rebuild project due to codegen change ([#26](https://github.com/DataMini/asktable-python/issues/26)) ([6db974f](https://github.com/DataMini/asktable-python/commit/6db974fc42b9933b4ba685d50b08657bdd191747))

## 3.1.0 (2024-10-13)

Full Changelog: [v3.0.0...v3.1.0](https://github.com/DataMini/asktable-python/compare/v3.0.0...v3.1.0)
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![PyPI version](https://img.shields.io/pypi/v/asktable.svg)](https://pypi.org/project/asktable/)

The Asktable Python library provides convenient access to the Asktable REST API from any Python 3.7+
The Asktable Python library provides convenient access to the Asktable REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).

Expand Down Expand Up @@ -84,7 +84,6 @@ client = Asktable()

try:
client.datasources.create(
access_config={},
engine="mysql",
)
except asktable.APIConnectionError as e:
Expand Down Expand Up @@ -130,7 +129,6 @@ client = Asktable(

# Or, configure per-request:
client.with_options(max_retries=5).datasources.create(
access_config={},
engine="mysql",
)
```
Expand All @@ -156,7 +154,6 @@ client = Asktable(

# Override per-request:
client.with_options(timeout=5.0).datasources.create(
access_config={},
engine="mysql",
)
```
Expand Down Expand Up @@ -198,7 +195,6 @@ from asktable import Asktable

client = Asktable()
response = client.datasources.with_raw_response.create(
access_config={},
engine="mysql",
)
print(response.headers.get('X-My-Header'))
Expand All @@ -219,7 +215,6 @@ To stream the response body, use `.with_streaming_response` instead, which requi

```python
with client.datasources.with_streaming_response.create(
access_config={},
engine="mysql",
) as response:
print(response.headers.get("X-My-Header"))
Expand Down Expand Up @@ -321,7 +316,7 @@ print(asktable.__version__)

## Requirements

Python 3.7 or higher.
Python 3.8 or higher.

## Contributing

Expand Down
49 changes: 41 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ Methods:
Types:

```python
from asktable.types import Chat, ChatOut, ChatListResponse
from asktable.types import ChatCreateResponse, ChatRetrieveResponse, ChatListResponse
```

Methods:

- <code title="post /chats">client.chats.<a href="./src/asktable/resources/chats/chats.py">create</a>(\*\*<a href="src/asktable/types/chat_create_params.py">params</a>) -> <a href="./src/asktable/types/chat.py">Chat</a></code>
- <code title="get /chats/{chat_id}">client.chats.<a href="./src/asktable/resources/chats/chats.py">retrieve</a>(chat_id) -> <a href="./src/asktable/types/chat_out.py">ChatOut</a></code>
- <code title="post /chats">client.chats.<a href="./src/asktable/resources/chats/chats.py">create</a>(\*\*<a href="src/asktable/types/chat_create_params.py">params</a>) -> <a href="./src/asktable/types/chat_create_response.py">ChatCreateResponse</a></code>
- <code title="get /chats/{chat_id}">client.chats.<a href="./src/asktable/resources/chats/chats.py">retrieve</a>(chat_id) -> <a href="./src/asktable/types/chat_retrieve_response.py">ChatRetrieveResponse</a></code>
- <code title="get /chats">client.chats.<a href="./src/asktable/resources/chats/chats.py">list</a>(\*\*<a href="src/asktable/types/chat_list_params.py">params</a>) -> <a href="./src/asktable/types/chat_list_response.py">ChatListResponse</a></code>
- <code title="delete /chats/{chat_id}">client.chats.<a href="./src/asktable/resources/chats/chats.py">delete</a>(chat_id) -> None</code>

Expand Down Expand Up @@ -139,14 +139,20 @@ Methods:
Types:

```python
from asktable.types.datasources import Meta, MetaCreateResponse, MetaUpdateResponse
from asktable.types.datasources import (
Meta,
MetaCreateResponse,
MetaUpdateResponse,
MetaDeleteResponse,
)
```

Methods:

- <code title="post /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">create</a>(datasource_id) -> <a href="./src/asktable/types/datasources/meta_create_response.py">object</a></code>
- <code title="get /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">retrieve</a>(datasource_id, \*\*<a href="src/asktable/types/datasources/meta_retrieve_params.py">params</a>) -> <a href="./src/asktable/types/datasources/meta.py">Meta</a></code>
- <code title="put /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">update</a>(\*, path_datasource_id, \*\*<a href="src/asktable/types/datasources/meta_update_params.py">params</a>) -> <a href="./src/asktable/types/datasources/meta_update_response.py">object</a></code>
- <code title="post /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">create</a>(datasource_id, \*\*<a href="src/asktable/types/datasources/meta_create_params.py">params</a>) -> <a href="./src/asktable/types/datasources/meta_create_response.py">object</a></code>
- <code title="get /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">retrieve</a>(datasource_id) -> <a href="./src/asktable/types/datasources/meta.py">Meta</a></code>
- <code title="put /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">update</a>(datasource_id, \*\*<a href="src/asktable/types/datasources/meta_update_params.py">params</a>) -> <a href="./src/asktable/types/datasources/meta_update_response.py">object</a></code>
- <code title="delete /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">delete</a>(datasource_id) -> <a href="./src/asktable/types/datasources/meta_delete_response.py">object</a></code>

## UploadParams

Expand Down Expand Up @@ -279,7 +285,19 @@ from asktable.types import AnswerDataSourceOut

Methods:

- <code title="post /integration/excel_csv_ask">client.integration.<a href="./src/asktable/resources/integration.py">excel_csv_ask</a>(\*\*<a href="src/asktable/types/integration_excel_csv_ask_params.py">params</a>) -> <a href="./src/asktable/types/answer_data_source_out.py">AnswerDataSourceOut</a></code>
- <code title="post /integration/excel_csv_ask">client.integration.<a href="./src/asktable/resources/integration/integration.py">excel_csv_ask</a>(\*\*<a href="src/asktable/types/integration_excel_csv_ask_params.py">params</a>) -> <a href="./src/asktable/types/answer_data_source_out.py">AnswerDataSourceOut</a></code>

## ExcelCsv

Types:

```python
from asktable.types.integration import DatasourceOut
```

Methods:

- <code title="post /integration/create_excel_ds">client.integration.excel_csv.<a href="./src/asktable/resources/integration/excel_csv.py">create</a>(\*\*<a href="src/asktable/types/integration/excel_csv_create_params.py">params</a>) -> <a href="./src/asktable/types/data_source.py">DataSource</a></code>

# Sys

Expand Down Expand Up @@ -324,3 +342,18 @@ from asktable.types.sys.projects import TokenCreateResponse
Methods:

- <code title="post /sys/projects/{project_id}/tokens">client.sys.projects.tokens.<a href="./src/asktable/resources/sys/projects/tokens.py">create</a>(project_id, \*\*<a href="src/asktable/types/sys/projects/token_create_params.py">params</a>) -> <a href="./src/asktable/types/sys/projects/token_create_response.py">object</a></code>

# KB

Types:

```python
from asktable.types import Document, PageDocument, KBCreateResponse, KBDeleteResponse
```

Methods:

- <code title="post /kb">client.kb.<a href="./src/asktable/resources/kb.py">create</a>(\*\*<a href="src/asktable/types/kb_create_params.py">params</a>) -> <a href="./src/asktable/types/kb_create_response.py">KBCreateResponse</a></code>
- <code title="get /kb/{doc_id}">client.kb.<a href="./src/asktable/resources/kb.py">retrieve</a>(doc_id) -> <a href="./src/asktable/types/document.py">Document</a></code>
- <code title="get /kb">client.kb.<a href="./src/asktable/resources/kb.py">list</a>(\*\*<a href="src/asktable/types/kb_list_params.py">params</a>) -> <a href="./src/asktable/types/page_document.py">PageDocument</a></code>
- <code title="delete /kb/{doc_id}">client.kb.<a href="./src/asktable/resources/kb.py">delete</a>(doc_id) -> <a href="./src/asktable/types/kb_delete_response.py">object</a></code>
15 changes: 5 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "asktable"
version = "3.1.0"
version = "3.2.0"
description = "The official Python library for the asktable API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -16,11 +16,10 @@ dependencies = [
"sniffio",
"cached-property; python_version < '3.8'",
]
requires-python = ">= 3.7"
requires-python = ">= 3.8"
classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down Expand Up @@ -63,11 +62,11 @@ format = { chain = [
"format:ruff",
"format:docs",
"fix:ruff",
# run formatting again to fix any inconsistencies when imports are stripped
"format:ruff",
]}
"format:black" = "black ."
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
"format:ruff" = "ruff format"
"format:isort" = "isort ."

"lint" = { chain = [
"check:ruff",
Expand Down Expand Up @@ -125,10 +124,6 @@ path = "README.md"
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
replacement = '[\1](https://github.com/DataMini/asktable-python/tree/main/\g<2>)'

[tool.black]
line-length = 120
target-version = ["py37"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
Expand All @@ -143,7 +138,7 @@ filterwarnings = [
# there are a couple of flags that are still disabled by
# default in strict mode as they are experimental and niche.
typeCheckingMode = "strict"
pythonVersion = "3.7"
pythonVersion = "3.8"

exclude = [
"_dev",
Expand Down
25 changes: 11 additions & 14 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ anyio==4.4.0
# via httpx
argcomplete==3.1.2
# via nox
attrs==23.1.0
# via pytest
certifi==2023.7.22
# via httpcore
# via httpx
Expand All @@ -28,8 +26,9 @@ distlib==0.3.7
# via virtualenv
distro==1.8.0
# via asktable
exceptiongroup==1.1.3
exceptiongroup==1.2.2
# via anyio
# via pytest
filelock==3.12.4
# via virtualenv
h11==0.14.0
Expand All @@ -49,7 +48,7 @@ markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
mypy==1.11.2
mypy==1.13.0
mypy-extensions==1.0.0
# via mypy
nodeenv==1.8.0
Expand All @@ -60,27 +59,25 @@ packaging==23.2
# via pytest
platformdirs==3.11.0
# via virtualenv
pluggy==1.3.0
# via pytest
py==1.11.0
pluggy==1.5.0
# via pytest
pydantic==2.7.1
pydantic==2.9.2
# via asktable
pydantic-core==2.18.2
pydantic-core==2.23.4
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.380
pytest==7.1.1
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.21.1
pytest-asyncio==0.24.0
python-dateutil==2.8.2
# via time-machine
pytz==2023.3.post1
# via dirty-equals
respx==0.20.2
rich==13.7.1
ruff==0.6.5
ruff==0.6.9
setuptools==68.2.2
# via nodeenv
six==1.16.0
Expand All @@ -90,10 +87,10 @@ sniffio==1.3.0
# via asktable
# via httpx
time-machine==2.9.0
tomli==2.0.1
tomli==2.0.2
# via mypy
# via pytest
typing-extensions==4.8.0
typing-extensions==4.12.2
# via anyio
# via asktable
# via mypy
Expand Down
8 changes: 4 additions & 4 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ certifi==2023.7.22
# via httpx
distro==1.8.0
# via asktable
exceptiongroup==1.1.3
exceptiongroup==1.2.2
# via anyio
h11==0.14.0
# via httpcore
Expand All @@ -30,15 +30,15 @@ httpx==0.25.2
idna==3.4
# via anyio
# via httpx
pydantic==2.7.1
pydantic==2.9.2
# via asktable
pydantic-core==2.18.2
pydantic-core==2.23.4
# via pydantic
sniffio==1.3.0
# via anyio
# via asktable
# via httpx
typing-extensions==4.8.0
typing-extensions==4.12.2
# via anyio
# via asktable
# via pydantic
Expand Down
11 changes: 9 additions & 2 deletions src/asktable/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ def __init__(
self.url = url
self.params = params

@override
def __repr__(self) -> str:
if self.url:
return f"{self.__class__.__name__}(url={self.url})"
return f"{self.__class__.__name__}(params={self.params})"


class BasePage(GenericModel, Generic[_T]):
"""
Expand Down Expand Up @@ -689,7 +695,8 @@ def _calculate_retry_timeout(
if retry_after is not None and 0 < retry_after <= 60:
return retry_after

nb_retries = max_retries - remaining_retries
# Also cap retry count to 1000 to avoid any potential overflows with `pow`
nb_retries = min(max_retries - remaining_retries, 1000)

# Apply exponential backoff, but not more than the max.
sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY)
Expand Down Expand Up @@ -1568,7 +1575,7 @@ async def _request(
except Exception as err:
log.debug("Encountered Exception", exc_info=True)

if retries_taken > 0:
if remaining_retries > 0:
return await self._retry_request(
input_options,
cast_to,
Expand Down
Loading