Skip to content

Comments

feat: decouple container SDK version from CLI version#2771

Merged
tempusfrangit merged 5 commits intomainfrom
feat/better-sdk-selection
Feb 24, 2026
Merged

feat: decouple container SDK version from CLI version#2771
tempusfrangit merged 5 commits intomainfrom
feat/better-sdk-selection

Conversation

@tempusfrangit
Copy link
Member

@tempusfrangit tempusfrangit commented Feb 24, 2026

Summary

Previously, release builds of the CLI pinned cog==<cli-version> and coglet==<cli-version> in every generated Dockerfile, coupling the container SDK version to whatever CLI version the user happened to be running.

This PR decouples them completely. The default is now always latest PyPI. Users can pin explicitly via build.sdk_version in cog.yaml, or override via environment variable.

Resolution order

For the cog SDK:

  1. COG_SDK_WHEEL env var — explicit operator/CI override
  2. build.sdk_version in cog.yaml — user-declared pin
  3. Auto-detect dist/cog-*.whl — dev builds only (CLI version is dev)
  4. Latest PyPI — default for release builds

For coglet:

  1. COGLET_WHEEL env var — explicit override
  2. Auto-detect dist/coglet-*.whl — dev builds only
  3. Latest PyPI — default

requirements.txt / python_packages

cog and coglet are always stripped from user requirements — they are managed exclusively by the build system. If found, you'll get a warning like:

⚠ 'cog==0.17.0' found in requirements — overriding with `cog==0.18.0` from PyPI.
  Remove it from requirements and use build.sdk_version in `cog.yaml` or `COG_SDK_WHEEL` to control the version.

The warning fires even if the versions match — requirements.txt is not the intended place to control cog/coglet versions.

Changes

  • Rename COG_WHEELCOG_SDK_WHEEL for clarity
  • Remove ContainsCoglet() escape hatch — replaced by filterManagedPackages() which always strips cog/coglet from requirements with an actionable warning
  • Default to latest PyPIResolveCogWheel and ResolveCogletWheel no longer pin to the CLI version for release builds
  • Add build.sdk_version — optional field in cog.yaml to pin the cog SDK version
    • Accepts PEP 440 version strings (e.g. "0.18.0" or "0.18.0a1")
    • Pre-release versions automatically add --pre to both cog and coglet pip installs
    • Versions below 0.16.0 are rejected at Dockerfile generation time with a clear error
  • Add IsPreRelease and ValidateSDKVersion helpers to pkg/wheels

Usage

build:
  python_version: "3.12"
  sdk_version: "0.18.0"       # pin to a stable release
  # sdk_version: "0.18.0a1"   # or a pre-release

@tempusfrangit tempusfrangit requested a review from a team as a code owner February 24, 2026 00:33
@tempusfrangit tempusfrangit added this to the 0.17.0 Release milestone Feb 24, 2026
@tempusfrangit tempusfrangit changed the title feat: decouple SDK version from CLI version with --sdk-version, --cog… feat: decouple SDK version from CLI version Feb 24, 2026
@tempusfrangit tempusfrangit requested a review from bfirsh February 24, 2026 16:19
@tempusfrangit tempusfrangit marked this pull request as draft February 24, 2026 16:41
@tempusfrangit
Copy link
Member Author

Based upon an internal conversation, I think the plan is to move to:

  • Config Stanza support for cog version pinning [optional]
  • ENV overrides like we have today
  • Move forward with unpinning/decoupling.
  • No CLI options.

- Remove version-pinning from ResolveCogWheel/ResolveCogletWheel; both
  now default to latest PyPI (version pinning moves to build.sdk_version)
- Add IsPreRelease(version) bool for PEP 440 and semver pre-release detection
- Add MinimumSDKVersion constant (0.16.0) and ValidateSDKVersion helper
- Add baseVersionRe to strip pre-release suffix before version comparison
- Update doc comments and tests to reflect new unpinned defaults
@bfirsh
Copy link
Member

bfirsh commented Feb 24, 2026

If these options are just for development, I wonder if it would be better as a hidden command-line option (--x-... or --dev-... and not showing in --help, or whayever) or an environment variable? No strong opinions though.

- Add SDKVersion field to Build struct in config.go and config_file.go
- Add sdk_version to JSON schema (additionalProperties: false requires it)
- Wire sdk_version into Dockerfile generator with correct precedence:
  COG_SDK_WHEEL env var > build.sdk_version > auto-detect/latest PyPI
- Add --pre flag to cog and coglet pip installs when sdk_version is a
  pre-release (PEP 440 or semver); coglet also gets --pre since a pre-
  release sdk implies a matching pre-release coglet
- Validate sdk_version >= 0.16.0 at Dockerfile generation time
- Update existing TestCOGWheelEnvPyPIWithVersion to use a valid version
- Add tests: TestInstallCogWithSDKVersion, TestInstallCogWithPreReleaseSDKVersion,
  TestInstallCogSDKVersionBelowMinimum, TestCOGSDKWheelEnvVarOverridesSDKVersion
- Add config tests: TestSDKVersionConfig, TestSDKVersionConfigEmpty,
  TestSDKVersionConfigPreRelease, TestSDKVersionConfigBelowMinimumExplodesInGenerator
- Document sdk_version in docs/yaml.md; regenerate docs/llms.txt
@tempusfrangit tempusfrangit force-pushed the feat/better-sdk-selection branch from 36907aa to 6959efc Compare February 24, 2026 18:20
@mfainberg-cf mfainberg-cf changed the title feat: decouple SDK version from CLI version feat: decouple container SDK version from CLI version Feb 24, 2026
Previously the warning was vague. Now it tells the user exactly what the
build system is installing instead, and which mechanism to use to control
the version (build.sdk_version / COG_SDK_WHEEL / COGLET_WHEEL).

Also refactors wheel config resolution into resolveCogWheelConfigs() so
the resolved configs are available to filterManagedPackages() when it
emits warnings, and to installCog() for the actual install — resolved
once, shared between both.
@tempusfrangit tempusfrangit marked this pull request as ready for review February 24, 2026 18:34
@tempusfrangit
Copy link
Member Author

tempusfrangit commented Feb 24, 2026

Ok PR updated from conversations, ready for review @bfirsh @michaeldwan @markphelps

Copy link
Contributor

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@tempusfrangit tempusfrangit merged commit 259c7a6 into main Feb 24, 2026
37 checks passed
@tempusfrangit tempusfrangit deleted the feat/better-sdk-selection branch February 24, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants