Skip to content

Conversation

@michaeldwan
Copy link
Member

nothing to see here, check back later

Base automatically changed from md/backport-cog-runtime to main December 17, 2025 20:42
@michaeldwan michaeldwan force-pushed the md/cog-wheel-embedding branch 3 times, most recently from 853190e to f97e859 Compare December 18, 2025 18:28
Michael Dwan added 18 commits December 19, 2025 09:56
- Create pkg/dockerfile/wheel.go with WheelSource enum and WheelConfig
- Add ParseCogWheel() to parse COG_WHEEL env var values:
  cog, coglet, coglet-alpha, URLs, or file paths
- Add GetWheelConfig() to determine wheel based on COG_WHEEL and cog_runtime flag
- Create pkg/wheels/ package with simple go:embed for cog.whl and coglet.whl
- Add script/generate-wheels to build both wheels to dist/ and copy to pkg/wheels/
- Add script/build-coglet-server for linux/amd64 coglet Go binary
- Simplify Makefile: remove complex wheel targets, use go generate
- Update StandardGenerator and migrator to use wheels.ReadCogWheel()

Closes cog-mrj, cog-a86, cog-i3w
Refactor installCog() to dispatch based on GetWheelConfig():
- installEmbeddedCogWheel() for COG_WHEEL=cog (default when cog_runtime: false)
- installEmbeddedCogletWheel() for COG_WHEEL=coglet
- installCogletAlpha() for COG_WHEEL=coglet-alpha (default when cog_runtime: true)
- installWheelFromURL() for COG_WHEEL=https://...
- installWheelFromFile() for COG_WHEEL=/path/to/file.whl

Backwards compatible: existing behavior unchanged without COG_WHEEL set.

Closes cog-1xb
Test coverage for all COG_WHEEL values:
- Default with cog_runtime: false -> embedded cog wheel
- Default with cog_runtime: true -> coglet-alpha (PinnedCogletURL)
- COG_WHEEL=cog -> embedded cog wheel (overrides cog_runtime)
- COG_WHEEL=coglet -> embedded coglet wheel
- COG_WHEEL=coglet-alpha -> PinnedCogletURL
- COG_WHEEL=https://... -> URL install (with/without coglet env vars)
- COG_WHEEL=/path/to/file.whl -> local file install

Closes cog-6q8
Better separation of concerns - wheel selection logic belongs
with wheel embedding, not Dockerfile generation.
- Update generate-wheels to use COG_WHEEL/COGLET_WHEEL env vars if set
- Add astral-sh/setup-uv@v7 to test-go job for coglet wheel building
- Remove go:generate directives from pkg/config/compatibility.go
- Add script/generate-compat for manual matrix regeneration
- Document in CONTRIBUTING.md when/how to update compatibility matrices

This speeds up 'go generate ./...' by only running wheel generation,
not the slow compatgen tool that rarely needs to run.
- Update package-data pattern in coglet/pyproject.toml to match
  bin/coglet-server-* instead of cog-*
- Fix gocritic appendAssign lint error in installWheelFromURL
- Add script/build-wheels to build both cog and coglet wheels to dist/
- Replace go:generate script call with simple cp commands
- Delete script/generate-wheels (no longer needed)
- Add 'make wheel' target
- Simplify CI: use merge-multiple to download all artifacts at once
- Remove COG_WHEEL/COGLET_WHEEL env var setup from CI jobs
pip requires wheel filenames to follow PEP 427 format (e.g.,
cog-0.16.10-py3-none-any.whl). Previously we renamed wheels to simple
names (cog.whl) which pip rejected.

Switch from []byte embedding to embed.FS which preserves the original
versioned filenames. Panic instead of returning error since missing
wheels indicate a broken build.
Python 3.8 reached end-of-life in October 2024. This change:

- Updates minimum Python version from 3.8 to 3.9
- Updates pyproject.toml requires-python
- Removes py38 from tox test matrix
- Updates all test fixtures and test cases
- Updates documentation
The CI test matrix is derived from these classifiers via the
build-and-inspect-python-package action.
- Update test_python_37_deprecated to expect 3.9 in error message
- Remove obsolete 'fast loader' assertions that were for Python <3.9
Removes Python 3.8 resolution markers and dependencies that were
only needed for Python <3.9.
- Fix binary path in go_cog.py to use cog/bin/coglet-server-{os}-{arch}
- Add 'pip uninstall cog' before coglet install to avoid conflicts with
  pre-installed cog in base images (e.g. r8.im/cog-base)
- Add wheel count assertion to prevent stale wheels from being embedded
- Clean old wheels in build-wheels script before building new ones
@michaeldwan michaeldwan force-pushed the md/cog-wheel-embedding branch from 18dd742 to 8ecdcf2 Compare December 19, 2025 17:09
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.

2 participants