Skip to content

Commit 211bafc

Browse files
authored
Python server SDK reference (#206)
1 parent dd57b98 commit 211bafc

File tree

16 files changed

+2021
-30
lines changed

16 files changed

+2021
-30
lines changed

.github/workflows/docs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
node-version: "lts/*"
4141
- name: Use corepack
4242
run: corepack enable
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v6
4345
- name: Install dependencies
4446
run: yarn install --immutable
4547
- name: Fetch SDK packages

.github/workflows/static_check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
node-version: "lts/*"
1919
- name: Use corepack
2020
run: corepack enable
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v6
2123
- name: Run prepare
2224
run: scripts/prepare.sh
2325
- name: Install node dependencies

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,6 @@ build
137137
docs/api/mobile/**
138138
docs/api/web/**
139139
docs/api/server/**
140+
docs/api/server-python/**
140141

141142
.cursor/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "api/room-manager"]
1717
path = api/room-manager
1818
url = [email protected]:fishjam-cloud/room-manager.git
19+
[submodule "packages/python-server-sdk"]
20+
path = packages/python-server-sdk
21+
url = https://github.com/fishjam-cloud/python-server-sdk.git

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules/*
44
packages/*
55
api/**
66
versioned_docs/*/api/**
7+
docs/api/server-python/*

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ The Documentation explains how Fishjam works and how it can be integrated in you
88

99
### Local Development
1010

11+
#### Python
12+
13+
`python-server-sdk` requires [uv](https://docs.astral.sh/uv/). Make sure to have it installed first.
14+
15+
#### yarn
16+
1117
Get all dependencies
1218

1319
```

docusaurus.config.ts

Lines changed: 59 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import {
1515
import { rendererClassic, transformerTwoslash } from "@shikijs/twoslash";
1616
import {
1717
NormalizedSidebar,
18+
NormalizedSidebarItem,
1819
SidebarItemsGeneratorVersion,
20+
SidebarItemCategory,
1921
} from "@docusaurus/plugin-content-docs/src/sidebars/types.js";
2022

2123
function isErrorFromVersionedDocs(options: { meta?: { __raw?: string } }) {
@@ -56,45 +58,74 @@ const rehypeShikiPlugin = [
5658
} satisfies RehypeShikiOptions,
5759
] satisfies MDXPlugin;
5860

61+
type CustomInjectedCategory = Omit<SidebarItemCategory, "items"> & {
62+
items: any;
63+
};
64+
5965
function injectTypeDocSidebar(
6066
version: SidebarItemsGeneratorVersion,
6167
items: NormalizedSidebar,
6268
): NormalizedSidebar {
69+
console.log(version.versionName);
70+
const docs_without_python_reference = ["0.20.0", "0.21.0", "0.22.0"];
71+
72+
const exclude_python = docs_without_python_reference.includes(
73+
version.versionName,
74+
);
75+
6376
return items.map((item) => {
6477
if (item.customProps?.id === "generated-api" && item.type === "category") {
78+
const injectedItems: (CustomInjectedCategory | NormalizedSidebarItem)[] =
79+
[
80+
{
81+
type: "category",
82+
label: "React Native SDK",
83+
link: { type: "doc", id: "api/mobile/index" },
84+
items: require(
85+
`${version.contentPath}/api/mobile/typedoc-sidebar.cjs`,
86+
),
87+
},
88+
{
89+
type: "category",
90+
label: "React SDK",
91+
link: { type: "doc", id: "api/web/index" },
92+
items: require(
93+
`${version.contentPath}/api/web/typedoc-sidebar.cjs`,
94+
),
95+
},
96+
{
97+
type: "category",
98+
label: "Server SDK for JS",
99+
link: { type: "doc", id: "api/server/index" },
100+
items: require(
101+
`${version.contentPath}/api/server/typedoc-sidebar.cjs`,
102+
),
103+
},
104+
];
105+
106+
if (!exclude_python) {
107+
injectedItems.push({
108+
type: "category",
109+
label: "Server SDK for Python",
110+
link: { type: "doc", id: "api/server-python/fishjam" },
111+
items: [
112+
{
113+
type: "autogenerated",
114+
dirName: "api/server-python",
115+
},
116+
],
117+
});
118+
}
119+
65120
return {
66121
...item,
67122
items: [
68-
...([
69-
{
70-
type: "category",
71-
label: "React Native SDK",
72-
link: { type: "doc", id: "api/mobile/index" },
73-
items: require(
74-
`${version.contentPath}/api/mobile/typedoc-sidebar.cjs`,
75-
),
76-
},
77-
{
78-
type: "category",
79-
label: "React SDK",
80-
link: { type: "doc", id: "api/web/index" },
81-
items: require(
82-
`${version.contentPath}/api/web/typedoc-sidebar.cjs`,
83-
),
84-
},
85-
{
86-
type: "category",
87-
label: "Server SDK for JS",
88-
link: { type: "doc", id: "api/server/index" },
89-
items: require(
90-
`${version.contentPath}/api/server/typedoc-sidebar.cjs`,
91-
),
92-
},
93-
] as const),
94-
...item.items.filter((element) => element.type == "doc"),
95-
],
123+
...injectedItems,
124+
...item.items.filter((element) => element.type === "doc"),
125+
] as NormalizedSidebar,
96126
};
97127
}
128+
98129
return item;
99130
});
100131
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"private": true,
55
"scripts": {
66
"docusaurus": "docusaurus",
7-
"start": "docusaurus start",
8-
"build": "docusaurus build",
7+
"generate:python:docs": "sh ./scripts/generate_python_docs.sh",
8+
"start": "npm run generate:python:docs && docusaurus start",
9+
"build": "npm run generate:python:docs && docusaurus build",
910
"swizzle": "docusaurus swizzle",
1011
"deploy": "docusaurus deploy",
1112
"clear": "docusaurus clear",

packages/python-server-sdk

Submodule python-server-sdk added at 5544a54

scripts/generate_python_docs.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
ROOTDIR=$(dirname $(dirname "$(readlink -f $0)"))
6+
echo $ROOTDIR
7+
cd $ROOTDIR
8+
9+
cd packages/python-server-sdk
10+
uv sync --all-packages
11+
uv run generate_docusaurus
12+
cd $ROOTDIR
13+
14+
rm -rf docs/api/server-python
15+
cp -r packages/python-server-sdk/docusaurus docs/api/server-python

0 commit comments

Comments
 (0)