feat: fold pisama-auto and pisama-agent-sdk into pisama as submodules (0.6.0) - #14
Merged
Merged
Conversation
Bumps pisama to 0.6.0. Adds pisama.auto (in-package original of the standalone pisama-auto distribution: zero-code OTEL auto-instrumentation for the Anthropic/OpenAI SDKs) and pisama.agents (in-package original of pisama-agent-sdk: real-time hooks, tools, and the pisama-openhands-monitor console script for Claude Agent SDK / Harbor integrations), each behind its own optional extra so a bare `pip install pisama` pulls in no new required dependencies. Also fixes two gaps found in adversarial verification of the port: - pisama.agents was missing a __version__ attribute (the original pisama_agent_sdk exported one, 58 __all__ symbols vs the ported 57). Since this code no longer releases independently, it now aliases pisama.__version__ instead of carrying a separate hardcoded number. - The `auto` extra omitted opentelemetry-exporter-otlp-proto-http, which setup_tracer() needs for the self-hosted-collector OTLP path (it falls back to console-only tracing via a graceful ImportError otherwise, so the primary Pisama-platform-ingest path was unaffected either way). And one gap found while re-verifying "pytest with all extras installed" from a clean install: the `dev` extra was missing anthropic/openai, which tests/test_auto_sdk_instrumentation.py imports directly to exercise the patches. Carried over from pisama-auto's own dev extra for the same reason; not a runtime dependency of the `auto` extra itself. pisama-auto and pisama-agent-sdk keep publishing as standalone distributions in this release; they become thin shims re-exporting these modules in a later, separate step once this lands and pisama>=0.6.0 is live on PyPI. Verified: 196/196 tests pass, ruff clean, mypy clean on src/pisama/auto and src/pisama/agents, wheel contains both submodules, both console scripts work, bare install (no extras) still imports cleanly with opentelemetry/wrapt/posthog/anthropic/openai all absent. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The quality and test jobs installed -e ".[dev,mcp]", which never pulled in the new auto extra this PR adds. tests/test_auto_platform_exporter.py and tests/test_auto_sdk_instrumentation.py import opentelemetry.sdk modules unconditionally at collection time, so pytest failed to collect and the whole run aborted for every job on that install line (quality, test on 3.10-3.13). Switch both to -e ".[dev,mcp,auto]" so pisama.auto is actually exercised. distribution is untouched -- it deliberately installs the bare wheel with no extras. Co-Authored-By: Claude Sonnet 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.
DO NOT MERGE OR PUBLISH
This PR is blocked on human review. The standalone-repo shim work for
pisama-autoandpisama-agent-sdk(making those PyPI packages thinre-exports of this code) is a later, separate step that must wait
until this lands on
mainandpisama>=0.6.0is live on PyPI. Donot merge, do not tag a release, do not run any publish workflow until a
human has signed off.
What this is
Wave 3 of the package-consolidation plan. Folds two standalone PyPI
packages into
pisamaas new optional submodules, each in-tree asoriginal code (not a dependency on the standalone package):
pisama.auto-- in-package original of the standalonepisama-autodistribution: zero-code OTEL auto-instrumentation for the
Anthropic/OpenAI SDKs, tracing to either the Pisama platform or a
self-hosted OTLP collector. New extra:
pip install "pisama[auto]".pisama.agents-- in-package original of the standalonepisama-agent-sdkdistribution: real-time hooks, tools, and apisama-openhands-monitorconsole script for Claude Agent SDK / Harborintegrations. New extras:
pip install "pisama[agents]"/pisama[telemetry].Bumps
pisama0.5.7->0.6.0. A barepip install pisamapulls inno new required dependencies -- both submodules stay behind their own
extras. (
httpxshows up in a bare install because it was already arequired dependency of base
pisamabefore this change -- pre-existing,unrelated to this port.)
pisama-autoandpisama-agent-sdkkeep publishing as standalonedistributions in this release; they become thin shims re-exporting these
in-tree modules in a later release, once this has landed and
pisama>=0.6.0is live on PyPI.Fixes applied during adversarial verification
pisama.agentswas missing__version__. The originalpisama_agent_sdkexported__version__ = "0.3.2"as one of 58__all__symbols; the ported module only had 57. Since this code nolonger releases independently,
pisama.agents.__version__nowaliases
pisama.__version__(always reflects the actual installedpackage version) rather than carrying a separate hardcoded number.
autoextra omittedopentelemetry-exporter-otlp-proto-http,which the original
pisama-autorequired.setup_tracer()insrc/pisama/auto/_tracer.pyimports it for the non-platform(self-hosted generic OTLP collector) endpoint path, and gracefully
falls back to
ConsoleSpanExporterviaexcept ImportErrorifabsent -- so the primary Pisama-platform-ingest path was unaffected
either way, but a self-hosted-collector user was getting silently
downgraded to console-only tracing. Added
opentelemetry-exporter-otlp-proto-http>=1.20.0to theautoextrafor parity with the original package.
clean install, not part of the original two disclosed gaps.) The
devextra was missinganthropic/openai, whichtests/test_auto_sdk_instrumentation.pyimports directly to exercisethe SDK patches. A clean
pip install -e ".[dev,auto]"couldn't evencollect that test file without them. Carried over from
pisama-auto'sown
devextra, which declared the same two packages for the samereason. Test-only; does not change what any non-dev install pulls in.
CI status: was red, is now fixed by this branch
An independent adversarial review found that the actual GitHub Actions
run on this PR was red on 5 of 9 checks (
quality, andtestonPython 3.10, 3.11, 3.12, 3.13), even though the Verification section
below reported "196 passed." Both things were true at once, and the gap
between them was a material omission in the original version of this PR
body -- it stated test/lint/build results without disclosing that CI
itself was failing.
Root cause:
.github/workflows/ci.yml'squalityandtestjobsboth ran
pip install -e ".[dev,mcp]"-- neither ever installed the newautoextra this PR adds. The two new test files(
tests/test_auto_platform_exporter.pyandtests/test_auto_sdk_instrumentation.py) importopentelemetry.sdk.resourcesand relatedopentelemetrymodulesunconditionally at module scope, with no skip guard. Without the
autoextra installed, those imports fail at pytest collection time, which
aborts the entire test run for every job using that install line --
hence
qualityand all fourtestmatrix legs going red.(
tests/agents/needed no new extra and was never at issue:httpxisalready a hard dependency of base
pisama, so those tests already ranfine under
.[dev,mcp].)The "196 passed" figure in the Verification section below was real, but
it was only ever produced in a hand-built local venv with more
extras installed (
auto,agents,telemetry,mcp,langgraph,dev) than whatCI's
quality/testjobs actually install. That richer local venvmasked the gap that made CI fail.
Fix (this commit): changed both the
qualityandtestjob installlines in
.github/workflows/ci.ymlfrompip install -e ".[dev,mcp]"to
pip install -e ".[dev,mcp,auto]", so the newpisama.autocode thisPR adds is actually exercised in CI rather than silently untested. The
distributionjob is intentionally untouched -- it deliberately buildsand installs the bare wheel with zero extras, which is correct and
unrelated to this bug.
Post-fix local reproduction of the exact CI commands (fresh venvs,
this branch, this commit):
These are the real, current numbers for what CI now runs after this
commit, reproduced locally with the exact CI commands before pushing.
Disclosed, not fixed (pre-existing, out of scope for this PR)
src/pisama/collector/_bootstrap.pyandsrc/pisama/cli/watch.pyreference the external
pisama_autopackage (an optional subprocessprobe for the
pisama watchfeature). This predates this task and isunrelated to it -- whether
pisama watchshould now prefer the in-treepisama.autoinstead is a separate product decision. Not touched here.Verification (all commands run against this exact branch, clean venvs, all extras installed)
Note: the venv used for this section installs strictly more extras
(
auto,agents,telemetry,mcp,langgraph,dev) than CI'squality/testjobs install (
dev,mcp,autoas of this commit;dev,mcpbefore it).It is a valid "does the full feature set work" check, but it is not a
stand-in for what CI runs -- see the CI status section above for the
commands and numbers that actually match CI.
196/196 tests pass (59 pre-existing + 15
pisama.auto+ 122pisama.agents), matching the pre-fix count -- these are metadata/depfixes, no new test coverage added or removed.
🤖 Generated with Claude Code