Skip to content

Commit 9cb72bd

Browse files
authored
Publish API docs to GitHub pages (#172)
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
1 parent b891400 commit 9cb72bd

11 files changed

Lines changed: 393 additions & 6 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Documentation
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- "docs/**"
8+
- "src/**"
9+
- zensical.toml
10+
- ".github/workflows/docs.yaml"
11+
pull_request:
12+
paths:
13+
- "docs/**"
14+
- "src/**"
15+
- zensical.toml
16+
- ".github/workflows/docs.yaml"
17+
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
23+
jobs:
24+
build:
25+
environment:
26+
name: ${{ github.event_name != 'pull_request' && 'github-pages' || null }}
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
29+
runs-on: ubuntu-24.04
30+
31+
steps:
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
36+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
37+
38+
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
39+
40+
- run: uv run --group docs --no-dev zensical build --clean
41+
42+
- uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
43+
if: github.event_name != 'pull_request'
44+
with:
45+
path: site
46+
47+
- uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
48+
if: github.event_name != 'pull_request'
49+
id: deployment

docs/api.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# API Reference
2+
3+
::: connectrpc.client
4+
::: connectrpc.server
5+
6+
::: connectrpc.code
7+
::: connectrpc.errors
8+
9+
::: connectrpc.method
10+
::: connectrpc.request
11+
12+
::: connectrpc.interceptor
13+
14+
::: connectrpc.compression
15+
::: connectrpc.compression.brotli
16+
::: connectrpc.compression.gzip
17+
::: connectrpc.compression.zstd

docs/img/favicon.png

30.1 KB
Loading

docs/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ConnectRPC
2+
3+
Welcome to ConnectRPC!
4+
5+
View our [main documentation](https://connectrpc.com/docs/python/getting-started)
6+
or the generated [API reference](./api.md).

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,6 @@ checkgenerate: generate
6565
bump semver:
6666
uv version --bump={{ semver }}
6767
uv version --bump={{ semver }} --directory protoc-gen-connect-python
68+
69+
serve-docs:
70+
uv run --group docs zensical serve

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ dev = [
6363
"pytest-timeout",
6464
]
6565

66+
docs = ["zensical==0.0.27", "mkdocstrings-python==2.0.3"]
67+
6668
[build-system]
6769
requires = ["uv_build>=0.10.0,<0.11.0"]
6870
build-backend = "uv_build"

src/connectrpc/_response_metadata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ class ResponseMetadata:
6464
for the invocation made within the context.
6565
6666
Example:
67-
67+
```python
6868
with ResponseMetadata() as resp_data:
6969
resp = client.MakeHat(Size(inches=10))
7070
do_something_with_response_payload(resp)
7171
check_response_headers(resp_data.headers())
7272
check_response_trailers(resp_data.trailers())
73+
```
7374
"""
7475

7576
_headers: Headers | None = None

src/connectrpc/compression/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Compression(Protocol):
1313
used by specifying implementations of this protocol. We provide standard
1414
implementations for
1515
16-
- br (connectrpc.compression.brotli.BrotliCompression) - requires the brotli dependency
17-
- zstd (connectrpc.compression.zstd.ZstdCompression) - requires the zstandard dependency
16+
- br (connectrpc.compression.brotli.BrotliCompression) - requires the `brotli` dependency
17+
- zstd (connectrpc.compression.zstd.ZstdCompression) - requires the `zstandard` dependency
1818
"""
1919

2020
def name(self) -> str:

src/connectrpc/compression/gzip.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class GzipCompression(Compression):
1010

1111
def __init__(self, level: int = 6) -> None:
1212
"""Creates a new GzipCompression.
13+
1314
Args:
1415
level: Compression level to use.
1516
"""

uv.lock

Lines changed: 267 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)