fix(a2a): derive agent card version from package metadata - #100
Merged
Conversation
build_agent_card() already used __version__, but the FastAPI app
constructor on the same module hardcoded version="0.1.0", which could
drift from pyproject.toml. Meanwhile __version__ itself was a hand-maintained
literal duplicated from pyproject.toml.
Make pyproject.toml the single source of truth: derive __version__ from
importlib.metadata.version("vesper") with a literal fallback for
editable/source-tree runs where the distribution is not installed. Use
__version__ in the FastAPI() constructor so both the agent card and the app
advertise the installed package version.
Add a regression test asserting the published agent card version equals
vesper.__version__.
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.
Summary
Fixes #88.
Two places hardcoded
\"0.1.0\"and could drift frompyproject.toml:vesper/__init__.py—__version__ = \"0.1.0\", a hand-maintained literal duplicated frompyproject.toml.vesper/a2a.py:415—FastAPI(version=\"0.1.0\")bypassed__version__entirely, even thoughbuild_agent_card()on the same module correctly used__version__.The issue body noted
build_agent_cardhardcoded the version, but the code already referenced__version__; the actual drift risk was in the__version__literal itself and theFastAPI()constructor. This PR addresses both.Changes
vesper/__init__.py: derive__version__fromimportlib.metadata.version(\"vesper\")with a\"0.1.0\"literal fallback for editable/source-tree runs where the distribution is not installed (PackageNotFoundError).pyproject.tomlis now the single source of truth.vesper/a2a.py: use__version__in theFastAPI()constructor instead of the hardcoded literal.tests/test_a2a.py: addtest_agent_card_version_matches_package_metadata, asserting the published agent cardversionequalsvesper.__version__.Test commands run
All 254 tests pass; compileall clean.