Skip to content

Commit e53eef4

Browse files
authored
ci: durably stamp package metadata in regen + fix README auth (#49)
* ci(regen): stamp gitUserId/gitRepoId and patch keywords post-generate * docs: update README auth example for api_key/workspace_id and api host * docs: add pypi install, drop generator mention, fix relative docs links * docs: drop tests section and link Hotdata to www site * docs: drop maintainer note from API reference section * ci(regen): also patch [project.urls] to include Homepage
1 parent 4191130 commit e53eef4

3 files changed

Lines changed: 43 additions & 23 deletions

File tree

.github/workflows/regenerate.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
-g python \
5050
-o . \
5151
-t .openapi-generator-templates \
52-
--additional-properties=packageName=hotdata,projectName=hotdata,packageVersion=${{ steps.pkg.outputs.version }} \
52+
--additional-properties=packageName=hotdata,projectName=hotdata,packageVersion=${{ steps.pkg.outputs.version }},gitUserId=hotdata-dev,gitRepoId=sdk-python \
5353
--skip-validate-spec
5454
5555
- name: Patch generated __version__ to read from package metadata
@@ -72,6 +72,31 @@ jobs:
7272
p.write_text(new)
7373
PY
7474
75+
- name: Patch generated pyproject.toml metadata
76+
run: |
77+
python3 - <<'PY'
78+
import re, pathlib, sys
79+
p = pathlib.Path("pyproject.toml")
80+
src = p.read_text()
81+
patches = [
82+
(
83+
r'^keywords = \[.*\]$',
84+
'keywords = ["hotdata", "api-client", "data-platform"]',
85+
re.MULTILINE,
86+
),
87+
(
88+
r'\[project\.urls\]\nRepository = "[^"]*"\n',
89+
'[project.urls]\nHomepage = "https://www.hotdata.dev"\nRepository = "https://github.com/hotdata-dev/sdk-python"\n',
90+
0,
91+
),
92+
]
93+
for pattern, replacement, flags in patches:
94+
src, n = re.subn(pattern, replacement, src, count=1, flags=flags)
95+
if n != 1:
96+
sys.exit(f"Failed to patch pyproject.toml: pattern {pattern!r}")
97+
p.write_text(src)
98+
PY
99+
75100
- name: Clean up generated artifacts
76101
run: |
77102
rm -f openapi.yaml

README.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,43 @@
11
# hotdata
22

3-
Official Python client for the [Hotdata](https://app.hotdata.dev) HTTP API: workspaces, connections, datasets, SQL queries, results, secrets, uploads, indexes, jobs, embedding providers, and workspace context.
4-
5-
The package is produced with [OpenAPI Generator](https://openapi-generator.tech) from the Hotdata OpenAPI spec.
3+
Official Python client for the [Hotdata](https://www.hotdata.dev) HTTP API: workspaces, connections, datasets, SQL queries, results, secrets, uploads, indexes, jobs, embedding providers, and workspace context.
64

75
## Requirements
86

97
Python 3.9+
108

119
## Install
1210

13-
From the repository:
14-
1511
```sh
16-
pip install "git+https://github.com/hotdata-dev/sdk-python.git"
12+
pip install hotdata
1713
```
1814

19-
From a local checkout (editable):
15+
For an unreleased revision:
2016

2117
```sh
22-
pip install -e .
18+
pip install "git+https://github.com/hotdata-dev/sdk-python.git"
2319
```
2420

25-
## Tests
21+
From a local checkout (editable):
2622

2723
```sh
28-
pytest
24+
pip install -e .
2925
```
3026

3127
## Authentication
3228

33-
The API uses **Bearer** JWTs and an **`X-Workspace-Id`** header on requests that are scoped to a workspace.
29+
The API uses an **API key** sent as `Authorization: Bearer <key>`, plus an **`X-Workspace-Id`** header on requests scoped to a workspace.
3430

3531
```python
3632
import hotdata
3733

3834
configuration = hotdata.Configuration(
39-
access_token="YOUR_ACCESS_TOKEN",
40-
api_key={"WorkspaceId": "YOUR_WORKSPACE_ID"},
35+
api_key="YOUR_API_KEY",
36+
workspace_id="YOUR_WORKSPACE_ID",
4137
)
4238
```
4339

44-
`host` defaults to `https://app.hotdata.dev`. Override it if you target another environment.
40+
`host` defaults to `https://api.hotdata.dev`. Override it if you target another environment.
4541

4642
## Usage
4743

@@ -50,8 +46,8 @@ import hotdata
5046
from hotdata.rest import ApiException
5147

5248
configuration = hotdata.Configuration(
53-
access_token="YOUR_ACCESS_TOKEN",
54-
api_key={"WorkspaceId": "YOUR_WORKSPACE_ID"},
49+
api_key="YOUR_API_KEY",
50+
workspace_id="YOUR_WORKSPACE_ID",
5551
)
5652

5753
with hotdata.ApiClient(configuration) as api_client:
@@ -66,13 +62,11 @@ Each `Api` class groups endpoints by resource. Construct the client, then call t
6662

6763
## API reference
6864

69-
Generated Markdown for every operation and model is in [`docs/`](docs/):
65+
Generated Markdown for every operation and model is in [`docs/`](https://github.com/hotdata-dev/sdk-python/tree/main/docs):
7066

71-
- Resource APIs: `docs/*Api.md` (for example [`docs/QueryApi.md`](docs/QueryApi.md))
67+
- Resource APIs: `docs/*Api.md` (for example [`QueryApi.md`](https://github.com/hotdata-dev/sdk-python/blob/main/docs/QueryApi.md))
7268
- Request and response models: `docs/<ModelName>.md`
7369

74-
Use your editor or GitHub file search there instead of duplicating large tables in this file.
75-
7670
## Support
7771

7872
Questions and issues: [github.com/hotdata-dev/sdk-python](https://github.com/hotdata-dev/sdk-python).

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [
77
]
88
license = { text = "MIT" }
99
readme = "README.md"
10-
keywords = ["OpenAPI", "OpenAPI-Generator", "Hotdata API"]
10+
keywords = ["hotdata", "api-client", "data-platform"]
1111
requires-python = ">=3.9"
1212

1313
dependencies = [
@@ -18,7 +18,8 @@ dependencies = [
1818
]
1919

2020
[project.urls]
21-
Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
21+
Homepage = "https://www.hotdata.dev"
22+
Repository = "https://github.com/hotdata-dev/sdk-python"
2223

2324
[tool.poetry]
2425
requires-poetry = ">=2.0"

0 commit comments

Comments
 (0)