-
Notifications
You must be signed in to change notification settings - Fork 53
Init reference doc generation #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5673e6e
8f92776
2598e98
3764b41
9c283c4
9eedab7
8ba9f26
e277713
12f06e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,4 @@ posthog-analytics | |
| pyrightconfig.json | ||
| .env | ||
| .DS_Store | ||
| posthog-python-references.json | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have an RFC that states we should use the I'm looking for the RFC and can link it to you if I find it
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes ofc, let me go through suggestions. thanks as always for sitting through reviews of code like this, my eyes started watering near the end of this. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,80 @@ | ||||||
| #!/usr/bin/env python3 | ||||||
| """ | ||||||
| Constants for PostHog Python SDK documentation generation. | ||||||
| """ | ||||||
|
|
||||||
| # Types that are built-in to Python and don't need to be documented | ||||||
| NO_DOCS_TYPES = [ | ||||||
| "Client", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: 'Client' probably shouldn't be in NO_DOCS_TYPES since it's a core SDK class that needs documentation
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not relevant this is only for object types. We don't need to self-reference. |
||||||
| "any", | ||||||
| "int", | ||||||
| "float", | ||||||
| "bool", | ||||||
| "dict", | ||||||
| "list", | ||||||
| "str", | ||||||
| "tuple", | ||||||
| "set", | ||||||
| "frozenset", | ||||||
| "bytes", | ||||||
| "bytearray", | ||||||
| "memoryview", | ||||||
| "range", | ||||||
| "slice", | ||||||
| "complex", | ||||||
| "Union", | ||||||
| "Optional", | ||||||
| "Any", | ||||||
| "Callable", | ||||||
| "Type", | ||||||
| "TypeVar", | ||||||
| "Generic", | ||||||
| "Literal", | ||||||
| "ClassVar", | ||||||
| "Final", | ||||||
| "Annotated", | ||||||
| "NotRequired", | ||||||
| "Required", | ||||||
| "void", | ||||||
| "None", | ||||||
| "NoneType", | ||||||
| "object", | ||||||
| "Unpack", | ||||||
| "BaseException", | ||||||
| "Exception", | ||||||
| ] | ||||||
|
|
||||||
| # Documentation generation metadata | ||||||
| DOCUMENTATION_METADATA = { | ||||||
| "hogRef": "0.1", | ||||||
| "slugPrefix": "posthog-python", | ||||||
| "specUrl": "https://github.com/PostHog/posthog-python" | ||||||
| } | ||||||
|
|
||||||
| # Docstring parsing patterns for new format | ||||||
| DOCSTRING_PATTERNS = { | ||||||
| "examples_section": r'Examples:\s*\n(.*?)(?=\n\s*\n\s*Category:|\Z)', | ||||||
| "args_section": r'Args:\s*\n(.*?)(?=\n\s*\n\s*Examples:|\n\s*\n\s*Details:|\n\s*\n\s*Category:|\Z)', | ||||||
| "details_section": r'Details:\s*\n(.*?)(?=\n\s*\n\s*Examples:|\n\s*\n\s*Category:|\Z)', | ||||||
| "category_section": r'Category:\s*\n\s*(.+?)\s*(?:\n|$)', | ||||||
|
||||||
| "code_block": r'```(?:python)?\n(.*?)```', | ||||||
| "param_description": r'^\s*{param_name}:\s*(.+?)(?=\n\s*\w+:|\Z)', | ||||||
| "args_marker": r'\n\s*Args:\s*\n', | ||||||
| "examples_marker": r'\n\s*Examples:\s*\n', | ||||||
| "details_marker": r'\n\s*Details:\s*\n', | ||||||
| "category_marker": r'\n\s*Category:\s*\n' | ||||||
| } | ||||||
|
|
||||||
| # Output file configuration | ||||||
| OUTPUT_CONFIG = { | ||||||
| "filename": "posthog-python-references.json", | ||||||
| "indent": 2 | ||||||
|
||||||
| } | ||||||
|
|
||||||
| # Documentation structure defaults | ||||||
| DOC_DEFAULTS = { | ||||||
| "showDocs": True, | ||||||
| "releaseTag": "public", | ||||||
| "return_type_void": "void", | ||||||
|
||||||
| "return_type_void": "void", | |
| "return_type_void": "None", |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be None like the bot is suggesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah probably, this is a left over from the TS specs. void isn't a thing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Add newline at end of file to follow Git best practices