ci: remove hardcoded version from _version.py via post_generate.py#177
Merged
Aaron ("AJ") Steers (aaronsteers) merged 5 commits intoJun 23, 2026
Merged
Conversation
Rewrites _version.py to resolve __version__ from installed package metadata (set at build time by uv-dynamic-versioning from the git tag) instead of hardcoding it. This matches the PyAirbyte pattern. Adds _version.py to .genignore so Speakeasy won't overwrite it with a hardcoded version on regeneration. Co-Authored-By: AJ Steers <aj@airbyte.io>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Copilot started reviewing on behalf of
Aaron ("AJ") Steers (aaronsteers)
June 23, 2026 03:18
View session
There was a problem hiding this comment.
Pull request overview
This PR updates the SDK’s runtime version reporting to derive __version__ from installed package metadata (populated by uv-dynamic-versioning from git tags), removing the hardcoded version string previously committed in _version.py.
Changes:
- Resolve
__version__viaimportlib.metadata.version("airbyte-api")with a fallback when metadata is unavailable. - Recompute
__user_agent__based on the resolved runtime version and existing Speakeasy metadata constants. - Add
src/airbyte_api/_version.pyto.genignoreto prevent regeneration from reintroducing a hardcoded version.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/airbyte_api/_version.py |
Switches __version__ to runtime metadata lookup and rebuilds __user_agent__; adds explanatory module docstring. |
.genignore |
Excludes _version.py from Speakeasy regeneration to avoid hardcoded version drift. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…lib.metadata Instead of .genignore (which prevents Speakeasy from updating generation metadata), let Speakeasy generate _version.py normally and then post_generate.py surgically replaces: - __version__: str = "X.Y.Z" → importlib.metadata.version(__title__) - __user_agent__ static string → f-string using dynamic version - Removes the stale try/except fallback block Generation metadata (__openapi_doc_version__, __gen_version__) stays intact and gets updated on each Speakeasy regeneration. Co-Authored-By: AJ Steers <aj@airbyte.io>
Renames post_generate.py → post_generate.uv with PEP 723 inline metadata and uv shebang. Updates all references in poe_tasks.toml, AGENTS.md, and CONTRIBUTING.md. Co-Authored-By: AJ Steers <aj@airbyte.io>
…n__ and __user_agent__ Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
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
Follow-up to #175 and #176. Removes the hardcoded
__version__from the Speakeasy-generated_version.pyusingpost_generate.py— a surgical patch that runs after each Speakeasy generation.Approach: Let Speakeasy generate
_version.pynormally (keeping__openapi_doc_version__and__gen_version__current), thenpost_generate.pyreplaces:No silent fallback —
importlib.metadata.version()raisesPackageNotFoundErrorif the package isn't installed. At build time,uv-dynamic-versioningwrites the git tag version into package metadata.The script is idempotent — running it on an already-patched file is a no-op. No
.genignoreneeded since generation metadata stays auto-updated by Speakeasy.Link to Devin session: https://app.devin.ai/sessions/854c664803f3400387fdaa02e123b888
Requested by: Aaron ("AJ") Steers (@aaronsteers)