# Description - Installed and configured [pydoc-markdown](https://niklasrosenstein.github.io/pydoc-markdown/). - Created a script that generates and cleans markdown files with a configurable package list. - Added docstrings to relevant public methods of the various sdk classes in order for pydoc to detect them. # Test ```bash cd packages/python-sdk ./scripts/generate_api_ref.sh ls ./api_ref ``` # Considerations This could eventually be used directly as `.mdx` in the docs nextjs app, it would look like this with current styling: <img width="836" alt="Screenshot 2024-09-17 at 17 22 43" src="https://github.com/user-attachments/assets/a23e954f-2834-4fb6-88a6-d87747a0cf49">
22 lines
686 B
Bash
Executable File
22 lines
686 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
# This script generates the python sdk api reference markdown files
|
|
# Run it in the `python-sdk/` directory
|
|
|
|
packages=("sandbox_sync" "sandbox_async" "exceptions")
|
|
|
|
mkdir api_ref
|
|
|
|
for package in "${packages[@]}"; do
|
|
# generate raw api reference markdown file
|
|
pydoc-markdown -p e2b.${package} >api_ref/${package}.mdx
|
|
# remove package path display
|
|
sed -i '' '/<a[^>]*>.*<\/a>/d' api_ref/${package}.mdx
|
|
# remove empty hyperlinks
|
|
sed -i '' '/^# /d' api_ref/${package}.mdx
|
|
# move to docs (for later use)
|
|
# mv api_ref/${package}.mdx ../../apps/web/src/app/\(docs\)/docs/api-reference/python-sdk/${package}/page.mdx
|
|
done
|