Skip to content

Commit d8c91b9

Browse files
committed
Merge branch 'master' into feat/enhance-send-feature-flags-api
2 parents d88fd0a + 6a27102 commit d8c91b9

File tree

9 files changed

+1485
-175
lines changed

9 files changed

+1485
-175
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ posthog-analytics
1818
pyrightconfig.json
1919
.env
2020
.DS_Store
21+
posthog-python-references.json

bin/docs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
#/ Usage: bin/docs
3+
#/ Description: Generate documentation for the PostHog Python SDK
4+
source bin/helpers/_utils.sh
5+
set_source_and_root_dir
6+
ensure_virtual_env
7+
8+
exec python3 "$(dirname "$0")/docs_scripts/generate_json_schemas.py" "$@"

bin/docs_scripts/doc_constant.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
"""
2+
Constants for PostHog Python SDK documentation generation.
3+
"""
4+
5+
from typing import Dict, Union
6+
7+
# Types that are built-in to Python and don't need to be documented
8+
NO_DOCS_TYPES = [
9+
"Client",
10+
"any",
11+
"int",
12+
"float",
13+
"bool",
14+
"dict",
15+
"list",
16+
"str",
17+
"tuple",
18+
"set",
19+
"frozenset",
20+
"bytes",
21+
"bytearray",
22+
"memoryview",
23+
"range",
24+
"slice",
25+
"complex",
26+
"Union",
27+
"Optional",
28+
"Any",
29+
"Callable",
30+
"Type",
31+
"TypeVar",
32+
"Generic",
33+
"Literal",
34+
"ClassVar",
35+
"Final",
36+
"Annotated",
37+
"NotRequired",
38+
"Required",
39+
"None",
40+
"NoneType",
41+
"object",
42+
"Unpack",
43+
"BaseException",
44+
"Exception",
45+
]
46+
47+
# Documentation generation metadata
48+
DOCUMENTATION_METADATA = {
49+
"hogRef": "0.1",
50+
"slugPrefix": "posthog-python",
51+
"specUrl": "https://github.com/PostHog/posthog-python",
52+
}
53+
54+
# Docstring parsing patterns for new format
55+
DOCSTRING_PATTERNS = {
56+
"examples_section": r"Examples:\s*\n(.*?)(?=\n\s*\n\s*Category:|\Z)",
57+
"args_section": r"Args:\s*\n(.*?)(?=\n\s*\n\s*Examples:|\n\s*\n\s*Details:|\n\s*\n\s*Category:|\Z)",
58+
"details_section": r"Details:\s*\n(.*?)(?=\n\s*\n\s*Examples:|\n\s*\n\s*Category:|\Z)",
59+
"category_section": r"Category:\s*\n\s*(.+?)\s*(?:\n|$)",
60+
"code_block": r"```(?:python)?\n(.*?)```",
61+
"param_description": r"^\s*{param_name}:\s*(.+?)(?=\n\s*\w+:|\Z)",
62+
"args_marker": r"\n\s*Args:\s*\n",
63+
"examples_marker": r"\n\s*Examples:\s*\n",
64+
"details_marker": r"\n\s*Details:\s*\n",
65+
"category_marker": r"\n\s*Category:\s*\n",
66+
}
67+
68+
# Output file configuration
69+
OUTPUT_CONFIG: Dict[str, Union[str, int]] = {
70+
"output_dir": ".",
71+
"filename": "posthog-python-references.json",
72+
"indent": 2,
73+
}
74+
75+
# Documentation structure defaults
76+
DOC_DEFAULTS = {
77+
"showDocs": True,
78+
"releaseTag": "public",
79+
"return_type_void": "None",
80+
"max_optional_params": 3,
81+
}

0 commit comments

Comments
 (0)