feat: explore Python API client codegen - #63
Draft
EastSun5566 wants to merge 6 commits into
Draft
EastSun5566 wants to merge 6 commits into
EastSun5566 wants to merge 6 commits into
Conversation
EastSun5566
added this pull request to stack #64
September 26, 2026 16:54
EastSun5566
force-pushed
the
feature/dev-3165-python-spike
branch
from
September 27, 2026 17:49
54498c7 to
dfe110d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Experiment
Try
@hey-api/openapi-pythonwith the same vendored v1 OpenAPI spec used by the Node.js API client. This draft PR is stacked on #62; nothing is published.python/src/hackmd_api/generated/. Aligncodegen/check:generatedwith Node.js.APIwrapper for profile, teams, history, personal notes/images, personal folders/order, and team note detail. Reuse generated Pydantic models, with ETag/304 handling, bounded retries for reads/PUT/DELETE, and HTTP errors. POST/PATCH are not retried;api.rawkeeps the original HTTPX responses.Result
Generated-file consistency checks pass. Compilation and all 17 offline HTTPX tests pass locally on Python 3.10 and 3.13. Tests cover authentication/base URLs, paths/query/JSON, multipart bytes, ETag, retry isolation, errors, and nullable team owners.
The previous production read-only live run passed all 5 read-only tests; the 2 mutation workflows were skipped. The new Python suite covers the existing Node live scenarios plus
200 → 304 → changed 200, but Python's full mutation run is still pending explicit authorization. Cleanup tracks created resources and restores folder order; notes go to trash, and uploaded image removal is not guaranteed.Python CI runs generated-file checks, compilation, and offline tests on Python 3.13 for relevant PRs, including this stack. It uses no API credentials and runs no live tests.
This remains an experiment: raw multipart uploads still need request overrides (tracked in hey-api/hey-api#4443), flat optional arguments do not distinguish omitted values from
None, and generated nullable fields do not fully enforce required-field presence. Grouped parameters, async wrappers, packaging/publication, and custom wrappers for all operations remain out of scope.