Libraries: add a library's requirements to the Application automatically - #157
Draft
rjhuijsman wants to merge 2 commits into
Draft
Libraries: add a library's requirements to the Application automatically#157rjhuijsman wants to merge 2 commits into
Application automatically#157rjhuijsman wants to merge 2 commits into
Conversation
…cally Before this change, `Application` used a library's `requirements()` only to refuse to start when one was missing, so using the OAuth token manager meant listing `oauth_library()`, `ciphertext_library()`, and `ordered_map_library()`, and using a queue meant listing the sorted-map library too: what each library was built on was the application's problem to know. Now `Library` records every subclass by `name` as it is defined, and `Application` walks each listed library's requirements, constructing any it can with defaults and adding their requirements in turn, so listing a library is enough to run it. A library the application lists itself is kept, which is how an application still customizes a dependency, e.g. with an authorizer. A requirement Reboot cannot construct, because nothing registered that name or its constructor needs arguments, still fails at startup, now naming the library that needed it. - The `store_tokens=True` check asks for `oauth_library()` alone. - Tests cover the added, transitive, listed-instance, unknown, and needs-arguments cases. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Votcp4rQnqt25q6XJGNavW
Before this change, the `oauth`, `ciphertext`, `queue`, and `pubsub` pages, and the plugin skills for those libraries, told readers to register each library's dependencies by hand and explained what each was built on, because `Application` required it. Now that a library's requirements come along automatically in Python, the Python examples list the one library the application uses, the overview says so, and the skills stop instructing agents to add the dependencies. The TypeScript examples still list every library, since the TypeScript `Application` never resolved requirements. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Votcp4rQnqt25q6XJGNavW
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
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.
Important
This PR was written by an agent and has not yet been reviewed by its author. It is a draft awaiting author review before peer review.
Before this PR, a library declared what it built on through
requirements(), andApplicationused that only to refuse to start when something was missing, so an application had to listlibraries=[oauth_library(), ciphertext_library(), ordered_map_library()]to use the OAuth token manager, and[queue_library(), sorted_map_library()]to use a queue. Every docs page and plugin skill for those libraries then had to explain what each one was built on, and getting the list wrong only showed up at startup. NowApplicationconstructs the requirements itself, transitively, solibraries=[oauth_library()]is enough, and the pages and skills say so.Applicationautomatically.Libraryrecords every subclass bynameas it is defined, andApplicationwalks each listed library'srequirements(), constructing (with defaults) any it can and adding their requirements in turn. A library the application lists itself is kept, so an application still customizes a dependency, for example with an authorizer, by listing its own instance. A requirement Reboot cannot construct, because nothing registered that name or its constructor needs arguments, still fails at startup, now naming the library that needed it. Thestore_tokens=Truecheck asks foroauth_library()alone. Tests cover the added, transitive, listed-instance, unknown, and needs-arguments cases.oauth,ciphertext,queue, andpubsubpages' Python examples list one library, the overview says requirements come along, and the plugin skills for those libraries stop telling agents to register the dependencies by hand.Only the Python
Applicationresolves requirements. The TypeScriptApplicationnever checked them, and the TypeScript standard-library modules declare none, so the TypeScript examples still list every library and the pages say so.🤖 Generated with Claude Code
https://claude.ai/code/session_01Votcp4rQnqt25q6XJGNavW