feat: require python_version in cog.yaml build section#2741
Merged
Conversation
Users must now explicitly set python_version in the build section of cog.yaml. Previously, omitting it silently defaulted to the latest Python version (3.13), which could break models when the default was bumped in a future release. Closes #101
tempusfrangit
approved these changes
Feb 18, 2026
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
python_versiona required field in thebuildsection ofcog.yaml, so models don't silently break when the default Python version is bumped in a future releaseDefaultPythonVersionin config parsingI was considering adding a warning saying it will be required in a future version of Cog, but I have never seen anyone not use
python_version, so I would consider it a minor breaking change. We're still in the 0.x wild west land and so long as we mention it in release notes maybe it's fine? 🤷Closes #101