-
Notifications
You must be signed in to change notification settings - Fork 57
chore(deps): anthropic 1.x — and the undeclared direct dependency the bump would have deleted #369
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
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.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: ibuilder/massing
Length of output: 50372
🏁 Script executed:
Repository: ibuilder/massing
Length of output: 49421
🌐 Web query:
Anthropic Python SDK 1.x httpx2 migration httpx2 Sentry OpenTelemetry instrumentation support💡 Result:
The Anthropic Python SDK transitioned to
httpx2in version 1.0.0 (released August 20, 2026) to address the lack of active maintenance in the originalhttpxlibrary [1][2][3].httpx2is an API-compatible fork maintained by the Pydantic team [1][3]. Migration and Instrumentation Considerations: 1. Code Compatibility: If your code constructshttpxobjects (e.g., custom clients, transports, or timeouts) and passes them to the Anthropic SDK, you must update these to usehttpx2[1][3]. The SDK's own re-exports (such asanthropic.DefaultHttpxClient) already point tohttpx2[1]. 2. OpenTelemetry Instrumentation: Theopentelemetry-instrumentation-httpxpackage (version 0.65b0+) provides explicit support for both libraries [4][5]. Rather than relying on a global process alias, it is recommended to use theHTTPX2ClientInstrumentorspecifically forhttpx2clients [4][6][5]. This allows you to instrumenthttpx2andhttpxindependently if both are present in your application [4][6][5]. 3. Sentry Instrumentation: The Sentry Python SDK includes a dedicatedAnthropicIntegration[7]. Ashttpx2is an API-compatible drop-in replacement, the existinghttpxinstrumentation in Sentry typically continues to function; however, if you encounter issues with mocks or specialized tracing, the official migration advice is to usehttpx2.alias_httpx()at application startup [1][3][4]. This method forcesimport httpx(andimport httpcore) to resolve tohttpx2(andhttpcore2) globally, ensuring compatibility for libraries that do not yet explicitly supporthttpx2[1][3]. Recommendation: - For OpenTelemetry: UseHTTPX2ClientInstrumentorfrom theopentelemetry-instrumentation-httpxpackage to avoid global patching [4][6][5]. - For Mocks/Third-party Tracing: If other libraries fail to recognizehttpx2, callhttpx2.alias_httpx()at the very beginning of your application execution [1][3]. This must occur before anyhttpximports [1].Citations:
🏁 Script executed:
Repository: ibuilder/massing
Length of output: 20665
🌐 Web query:
site:opentelemetry-python-contrib.readthedocs.io HTTPX2ClientInstrumentor httpx2 0.65b0💡 Result:
HTTPX2ClientInstrumentor is a component of the OpenTelemetry Python Contrib instrumentation library, specifically designed to provide OpenTelemetry tracing for the httpx2 library [1][2]. It is included in the opentelemetry-instrumentation-httpx package [1][2]. The instrumentor allows developers to automatically or manually instrument httpx2 clients to capture telemetry data [1][2]. Key usage patterns include: - Automatic instrumentation: By calling HTTPX2ClientInstrumentor.instrument, the library hooks into httpx2 to automatically trace requests [2]. - Manual instrumentation: For more granular control, developers can instrument specific clients using HTTPX2ClientInstrumentor.instrument_client(client) [1][2]. - Transport integration: The package also provides SyncOpenTelemetryTransportHttpx2 and AsyncOpenTelemetryTransportHttpx2 for cases where specific transport-level instrumentation is required [2]. Regarding the version reference 0.65b0, while the OpenTelemetry Python Contrib documentation references this instrumentor, version numbering for these libraries typically follows the release cycle of the opentelemetry-instrumentation-httpx package on PyPI [1][3][4]. If you are encountering this specific beta version, it is likely a pre-release version of the instrumentation package [4]. Always verify the latest available version on PyPI or the official GitHub repository for the most stable and up-to-date implementation.
Citations:
🌐 Web query:
site:docs.sentry.io/platforms/python/integrations/anthropic AnthropicIntegration sentry-sdk 2.68.1 default integrations💡 Result:
In the Sentry Python SDK (including version 2.68.1), the Anthropic integration is included as a default integration [1]. If the
anthropicpackage is present in your project's dependencies, the Sentry SDK will automatically enable the Anthropic integration when you callsentry_sdk.init()[1]. Key details regarding this integration: - Functionality: It automatically connects Sentry with supported Anthropic methods, currently focusing on themessages.createmethod (for both synchronous and asynchronous calls) [1]. - Data Privacy: By default, Sentry does not include LLM inputs or outputs (PII) to ensure data privacy [1]. - Configuration: - To include prompts and responses, you must setsend_default_pii=Truewithin yoursentry_sdk.init()call [1]. - You can explicitly configure the integration by passing an instance ofAnthropicIntegrationto theintegrationslist insentry_sdk.init(), allowing you to adjust options such asinclude_prompts[1].Citations:
🏁 Script executed:
Repository: ibuilder/massing
Length of output: 5066
🌐 Web query:
site:github.com/getsentry/sentry-python setup_integrations integrations default_integrations sentry_sdk.init integrations list💡 Result:
In the Sentry Python SDK, integrations are managed within the sentry_sdk.init function, which orchestrates the setup of default, auto-enabling, and user-provided integrations [1]. The primary options for managing integrations during initialization are: integrations: A list of specific integration instances to enable, in addition to the defaults [2]. default_integrations: A boolean (defaulting to True) that controls whether core default integrations are loaded [2]. auto_enabling_integrations: A boolean that determines if framework-specific integrations (e.g., for Django, Flask, or Celery) should be auto-detected and enabled [2][3]. disabled_integrations: A list of specific integrations to explicitly prevent from loading, even if they are marked for default or auto-enabling [2]. Default Integrations The core default integrations include essential runtime utilities such as: - ArgvIntegration - AtexitIntegration - DedupeIntegration - ExcepthookIntegration - LoggingIntegration - ModulesIntegration - StdlibIntegration - ThreadingIntegration [4] Setting default_integrations to False disables these core integrations as well as all auto-enabling integrations, unless you explicitly add them to the integrations list [2]. Auto-Enabling Integrations Auto-enabling integrations automatically detect and hook into supported libraries and frameworks (e.g., AioHttpIntegration, CeleryIntegration, DjangoIntegration, FlaskIntegration, SqlalchemyIntegration) [3]. If you want to use these alongside your own manual configuration, ensure auto_enabling_integrations is set to True (which is the default) [2]. Example Usage To customize your setup, you can combine these options: import sentry_sdk from sentry_sdk.integrations.logging import LoggingIntegration sentry_sdk.init( dsn="your-dsn-url", default_integrations=True, integrations=[ LoggingIntegration(event_level=None), ], # Explicitly disable specific integrations if necessary disabled_integrations=[ "sentry_sdk.integrations.stdlib.StdlibIntegration" ]) [2][3][5]
Citations:
🌐 Web query:
site:github.com/getsentry/sentry-python AnthropicIntegration sentry_sdk integrations anthropic messages.create 2.68.1💡 Result:
The Anthropic integration in the Sentry Python SDK (sentry-sdk) provides automated instrumentation for the Anthropic
messages.createmethod [1][2]. This integration is included in the SDK and is designed to automatically capture AI client spans when using the Anthropic Python client, allowing for monitoring of LLM calls within Sentry [2][3]. Key details regarding this integration in Sentry SDK version 2.68.1: 1. Instrumentation: TheAnthropicIntegrationautomatically patches both synchronous and asynchronous versions of themessages.createmethod to create spans (specifically with the operation nameai.messages.create.anthropic) [4][1][5]. 2. Streaming Support: The integration supports both streaming and non-streaming calls [2]. Recent updates have also added support for emitting AI client spans for synchronousmessages.stream()calls [6]. 3. Data Collection: The SDK captures relevant metadata for these spans, such as input and output information, depending on the configuration of data collection options [7]. In version 2.68.1, specific improvements were made regarding how tool calls are gated in the integration (gating on outputs rather than inputs) [8][9]. 4. Configuration: You enable this integration by includingAnthropicIntegration()in theintegrationslist duringsentry_sdk.init()[10]. If you are encountering issues specifically withmessages.createin version 2.68.1, ensure that your environment is correctly initializing the integration and that you are using the supported Anthropic library versions. The SDK's GitHub repository tracks these features and fixes under thesentry_sdk/integrations/anthropic.pymodule [7][3].Citations:
Add OpenTelemetry instrumentation for outbound Anthropic requests.
otel.pyinstruments only FastAPI and SQLAlchemy, andrequirements.indoes not declareopentelemetry-instrumentation-httpx. AddHTTPX2ClientInstrumentorand a regression test forclient.messages.create(...). Sentry 2.68.1 provides a defaultAnthropicIntegration, so nohttpx2.alias_httpx()workaround is needed.🤖 Prompt for AI Agents
Source: MCP tools