Repository navigation
binary_loads passthrough for mk_cli and api_pkg_maker; the generated package compiles (#21) - #22
Merged
Merged
Conversation
… package compiles (#21) - mk_cli / dispatch_cli / register_cli_method take binary_loads= (keyword-only), forwarded to the HttpClient each command builds; mk_cli now also forwards config_filename, which it accepted and ignored. - api_pkg_maker writes the spec as a JSON data file the package loads at import, never as source; route names must be identifiers, setup.cfg fields stay on one line. The generated module compiles (it did not with a real spec) and a spec cannot inject code into it. - mk_api_pkg(binary_loads=<callable or dotted path>, output_dir=...); api_pkg_files() returns the generated sources without building. - 401 responses raise AuthorizationError (py2http now answers it with 401). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eal sdist name, checked refs - Generated module's internals are _-prefixed; route names must be ASCII identifiers, not start with _, not be 'api' (no shadowing, no NFKC tricks). - setup.cfg values escape % (interpolation); the built sdist is found in dist/ rather than its name reconstructed (setuptools normalizes it). - object_ref imports string refs too and requires a callable. - A spec with no routes is refused; a spec given as JSON text is parsed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 13, 2026
…ng, 'funcs' reserved Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #21.
Change
mk_cli,dispatch_cliandregister_cli_methodtake a keyword-onlybinary_loads=, which they pass to theHttpClienteach command builds.mk_clivalidates it up front withcheck_loads.mk_clialso now passes onconfig_filename, which it used to accept and ignore.openapi_spec.json, package data that the generatedfuncs.pyloads at import. It is never pasted as source.HttpClientregistered) must be Python identifiers and not keywords.path[1:], which breaks on any path with a/or a{param}.pkg_namemust be an identifier, and the setup.cfg fields are collapsed to one line.mk_api_pkggainsbinary_loads=(a callable, or its dotted path; it must be importable and must import back to the same object) andoutput_dir=(defaultOUTPUT_DIR, still read at call time).api_pkg_files()returns the sources without building them.openapi_urlnow carries the spec it was built from instead of fetching it again at import. Its functions were already fixed at build time.AuthorizationError. py2http now answersAuthorizationErrorwith 401 (Instance endpoints need an obj_owner and are bounded in size (#30) py2http#31), and without this branch the client raisedRuntimeError. That was found by the adversarial review of py2http#31.Tests
tests/: 62 passed.--doctest-modules http2py: passed.http2py/tests/api_pkg_maker_test.py: passed. It now builds intotmp_pathinstead of~/http2py.Adversarial review
Two fresh Opus passes.
Pass 1: SHIP-WITH-FIXES. It found no code injection. Fixed:
apply_sig,Sig,api, or a full-widthapi). The internals are now_-prefixed, and route names must be ASCII, must not start with_, and must not beapiorfuncs.%in a setup.cfg value broke the build. Values are now escaped.MyPkg,v1.0). The built file is now taken fromdist/.SyntaxError. It is now refused.--openapi-specgiven as JSON text crashed. It is now parsed.HttpClientattributes. This is inclient.pyand predates this PR.AuthorizationErrorinstead ofRuntimeError.Pass 2: SHIP. Fixed anyway:
funcsis now reserved.🤖 Generated with Claude Code